admin

package
v0.1.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package admin provides DTOs for admin API operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Admin

type Admin struct {
	Id        int64    `json:"id"`
	Username  string   `json:"username"`
	Nickname  string   `json:"nickname"`
	Email     string   `json:"email"`
	Phone     string   `json:"phone"`
	Roles     []string `json:"roles"`
	Status    int      `json:"status"` // 1:active 0:disabled
	CreatedAt string   `json:"createdAt"`
	UpdatedAt string   `json:"updatedAt"`
}

Admin represents an admin user.

type AdminCreateRequest

type AdminCreateRequest struct {
	Username string   `json:"username"`
	Password string   `json:"password"`
	Nickname string   `json:"nickname"`
	Email    string   `json:"email"`
	Phone    string   `json:"phone"`
	Roles    []string `json:"roles"`
}

AdminCreateRequest represents the request to create an admin.

type AdminCreateResponse

type AdminCreateResponse struct {
	Admin
}

AdminCreateResponse represents the response after creating an admin.

type AdminDeleteRequest

type AdminDeleteRequest struct {
	ID string `uri:"id"`
}

AdminDeleteRequest represents the request to delete an admin.

type AdminDeleteResponse

type AdminDeleteResponse struct {
	Message string `json:"message"`
}

AdminDeleteResponse represents the response after deleting an admin.

type AdminDetailRequest

type AdminDetailRequest struct {
	ID string `uri:"id"`
}

AdminDetailRequest represents the request to get admin details.

type AdminDetailResponse

type AdminDetailResponse struct {
	Admin
}

AdminDetailResponse represents the response with admin details.

type AdminGame

type AdminGame struct {
	GameId   string   `json:"gameId"`
	GameName string   `json:"gameName"`
	Envs     []string `json:"envs"`
}

AdminGame represents a game scope for an admin.

type AdminGamesRequest

type AdminGamesRequest struct {
	ID string `uri:"id"`
}

AdminGamesRequest represents the request to get admin game scopes.

type AdminGamesResponse

type AdminGamesResponse struct {
	Games []AdminGame `json:"games"`
}

AdminGamesResponse represents the response with admin game scopes.

type AdminGamesUpdateRequest

type AdminGamesUpdateRequest struct {
	ID    string      `uri:"id"`
	Games []AdminGame `json:"games"`
}

AdminGamesUpdateRequest represents the request to update admin game scopes.

type AdminPasswordResetRequest

type AdminPasswordResetRequest struct {
	ID          string `uri:"id"`
	NewPassword string `json:"newPassword"`
}

AdminPasswordResetRequest represents the request to reset admin password.

type AdminPasswordResetResponse

type AdminPasswordResetResponse struct {
	Message string `json:"message"`
}

AdminPasswordResetResponse represents the response after password reset.

type AdminUpdateRequest

type AdminUpdateRequest struct {
	ID       string   `uri:"id"`
	Nickname string   `json:"nickname"`
	Email    string   `json:"email"`
	Phone    string   `json:"phone"`
	Roles    []string `json:"roles"`
	Status   int      `json:"status"`
}

AdminUpdateRequest represents the request to update an admin.

type AdminUpdateResponse

type AdminUpdateResponse struct {
	Admin
}

AdminUpdateResponse represents the response after updating an admin.

type AdminsListRequest

type AdminsListRequest struct {
	Page     int    `form:"page,optional,default=1"`
	PageSize int    `form:"pageSize,optional,default=20"`
	Search   string `form:"search"`
	Role     string `form:"role"`
	Status   int    `form:"status"`
}

AdminsListRequest represents the request to list admins.

type AdminsListResponse

type AdminsListResponse struct {
	Items []Admin `json:"items"`
	Total int64   `json:"total"`
	Page  int     `json:"page"`
	Size  int     `json:"pageSize"`
}

AdminsListResponse represents the response with a list of admins.

type CreateRequest

type CreateRequest = AdminCreateRequest

type CreateResponse

type CreateResponse = AdminCreateResponse

type DeleteRequest

type DeleteRequest = AdminDeleteRequest

type GetGamesRequest

