add more routes

This commit is contained in:
2026-09-06 21:57:03 +08:00
parent 4688c10585
commit 5743a36f51
35 changed files with 202373 additions and 2 deletions

View File

@@ -0,0 +1,38 @@
package param_userid
import (
"bdgrp_go/db"
"bdgrp_go/pbutil"
"bdgrp_go/routes"
"bdgrp_go/utils"
"fmt"
"github.com/gofiber/fiber/v2"
)
func init() {
path := routes.PathOf()
routes.Register(func(app *fiber.App) {
app.Put(path, mainDeck)
fmt.Println("Loaded:", path)
})
}
func mainDeck(c *fiber.Ctx) error {
decrypted, err := utils.Decrypt(c.Body())
if err != nil {
fmt.Println(err)
}
decoded, err := pbutil.Decode("UserPutRequest", decrypted)
userid := c.Params("userid")
user := db.FindUser(userid)
user["mainDeck"] = decoded["mainDeck"]
db.Save()
return c.Send(nil)
}