refactor: updated task related grpc proto

This commit is contained in:
Marvin Zhang
2024-10-29 17:59:39 +08:00
parent 3aa32a14ad
commit 789f71fd80
9 changed files with 61 additions and 64 deletions

View File

@@ -365,6 +365,10 @@ func PostTaskRestart(c *gin.Context) {
}
func PostTaskCancel(c *gin.Context) {
type Payload struct {
Force bool `json:"force,omitempty"`
}
// id
id, err := primitive.ObjectIDFromHex(c.Param("id"))
if err != nil {
@@ -372,6 +376,13 @@ func PostTaskCancel(c *gin.Context) {
return
}
// payload
var p Payload
if err := c.ShouldBindJSON(&p); err != nil {
HandleErrorBadRequest(c, err)
return
}
// task
t, err := service.NewModelServiceV2[models.TaskV2]().GetById(id)
if err != nil {
@@ -393,7 +404,7 @@ func PostTaskCancel(c *gin.Context) {
HandleErrorInternalServerError(c, err)
return
}
if err := schedulerSvc.Cancel(id, u.Id); err != nil {
if err := schedulerSvc.Cancel(id, u.Id, p.Force); err != nil {
HandleErrorInternalServerError(c, err)
return
}