Add admin API route for managing user's badges (#23106)

Fix #22785

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
techknowlogick 2024-03-01 03:23:28 -05:00 committed by GitHub
parent e71eb8930a
commit cb52b17f92
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 523 additions and 2 deletions

View file

@ -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"`
}