From cb52b17f92e2d2293f7c003649743464492bca48 Mon Sep 17 00:00:00 2001 From: techknowlogick Date: Fri, 1 Mar 2024 03:23:28 -0500 Subject: Add admin API route for managing user's badges (#23106) Fix #22785 --------- Co-authored-by: Lunny Xiao --- modules/structs/user.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'modules/structs') 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"` +} -- cgit v1.2.3