Full Restruct API and Services
Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
@@ -8,6 +8,16 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// Full retrieves the complete list of users directly from the database table.
|
||||
// @Summary Get Full User Table
|
||||
// @Description Fetches all user records without pagination. This is typically used for administrative overview or data export.
|
||||
// @Tags User
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} service_user.UserTableResult
|
||||
// @Failure 500 {string} string "Internal Server Error (Database Error)"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /user/full [get]
|
||||
func (self *UserHandler) Full(c *gin.Context) {
|
||||
userTablePayload := &service_user.UserTablePayload{
|
||||
Context: c,
|
||||
|
||||
@@ -9,6 +9,18 @@ import (
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// Info retrieves the profile information of the currently authenticated user.
|
||||
// @Summary Get My User Information
|
||||
// @Description Fetches the complete profile data for the user associated with the provided session/token.
|
||||
// @Tags User
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} service_user.UserInfoResult
|
||||
// @Failure 403 {string} string "Missing User ID / Unauthorized"
|
||||
// @Failure 404 {string} string "User Not Found"
|
||||
// @Failure 500 {string} string "Internal Server Error (UUID Parse Failed)"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /user/info [get]
|
||||
func (self *UserHandler) Info(c *gin.Context) {
|
||||
userIdOrig, ok := c.Get("user_id")
|
||||
if !ok {
|
||||
|
||||
@@ -8,6 +8,18 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// List retrieves a paginated list of users from the search engine.
|
||||
// @Summary List Users
|
||||
// @Description Fetches a list of users with support for pagination via limit and offset.
|
||||
// @Tags User
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param limit query string false "Maximum number of users to return (default 0)"
|
||||
// @Param offset query string true "Number of users to skip"
|
||||
// @Success 200 {object} service_user.UserListResult
|
||||
// @Failure 400 {string} string "Invalid Input (Format Error)"
|
||||
// @Failure 500 {string} string "Internal Server Error (Search Engine or Missing Offset)"
|
||||
// @Router /user/list [get]
|
||||
func (self *UserHandler) List(c *gin.Context) {
|
||||
type ListQuery struct {
|
||||
Limit *string `form:"limit"`
|
||||
|
||||
@@ -9,6 +9,20 @@ import (
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// Update modifies the profile information for the currently authenticated user.
|
||||
// @Summary Update User Information
|
||||
// @Description Updates specific profile fields such as username, nickname, subtitle, avatar (URL), and bio (Base64).
|
||||
// @Description Validation: Username (5-255 chars), Nickname (max 24 chars), Subtitle (max 32 chars).
|
||||
// @Tags User
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param payload body service_user.UserInfoData true "Updated User Profile Data"
|
||||
// @Success 200 {object} service_user.UserInfoResult
|
||||
// @Failure 400 {string} string "Invalid Input (Validation Failed)"
|
||||
// @Failure 403 {string} string "Missing User ID / Unauthorized"
|
||||
// @Failure 500 {string} string "Internal Server Error (Database Error / UUID Parse Failed)"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /user/update [patch]
|
||||
func (self *UserHandler) Update(c *gin.Context) {
|
||||
userIdOrig, ok := c.Get("user_id")
|
||||
if !ok {
|
||||
|
||||
Reference in New Issue
Block a user