Mod event and user table, add event CURD

Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
2025-12-25 21:55:08 +08:00
parent 8e43d6699c
commit 3dbcc00a2d
5 changed files with 86 additions and 74 deletions

View File

@@ -40,7 +40,6 @@ func Info(c *gin.Context) {
"subtitle": data.Subtitle,
"avatar": data.Avatar,
"checkin": data.Checkin,
"joined_event": data.JoinedEvent,
"permission_level": data.PermissionLevel,
})
}

View File

@@ -8,7 +8,7 @@ import (
)
func Update(c *gin.Context) {
var ReqInfo data.UserUpdateInput
var ReqInfo data.User
c.BindJSON(&ReqInfo)
// New user model
@@ -32,13 +32,17 @@ func Update(c *gin.Context) {
return
}
user.Avatar = ReqInfo.Avatar
user.Email = ReqInfo.Email
user.Nickname = ReqInfo.Nickname
user.Subtitle = ReqInfo.Subtitle
// Cant change user type under permission 2
if user.PermissionLevel < 2 {
ReqInfo.Type = nil
if user.PermissionLevel >= 2 {
user.Type = ReqInfo.Type
}
// Update user info
user.UpdateByUserID(userId.(uuid.UUID), &ReqInfo)
user.UpdateByUserID(userId.(uuid.UUID))
c.JSON(200, gin.H{
"status": "success",