
All checks were successful
Deploy Dev / Build (pull_request) Successful in 39s
Deploy Dev / Push (pull_request) Successful in 24s
Deploy Dev / Deploy dev (pull_request) Successful in 8s
Deploy Prod / Build (pull_request) Successful in 38s
Deploy Prod / Push (pull_request) Successful in 25s
Deploy Prod / Deploy prod (pull_request) Successful in 8s
28 lines
485 B
Go
28 lines
485 B
Go
package routers
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
tasks "queues-go/app/storage/mongo/collections"
|
|
)
|
|
|
|
type FinishRequestBody struct {
|
|
Id string `json:"id"`
|
|
}
|
|
|
|
func Finish(r *http.Request) (interface{}, int) {
|
|
d := json.NewDecoder(r.Body)
|
|
body := FinishRequestBody{}
|
|
err := d.Decode(&body)
|
|
if err != nil {
|
|
return nil, http.StatusBadRequest
|
|
}
|
|
|
|
err = tasks.Finish(body.Id)
|
|
if err != nil {
|
|
return nil, http.StatusInternalServerError
|
|
}
|
|
|
|
return nil, http.StatusAccepted
|
|
}
|