Documentation
¶
Overview ¶
Package admin provides DTOs for admin API operations.
Index ¶
- type Admin
- type AdminCreateRequest
- type AdminCreateResponse
- type AdminDeleteRequest
- type AdminDeleteResponse
- type AdminDetailRequest
- type AdminDetailResponse
- type AdminGame
- type AdminGamesRequest
- type AdminGamesResponse
- type AdminGamesUpdateRequest
- type AdminPasswordResetRequest
- type AdminPasswordResetResponse
- type AdminUpdateRequest
- type AdminUpdateResponse
- type AdminsListRequest
- type AdminsListResponse
- type CreateRequest
- type CreateResponse
- type DeleteRequest
- type GetGamesRequest
- type GetGamesResponse
- type GetRequest
- type GetResponse
- type Handler
- func (h *Handler) Create(c *gin.Context)
- func (h *Handler) Delete(c *gin.Context)
- func (h *Handler) Get(c *gin.Context)
- func (h *Handler) GetGames(c *gin.Context)
- func (h *Handler) List(c *gin.Context)
- func (h *Handler) PasswordReset(c *gin.Context)
- func (h *Handler) Update(c *gin.Context)
- func (h *Handler) UpdateGames(c *gin.Context)
- type ListRequest
- type ListResponse
- type PasswordResetRequest
- type Permission
- type PermissionDetailRequest
- type PermissionDetailResponse
- type PermissionsListRequest
- type PermissionsListResponse
- type Service
- func (s *Service) Create(ctx context.Context, req *CreateRequest) (*CreateResponse, error)
- func (s *Service) Delete(ctx context.Context, req *DeleteRequest) error
- func (s *Service) Get(ctx context.Context, req *GetRequest) (*GetResponse, error)
- func (s *Service) GetGames(ctx context.Context, req *GetGamesRequest) (*GetGamesResponse, error)
- func (s *Service) List(ctx context.Context, req *ListRequest) (*ListResponse, error)
- func (s *Service) PasswordReset(ctx context.Context, req *PasswordResetRequest) error
- func (s *Service) Update(ctx context.Context, req *UpdateRequest) (*UpdateResponse, error)
- func (s *Service) UpdateGames(ctx context.Context, req *UpdateGamesRequest) (*GetGamesResponse, error)
- type UpdateGamesRequest
- type UpdateRequest
- type UpdateResponse
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 ¶
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 (*Handler) PasswordReset ¶
PasswordReset handles the request to reset an admin's password
func (*Handler) UpdateGames ¶
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