type GetGamesRequest = AdminGamesRequest

type GetGamesResponse

type GetGamesResponse = AdminGamesResponse

type GetRequest

type GetRequest = AdminDetailRequest

type GetResponse

type GetResponse = AdminDetailResponse

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(service *Service) *Handler

func (*Handler) Create

func (h *Handler) Create(c *gin.Context)

Create handles the request to create a new admin

func (*Handler) Delete

func (h *Handler) Delete(c *gin.Context)

Delete handles the request to delete an admin

func (*Handler) Get

func (h *Handler) Get(c *gin.Context)

Get handles the request to get admin details

func (*Handler) GetGames

func (h *Handler) GetGames(c *gin.Context)

GetGames handles the request to get admin game scopes

func (*Handler) List

func (h *Handler) List(c *gin.Context)

List handles the request to list admins

func (*Handler) PasswordReset

func (h *Handler) PasswordReset(c *gin.Context)

PasswordReset handles the request to reset an admin's password

func (*Handler) Update

func (h *Handler) Update(c *gin.Context)

Update handles the request to update an admin

func (*Handler) UpdateGames

func (h *Handler) UpdateGames(c *gin.Context)

UpdateGames handles the request to update admin game scopes

type ListRequest

type ListRequest = AdminsListRequest

Type aliases for backward compatibility with existing code.

type ListResponse

type ListResponse = AdminsListResponse

type PasswordResetRequest

type PasswordResetRequest = AdminPasswordResetRequest

type Permission

type Permission struct {
	Id          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Resource    string `json:"resource"`
	Action      string `json:"action"`
	Category    string `json:"category"`
	CreatedAt   string `json:"createdAt"`
	UpdatedAt   string `json:"updatedAt"`
}

Permission represents a permission entry.

type PermissionDetailRequest

type PermissionDetailRequest struct {
	ID string `uri:"id"`
}

PermissionDetailRequest represents the request to get permission details.

type PermissionDetailResponse

type PermissionDetailResponse struct {
	Permission
}

PermissionDetailResponse represents the response with permission details.

type PermissionsListRequest

type PermissionsListRequest struct {
	Page     int    `form:"page,optional,default=1"`
	PageSize int    `form:"pageSize,optional,default=20"`
	Category string `form:"category"`
	Resource string `form:"resource"`
}

PermissionsListRequest represents the request to list permissions.

type PermissionsListResponse

type PermissionsListResponse struct {
	Items []Permission `json:"items"`
	Total int64        `json:"total"`
	Page  int          `json:"page"`
	Size  int          `json:"pageSize"`
}

PermissionsListResponse represents the response with a list of permissions.

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(svcCtx *svc.ServiceContext) *Service

func (*Service) Create

func (s *Service) Create(ctx context.Context, req *CreateRequest) (*CreateResponse, error)

Create creates a new admin user

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, req *DeleteRequest) error

Delete deletes an admin

func (*Service) Get

func (s *Service) Get(ctx context.Context, req *GetRequest) (*GetResponse, error)

Get retrieves details of a specific admin

func (*Service) GetGames

func (s *Service) GetGames(ctx context.Context, req *GetGamesRequest) (*GetGamesResponse, error)

GetGames retrieves the game scopes for an admin

func (*Service) List

func (s *Service) List(ctx context.Context, req *ListRequest) (*ListResponse, error)

List retrieves a paginated list of admins

func (*Service) PasswordReset

func (s *Service) PasswordReset(ctx context.Context, req *PasswordResetRequest) error

PasswordReset resets an admin's password

func (*Service) Update

func (s *Service) Update(ctx context.Context, req *UpdateRequest) (*UpdateResponse, error)

Update updates an existing admin

func (*Service) UpdateGames

func (s *Service) UpdateGames(ctx context.Context, req *UpdateGamesRequest) (*GetGamesResponse, error)

UpdateGames updates the game scopes for an admin

type UpdateGamesRequest

type UpdateGamesRequest = AdminGamesUpdateRequest

type UpdateRequest

type UpdateRequest = AdminUpdateRequest

type UpdateResponse

type UpdateResponse = AdminUpdateResponse

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL