aboutsummaryrefslogtreecommitdiffstats
path: root/modules/structs
diff options
context:
space:
mode:
authortechknowlogick <techknowlogick@gitea.com>2024-03-01 03:23:28 -0500
committerGitHub <noreply@github.com>2024-03-01 03:23:28 -0500
commitcb52b17f92e2d2293f7c003649743464492bca48 (patch)
tree50351d737a406f4e9c2850c9918525998d09a787 /modules/structs
parente71eb8930a5d0f60874b038c223498b41ad65592 (diff)
downloadgitea-cb52b17f92e2d2293f7c003649743464492bca48.tar.gz
gitea-cb52b17f92e2d2293f7c003649743464492bca48.zip
Add admin API route for managing user's badges (#23106)
Fix #22785 --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'modules/structs')
-rw-r--r--modules/structs/user.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/modules/structs/user.go b/modules/structs/user.go
index 0df67894b0..c43558be5d 100644
--- a/modules/structs/user.go
+++ b/modules/structs/user.go
@@ -1,4 +1,5 @@
// Copyright 2014 The Gogs Authors. All rights reserved.
+// Copyright 2023 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package structs
@@ -108,3 +109,33 @@ type UpdateUserAvatarOption struct {
// image must be base64 encoded
Image string `json:"image" binding:"Required"`
}
+
+// Badge represents a user badge
+// swagger:model
+type Badge struct {
+ ID int64 `json:"id"`
+ Slug string `json:"slug"`
+ Description string `json:"description"`
+ ImageURL string `json:"image_url"`
+}
+
+// UserBadge represents a user badge
+// swagger:model
+type UserBadge struct {
+ ID int64 `json:"id"`
+ BadgeID int64 `json:"badge_id"`
+ UserID int64 `json:"user_id"`
+}
+
+// UserBadgeOption options for link between users and badges
+type UserBadgeOption struct {
+ // example: ["badge1","badge2"]
+ BadgeSlugs []string `json:"badge_slugs" binding:"Required"`
+}
+
+// BadgeList
+// swagger:response BadgeList
+type BadgeList struct {
+ // in:body
+ Body []Badge `json:"body"`
+}