fix
This commit is contained in:
parent
9533fe5637
commit
932f263373
@ -5,12 +5,14 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
tasks "queues-go/app/storage/mongo/collections"
|
tasks "queues-go/app/storage/mongo/collections"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"go.mongodb.org/mongo-driver/bson"
|
||||||
)
|
)
|
||||||
|
|
||||||
type PutRequestBody struct {
|
type PutRequestBody struct {
|
||||||
Payload json.RawMessage `json:"payload"`
|
Payload bson.M `json:"payload"`
|
||||||
SecondsToExecute int `json:"seconds_to_execute"`
|
SecondsToExecute int `json:"seconds_to_execute"`
|
||||||
Delay *int `json:"delay"`
|
Delay *int `json:"delay"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func Put(w http.ResponseWriter, r *http.Request) {
|
func Put(w http.ResponseWriter, r *http.Request) {
|
||||||
|
@ -23,13 +23,13 @@ type Task struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type InsertedTask struct {
|
type InsertedTask struct {
|
||||||
Queue string `bson:"queue"`
|
Queue string `bson:"queue"`
|
||||||
Payload interface{} `bson:"payload"`
|
Payload bson.M `bson:"payload"`
|
||||||
PutAt time.Time `bson:"put_at"`
|
PutAt time.Time `bson:"put_at"`
|
||||||
AvailableFrom time.Time `bson:"available_from"`
|
AvailableFrom time.Time `bson:"available_from"`
|
||||||
SecondsToExecute int `bson:"seconds_to_execute"`
|
SecondsToExecute int `bson:"seconds_to_execute"`
|
||||||
TakenAt *time.Time `bson:"taken_at"`
|
TakenAt *time.Time `bson:"taken_at"`
|
||||||
Attempts int `bson:"attempts"`
|
Attempts int `bson:"attempts"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func Add(task InsertedTask) error {
|
func Add(task InsertedTask) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user