Documentation ¶
Index ¶
- Variables
- func GenerateFlag(flag string) string
- func GetUserInstanceRequestMap(userID uint) int64
- func InitService()
- func SetUserInstanceRequestMap(userID uint, t int64)
- type AuthService
- type CategoryService
- type ChallengeService
- func (t *ChallengeService) Create(req request.ChallengeCreateRequest) error
- func (t *ChallengeService) Delete(id uint) error
- func (t *ChallengeService) Find(req request.ChallengeFindRequest) ([]model.Challenge, int64, error)
- func (t *ChallengeService) Update(req request.ChallengeUpdateRequest) error
- type ConfigService
- type FlagService
- type GameChallengeService
- func (g *GameChallengeService) Create(req request.GameChallengeCreateRequest) error
- func (g *GameChallengeService) Delete(req request.GameChallengeDeleteRequest) error
- func (g *GameChallengeService) Find(req request.GameChallengeFindRequest) ([]model.GameChallenge, error)
- func (g *GameChallengeService) Update(req request.GameChallengeUpdateRequest) error
- type GameService
- type GameTeamService
- func (g *GameTeamService) Create(req request.GameTeamCreateRequest) error
- func (g *GameTeamService) Delete(req request.GameTeamDeleteRequest) error
- func (g *GameTeamService) Find(req request.GameTeamFindRequest) ([]model.GameTeam, int64, error)
- func (g *GameTeamService) Update(req request.GameTeamUpdateRequest) error
- type IAuthService
- type ICategoryService
- type IChallengeService
- type IConfigService
- type IFlagService
- type IGameChallengeService
- type IGameService
- type IGameTeamService
- type IMediaService
- type INoticeService
- type IPodService
- type ISubmissionService
- type ITeamService
- type IUserService
- type IUserTeamService
- type IWebhookService
- type MediaService
- func (m *MediaService) DeleteChallengeAttachment(id uint) error
- func (m *MediaService) DeleteGamePoster(id uint) error
- func (m *MediaService) DeleteTeamAvatar(id uint) error
- func (m *MediaService) DeleteUserAvatar(id uint) error
- func (m *MediaService) SaveChallengeAttachment(id uint, fileHeader *multipart.FileHeader) error
- func (m *MediaService) SaveGamePoster(id uint, fileHeader *multipart.FileHeader) error
- func (m *MediaService) SaveTeamAvatar(id uint, fileHeader *multipart.FileHeader) error
- func (m *MediaService) SaveUserAvatar(id uint, fileHeader *multipart.FileHeader) error
- type NoticeService
- func (n *NoticeService) Create(req request.NoticeCreateRequest) error
- func (n *NoticeService) Delete(req request.NoticeDeleteRequest) error
- func (n *NoticeService) Find(req request.NoticeFindRequest) ([]model.Notice, int64, error)
- func (n *NoticeService) Update(req request.NoticeUpdateRequest) error
- type PodService
- func (t *PodService) Create(req request.PodCreateRequest) (model.Pod, error)
- func (t *PodService) Find(req request.PodFindRequest) ([]model.Pod, int64, error)
- func (t *PodService) IsLimited(userID uint, limit int64) (remainder int64)
- func (t *PodService) ParallelLimit(req request.PodCreateRequest)
- func (t *PodService) Remove(req request.PodRemoveRequest) error
- func (t *PodService) Renew(req request.PodRenewRequest) error
- type Service
- type SubmissionService
- func (t *SubmissionService) Create(req request.SubmissionCreateRequest) (status int, rank int64, err error)
- func (t *SubmissionService) Delete(id uint) error
- func (t *SubmissionService) Find(req request.SubmissionFindRequest) ([]model.Submission, int64, error)
- func (t *SubmissionService) JudgeDynamicChallenge(req request.SubmissionCreateRequest) (status int, err error)
- type TeamService
- func (t *TeamService) Create(req request.TeamCreateRequest) error
- func (t *TeamService) Delete(id uint) error
- func (t *TeamService) Find(req request.TeamFindRequest) ([]model.Team, int64, error)
- func (t *TeamService) GetInviteToken(req request.TeamGetInviteTokenRequest) (token string, err error)
- func (t *TeamService) Update(req request.TeamUpdateRequest) error
- func (t *TeamService) UpdateInviteToken(req request.TeamUpdateInviteTokenRequest) (token string, err error)
- type UserService
- func (t *UserService) Create(req request.UserCreateRequest) error
- func (t *UserService) Delete(id uint) error
- func (t *UserService) Find(req request.UserFindRequest) ([]model.User, int64, error)
- func (t *UserService) GetJwtTokenByID(user model.User) (tokenString string, err error)
- func (t *UserService) Login(req request.UserLoginRequest) (model.User, string, error)
- func (t *UserService) Logout(token string) (uint, error)
- func (t *UserService) Register(req request.UserRegisterRequest) error
- func (t *UserService) Update(req request.UserUpdateRequest) error
- type UserTeamService
- type WebhookService
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // UserPodRequestMap 用于存储用户上次请求的时间 UserPodRequestMap = struct { sync.RWMutex m map[uint]int64 }{/* contains filtered or unexported fields */} // PodManagers is a mapping of PodID and manager pointer. PodManagers = make(map[uint]manager.IContainerManager) )
Functions ¶
func GenerateFlag ¶
func GetUserInstanceRequestMap ¶
GetUserInstanceRequestMap 返回用户上次请求的时间
func InitService ¶
func InitService()
func SetUserInstanceRequestMap ¶
SetUserInstanceRequestMap 设置用户上次请求的时间
Types ¶
type AuthService ¶
type AuthService struct {
// contains filtered or unexported fields
}
func (*AuthService) CanModifyTeam ¶
func (a *AuthService) CanModifyTeam(user *model.User, targetTeamID uint) bool
func (*AuthService) CanModifyUser ¶
func (a *AuthService) CanModifyUser(user *model.User, targetUserID uint) bool
type CategoryService ¶
type CategoryService struct {
// contains filtered or unexported fields
}
func (*CategoryService) Delete ¶
func (c *CategoryService) Delete(req request.CategoryDeleteRequest) error
func (*CategoryService) Find ¶
func (c *CategoryService) Find(req request.CategoryFindRequest) ([]model.Category, error)
type ChallengeService ¶
type ChallengeService struct {
// contains filtered or unexported fields
}
func (*ChallengeService) Create ¶
func (t *ChallengeService) Create(req request.ChallengeCreateRequest) error
func (*ChallengeService) Delete ¶
func (t *ChallengeService) Delete(id uint) error
func (*ChallengeService) Find ¶
func (t *ChallengeService) Find(req request.ChallengeFindRequest) ([]model.Challenge, int64, error)
func (*ChallengeService) Update ¶
func (t *ChallengeService) Update(req request.ChallengeUpdateRequest) error
type ConfigService ¶
type ConfigService struct { }
func (*ConfigService) Update ¶
func (c *ConfigService) Update(req request.ConfigUpdateRequest) error
type FlagService ¶
type FlagService struct {
// contains filtered or unexported fields
}
func (*FlagService) Create ¶
func (f *FlagService) Create(req request.FlagCreateRequest) error
func (*FlagService) Delete ¶
func (f *FlagService) Delete(req request.FlagDeleteRequest) error
func (*FlagService) Update ¶
func (f *FlagService) Update(req request.FlagUpdateRequest) error
type GameChallengeService ¶
type GameChallengeService struct {
// contains filtered or unexported fields
}
func (*GameChallengeService) Create ¶
func (g *GameChallengeService) Create(req request.GameChallengeCreateRequest) error
func (*GameChallengeService) Delete ¶
func (g *GameChallengeService) Delete(req request.GameChallengeDeleteRequest) error
func (*GameChallengeService) Find ¶
func (g *GameChallengeService) Find(req request.GameChallengeFindRequest) ([]model.GameChallenge, error)
func (*GameChallengeService) Update ¶
func (g *GameChallengeService) Update(req request.GameChallengeUpdateRequest) error
type GameService ¶
type GameService struct {
// contains filtered or unexported fields
}
func (*GameService) Create ¶
func (g *GameService) Create(req request.GameCreateRequest) error
func (*GameService) Delete ¶
func (g *GameService) Delete(req request.GameDeleteRequest) error
func (*GameService) Find ¶
func (g *GameService) Find(req request.GameFindRequest) ([]model.Game, int64, error)
func (*GameService) Update ¶
func (g *GameService) Update(req request.GameUpdateRequest) error
type GameTeamService ¶
type GameTeamService struct {
// contains filtered or unexported fields
}
func (*GameTeamService) Create ¶
func (g *GameTeamService) Create(req request.GameTeamCreateRequest) error
func (*GameTeamService) Delete ¶
func (g *GameTeamService) Delete(req request.GameTeamDeleteRequest) error
func (*GameTeamService) Find ¶
func (g *GameTeamService) Find(req request.GameTeamFindRequest) ([]model.GameTeam, int64, error)
func (*GameTeamService) Update ¶
func (g *GameTeamService) Update(req request.GameTeamUpdateRequest) error
type IAuthService ¶
type IAuthService interface { // CanModifyUser will check if the user can modify the target user. CanModifyUser(user *model.User, targetUserID uint) bool // CanModifyTeam will check if the user can modify the target team. CanModifyTeam(user *model.User, targetTeamID uint) bool }
func NewAuthService ¶
func NewAuthService(r *repository.Repository) IAuthService
type ICategoryService ¶
type ICategoryService interface { // Create will create a new category with the given request. Create(req model.Category) error // Update will update the category with the given request. Update(req model.Category) error // Find will find the category with the given request, and return the categories. Find(req request.CategoryFindRequest) ([]model.Category, error) // Delete will delete the category with the given request. Delete(req request.CategoryDeleteRequest) error }
func NewCategoryService ¶
func NewCategoryService(r *repository.Repository) ICategoryService
type IChallengeService ¶
type IChallengeService interface { // Find will find the challenge with the given request, and return the challenges and the total number of challenges. Find(req request.ChallengeFindRequest) ([]model.Challenge, int64, error) // Create will create a new challenge with the given request. Create(req request.ChallengeCreateRequest) error // Update will update the challenge with the given request. Update(req request.ChallengeUpdateRequest) error // Delete will delete the challenge with the given request. Delete(id uint) error }
func NewChallengeService ¶
func NewChallengeService(r *repository.Repository) IChallengeService
type IConfigService ¶
type IConfigService interface { // Update will update the config with the given request. Update(req request.ConfigUpdateRequest) error }
func NewConfigService ¶
func NewConfigService() IConfigService
type IFlagService ¶
type IFlagService interface { // Create will create a new flag with the given request. Create(req request.FlagCreateRequest) error // Update will update the flag with the given request. Update(req request.FlagUpdateRequest) error // Delete will delete the flag with the given request. Delete(req request.FlagDeleteRequest) error }
func NewFlagService ¶
func NewFlagService(r *repository.Repository) IFlagService
type IGameChallengeService ¶
type IGameChallengeService interface { // Find will find the challenges in game with the given request. Find(req request.GameChallengeFindRequest) ([]model.GameChallenge, error) // Create will create a new game challenge with the given request. Create(req request.GameChallengeCreateRequest) error // Update will update the game challenge with the given request. Update(req request.GameChallengeUpdateRequest) error // Delete will delete the game challenge with the given request. Delete(req request.GameChallengeDeleteRequest) error }
func NewGameChallengeService ¶
func NewGameChallengeService(r *repository.Repository) IGameChallengeService
type IGameService ¶
type IGameService interface { // Find will find games with the given request, and return the games and total count. Find(req request.GameFindRequest) ([]model.Game, int64, error) // Create will create a new game with the given request. Create(req request.GameCreateRequest) error // Update will update the game with the given request. Update(req request.GameUpdateRequest) error // Delete will delete the game with the given request. Delete(req request.GameDeleteRequest) error }
func NewGameService ¶
func NewGameService(r *repository.Repository) IGameService
type IGameTeamService ¶
type IGameTeamService interface { // Find will find the game team with the given request. Find(req request.GameTeamFindRequest) ([]model.GameTeam, int64, error) // Create will create a new game team with the given request. Create(req request.GameTeamCreateRequest) error // Update will update the game team with the given request. Update(req request.GameTeamUpdateRequest) error // Delete will delete the game team with the given request. Delete(req request.GameTeamDeleteRequest) error }
func NewGameTeamService ¶
func NewGameTeamService(r *repository.Repository) IGameTeamService
type IMediaService ¶
type IMediaService interface { // SaveGamePoster will save the game poster to the media folder with the game id as the folder name. SaveGamePoster(id uint, fileHeader *multipart.FileHeader) error // DeleteGamePoster will delete the game poster from the media folder with the game id as the folder name. DeleteGamePoster(id uint) error // SaveUserAvatar will save the user avatar to the media folder with the user id as the folder name. SaveUserAvatar(id uint, fileHeader *multipart.FileHeader) error // DeleteUserAvatar will delete the user avatar from the media folder with the user id as the folder name. DeleteUserAvatar(id uint) error // SaveTeamAvatar will save the team avatar to the media folder with the team id as the folder name. SaveTeamAvatar(id uint, fileHeader *multipart.FileHeader) error // DeleteTeamAvatar will delete the team avatar from the media folder with the team id as the folder name. DeleteTeamAvatar(id uint) error // SaveChallengeAttachment will save the challenge attachment to the media folder with the challenge id as the folder name. SaveChallengeAttachment(id uint, fileHeader *multipart.FileHeader) error // DeleteChallengeAttachment will delete the challenge attachment from the media folder with the challenge id as the folder name. DeleteChallengeAttachment(id uint) error }
func NewMediaService ¶
func NewMediaService() IMediaService
type INoticeService ¶
type INoticeService interface { // Find will find the notice with the given request. Find(req request.NoticeFindRequest) ([]model.Notice, int64, error) // Create will create a new notice with the given request. Create(req request.NoticeCreateRequest) error // Update will update the notice with the given request. Update(req request.NoticeUpdateRequest) error // Delete will delete the notice with the given request. Delete(req request.NoticeDeleteRequest) error }
func NewNoticeService ¶
func NewNoticeService(r *repository.Repository) INoticeService
type IPodService ¶
type IPodService interface { Create(req request.PodCreateRequest) (model.Pod, error) Renew(req request.PodRenewRequest) error Remove(req request.PodRemoveRequest) error Find(req request.PodFindRequest) ([]model.Pod, int64, error) }
func NewPodService ¶
func NewPodService(r *repository.Repository) IPodService
type ISubmissionService ¶
type ISubmissionService interface { // Create will create a new submission with the given request, and return the status and rank. Create(req request.SubmissionCreateRequest) (status int, rank int64, err error) // Delete will delete the submission with the given id. Delete(id uint) error // Find will find the submissions with the given request. Find(req request.SubmissionFindRequest) ([]model.Submission, int64, error) }
func NewSubmissionService ¶
func NewSubmissionService(r *repository.Repository) ISubmissionService
type ITeamService ¶
type ITeamService interface { // Create will create a team with the given request. Create(req request.TeamCreateRequest) error // Update will update a team with the given id. Update(req request.TeamUpdateRequest) error // Delete will delete a team with the given id. Delete(id uint) error // Find will return the teams, total count and error. Find(req request.TeamFindRequest) ([]model.Team, int64, error) // GetInviteToken will return the invite token of the team. GetInviteToken(req request.TeamGetInviteTokenRequest) (string, error) // UpdateInviteToken will update the invite token of the team. UpdateInviteToken(req request.TeamUpdateInviteTokenRequest) (string, error) }
func NewTeamService ¶
func NewTeamService(r *repository.Repository) ITeamService
type IUserService ¶
type IUserService interface { // Create will create a new user with the given request. Create(req request.UserCreateRequest) error // Update will update the user with the given request. Update(req request.UserUpdateRequest) error // Delete will delete the user with the given id. Delete(id uint) error // Find will return the users, total count and error. Find(req request.UserFindRequest) ([]model.User, int64, error) // Register will create a new user with the given request, but the default group is user. Register(req request.UserRegisterRequest) error // Login will verify the user login request and return the user and jwt token. Login(req request.UserLoginRequest) (model.User, string, error) // Logout will log out the user with the given token. Logout(token string) (uint, error) }
func NewUserService ¶
func NewUserService(r *repository.Repository) IUserService
type IUserTeamService ¶
type IUserTeamService interface { Join(req request.TeamUserJoinRequest) error Create(req request.TeamUserCreateRequest) error Delete(req request.TeamUserDeleteRequest) error }
func NewUserTeamService ¶
func NewUserTeamService(r *repository.Repository) IUserTeamService
type IWebhookService ¶
type IWebhookService interface { Create(webhook model.Webhook) (model.Webhook, error) Update(webhook model.Webhook) error Delete(webhook model.Webhook) error }
func NewWebhookService ¶
func NewWebhookService(r *repository.Repository) IWebhookService
type MediaService ¶
type MediaService struct{}
func (*MediaService) DeleteChallengeAttachment ¶
func (m *MediaService) DeleteChallengeAttachment(id uint) error
func (*MediaService) DeleteGamePoster ¶
func (m *MediaService) DeleteGamePoster(id uint) error
func (*MediaService) DeleteTeamAvatar ¶
func (m *MediaService) DeleteTeamAvatar(id uint) error
func (*MediaService) DeleteUserAvatar ¶
func (m *MediaService) DeleteUserAvatar(id uint) error
func (*MediaService) SaveChallengeAttachment ¶
func (m *MediaService) SaveChallengeAttachment(id uint, fileHeader *multipart.FileHeader) error
func (*MediaService) SaveGamePoster ¶
func (m *MediaService) SaveGamePoster(id uint, fileHeader *multipart.FileHeader) error
func (*MediaService) SaveTeamAvatar ¶
func (m *MediaService) SaveTeamAvatar(id uint, fileHeader *multipart.FileHeader) error
func (*MediaService) SaveUserAvatar ¶
func (m *MediaService) SaveUserAvatar(id uint, fileHeader *multipart.FileHeader) error
type NoticeService ¶
type NoticeService struct {
// contains filtered or unexported fields
}
func (*NoticeService) Create ¶
func (n *NoticeService) Create(req request.NoticeCreateRequest) error
func (*NoticeService) Delete ¶
func (n *NoticeService) Delete(req request.NoticeDeleteRequest) error
func (*NoticeService) Find ¶
func (n *NoticeService) Find(req request.NoticeFindRequest) ([]model.Notice, int64, error)
func (*NoticeService) Update ¶
func (n *NoticeService) Update(req request.NoticeUpdateRequest) error
type PodService ¶
type PodService struct {
// contains filtered or unexported fields
}
func (*PodService) Create ¶
func (t *PodService) Create(req request.PodCreateRequest) (model.Pod, error)
func (*PodService) Find ¶
func (t *PodService) Find(req request.PodFindRequest) ([]model.Pod, int64, error)
func (*PodService) IsLimited ¶
func (t *PodService) IsLimited(userID uint, limit int64) (remainder int64)
func (*PodService) ParallelLimit ¶
func (t *PodService) ParallelLimit(req request.PodCreateRequest)
func (*PodService) Remove ¶
func (t *PodService) Remove(req request.PodRemoveRequest) error
func (*PodService) Renew ¶
func (t *PodService) Renew(req request.PodRenewRequest) error
type Service ¶
type Service struct { AuthService IAuthService MediaService IMediaService UserService IUserService ChallengeService IChallengeService PodService IPodService ConfigService IConfigService TeamService ITeamService UserTeamService IUserTeamService SubmissionService ISubmissionService GameService IGameService GameChallengeService IGameChallengeService GameTeamService IGameTeamService CategoryService ICategoryService FlagService IFlagService NoticeService INoticeService }
type SubmissionService ¶
type SubmissionService struct {
// contains filtered or unexported fields
}
func (*SubmissionService) Create ¶
func (t *SubmissionService) Create(req request.SubmissionCreateRequest) (status int, rank int64, err error)
func (*SubmissionService) Delete ¶
func (t *SubmissionService) Delete(id uint) error
func (*SubmissionService) Find ¶
func (t *SubmissionService) Find(req request.SubmissionFindRequest) ([]model.Submission, int64, error)
func (*SubmissionService) JudgeDynamicChallenge ¶
func (t *SubmissionService) JudgeDynamicChallenge(req request.SubmissionCreateRequest) (status int, err error)
type TeamService ¶
type TeamService struct {
// contains filtered or unexported fields
}
func (*TeamService) Create ¶
func (t *TeamService) Create(req request.TeamCreateRequest) error
func (*TeamService) Delete ¶
func (t *TeamService) Delete(id uint) error
func (*TeamService) Find ¶
func (t *TeamService) Find(req request.TeamFindRequest) ([]model.Team, int64, error)
func (*TeamService) GetInviteToken ¶
func (t *TeamService) GetInviteToken(req request.TeamGetInviteTokenRequest) (token string, err error)
func (*TeamService) Update ¶
func (t *TeamService) Update(req request.TeamUpdateRequest) error
func (*TeamService) UpdateInviteToken ¶
func (t *TeamService) UpdateInviteToken(req request.TeamUpdateInviteTokenRequest) (token string, err error)
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
func (*UserService) Create ¶
func (t *UserService) Create(req request.UserCreateRequest) error
func (*UserService) Delete ¶
func (t *UserService) Delete(id uint) error
func (*UserService) Find ¶
func (t *UserService) Find(req request.UserFindRequest) ([]model.User, int64, error)
func (*UserService) GetJwtTokenByID ¶
func (t *UserService) GetJwtTokenByID(user model.User) (tokenString string, err error)
func (*UserService) Login ¶
func (t *UserService) Login(req request.UserLoginRequest) (model.User, string, error)
func (*UserService) Register ¶
func (t *UserService) Register(req request.UserRegisterRequest) error
func (*UserService) Update ¶
func (t *UserService) Update(req request.UserUpdateRequest) error
type UserTeamService ¶
type UserTeamService struct {
// contains filtered or unexported fields
}
func (*UserTeamService) Create ¶
func (t *UserTeamService) Create(req request.TeamUserCreateRequest) error
func (*UserTeamService) Delete ¶
func (t *UserTeamService) Delete(req request.TeamUserDeleteRequest) error
func (*UserTeamService) Join ¶
func (t *UserTeamService) Join(req request.TeamUserJoinRequest) error
type WebhookService ¶
type WebhookService struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.