mirror of
https://github.com/wisplite/tether.git
synced 2026-05-01 06:22:41 -05:00
fix the bugs that were causing mutation response errors, and add duplicate subscription checks
MUTATIONS WORK BTW!!!
This commit is contained in:
+5
-2
@@ -42,8 +42,11 @@ func main() {
|
||||
}, []string{"messages"})
|
||||
|
||||
engine.RegisterMutation("createMessage", func(ctx *tether.MutationCtx) interface{} {
|
||||
ctx.DB.Create(&Messages{ID: uuid.NewString(), Message: ctx.Params["message"].(string), SenderID: ctx.AuthCtx.UserID, RoomID: ctx.Params["room"].(string)})
|
||||
return nil
|
||||
msg := &Messages{ID: uuid.NewString(), Message: ctx.Params["message"].(string), SenderID: ctx.AuthCtx.UserID, RoomID: ctx.Params["room"].(string)}
|
||||
if err := ctx.DB.Create(msg).Error; err != nil {
|
||||
return map[string]interface{}{"error": err.Error()}
|
||||
}
|
||||
return msg
|
||||
})
|
||||
|
||||
http.HandleFunc("/tether", engine.Handle)
|
||||
|
||||
Reference in New Issue
Block a user