Documentation
¶
Index ¶
- type AttachmentDAO
- type AttachmentInfo
- type AttachmentService
- type BasicService
- type CaptchaService
- type DepartmentCache
- type DepartmentDAO
- type DepartmentService
- func (p *DepartmentService) Clean(ctx context.Context) error
- func (p *DepartmentService) CreateDepartment(ctx context.Context, operator uint, params *request.CreateDepartmentRequest) error
- func (p *DepartmentService) GetDepartmentTree(ctx context.Context, withCrew bool) ([]*response.DepartmentTreeResponse, error)
- func (p *DepartmentService) Key() string
- func (p *DepartmentService) Refresh(ctx context.Context) error
- type PermissionDAO
- type PermissionService
- func (p *PermissionService) Clean(context.Context) error
- func (p *PermissionService) CreatePermission(ctx context.Context, operator uint, params *request.CreatePermissionRequest) error
- func (p *PermissionService) DeletePermission(ctx context.Context, id, operator uint) error
- func (p *PermissionService) GetPermissionDetail(ctx context.Context, id uint) (*response.PermissionDetailResponse, error)
- func (p *PermissionService) GetPermissionList(ctx context.Context, keyword string, limit, offset int) ([]*response.PermissionListRowResponse, int64, error)
- func (p *PermissionService) Key() string
- func (p *PermissionService) Refresh(context.Context) error
- func (p *PermissionService) UpdatePermission(ctx context.Context, operator uint, params *request.UpdatePermissionRequest) error
- type PingService
- type RoleDAO
- type RoleService
- func (r *RoleService) CreateRole(ctx context.Context, operator uint, params *request.CreateRoleRequest) error
- func (r *RoleService) DeleteRole(ctx context.Context, id, operator uint) error
- func (r *RoleService) GetRoleDetail(ctx context.Context, id uint) (*response.RoleDetailResponse, error)
- func (r *RoleService) GetRoleList(ctx context.Context, keyword string, limit, offset int) ([]*response.RoleListRowResponse, int64, error)
- func (r *RoleService) UpdateRole(ctx context.Context, operator uint, params *request.UpdateRoleRequest) error
- type UserCache
- type UserDAO
- type UserEmailClient
- type UserService
- func (u *UserService) ActiveAccount(ctx context.Context, uid uint, activeCode string) error
- func (u *UserService) GetUserList(ctx context.Context, keyword string, limit, offset int) ([]*response.UserListRowResponse, int64, error)
- func (u *UserService) Login(ctx context.Context, email string, password string) (*response.LoginResponse, error)
- func (u *UserService) Profile(ctx context.Context, uid uint) (*response.ProfileResponse, error)
- func (u *UserService) SignUp(ctx context.Context, id string, code string, user *models.User) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttachmentDAO ¶
type AttachmentDAO interface {
Create(ctx context.Context, records []*models.Attachment) error
}
type AttachmentInfo ¶
type AttachmentInfo struct {
// contains filtered or unexported fields
}
type AttachmentService ¶
type AttachmentService struct { *BasicService // contains filtered or unexported fields }
func NewAttachmentService ¶
func NewAttachmentService(basic *BasicService, dao AttachmentDAO) *AttachmentService
func (*AttachmentService) SaveFile ¶
func (a *AttachmentService) SaveFile(ctx context.Context, file *multipart.FileHeader, uid uint) (*response.UploadAttachmentResponse, error)
func (*AttachmentService) SaveFiles ¶
func (a *AttachmentService) SaveFiles(ctx context.Context, files []*multipart.FileHeader, uid uint) ([]*response.UploadAttachmentResponse, error)
type BasicService ¶
type BasicService struct {
// contains filtered or unexported fields
}
func NewBasicService ¶
func NewBasicService( logger *logger.Logger, db *gorm.DB, locksmith *utils.RedisLocksmith, conf *conf.Config, emailClient *initialize.EmailClient, ) *BasicService
type CaptchaService ¶
type CaptchaService struct {
// contains filtered or unexported fields
}
func NewCaptchaService ¶
func NewCaptchaService(store base64Captcha.Store) *CaptchaService
func (*CaptchaService) Generate ¶
func (c *CaptchaService) Generate(t constant.CaptchaType) (*response.GetCaptchaResponse, error)
func (*CaptchaService) Verify ¶
func (c *CaptchaService) Verify(t constant.CaptchaType, id, answer string) bool
type DepartmentCache ¶
type DepartmentDAO ¶
type DepartmentDAO interface { Create(ctx context.Context, dept *models.Department) error GetByName(ctx context.Context, name string) (*models.Department, error) GetById(ctx context.Context, id uint) (*models.Department, error) GetAll(ctx context.Context) ([]*models.Department, error) GetAllUserDepartment(ctx context.Context) ([]*models.UserDepartment, error) GetAllDepartmentLeader(ctx context.Context) ([]*models.DepartmentLeader, error) }
type DepartmentService ¶
type DepartmentService struct { *BasicService // contains filtered or unexported fields }
func NewDepartmentService ¶
func NewDepartmentService( basic *BasicService, deptDAO DepartmentDAO, deptCache DepartmentCache, userDAO UserDAO, ) *DepartmentService
func (*DepartmentService) CreateDepartment ¶
func (p *DepartmentService) CreateDepartment(ctx context.Context, operator uint, params *request.CreateDepartmentRequest) error
func (*DepartmentService) GetDepartmentTree ¶
func (p *DepartmentService) GetDepartmentTree(ctx context.Context, withCrew bool) ([]*response.DepartmentTreeResponse, error)
func (*DepartmentService) Key ¶
func (p *DepartmentService) Key() string
type PermissionDAO ¶
type PermissionDAO interface { Create(ctx context.Context, permission *models.Permission) error GetByIds(ctx context.Context, ids []uint, preload ...string) ([]*models.Permission, error) GetById(ctx context.Context, id uint, preload ...string) (*models.Permission, error) GetList(ctx context.Context, keyword string, limit, offset int) ([]*models.Permission, int64, error) DeleteById(ctx context.Context, id, updater uint) error GetRolesCount(ctx context.Context, id uint) int64 Update(ctx context.Context, permission *models.Permission) error AssociateRoles(ctx context.Context, id uint, roles []*models.Role) error GetByNameOrResource(ctx context.Context, name, resource string) ([]*models.Permission, error) }
type PermissionService ¶
type PermissionService struct { *BasicService // contains filtered or unexported fields }
func NewPermissionService ¶
func NewPermissionService(basic *BasicService, permissionDAO PermissionDAO, roleDAO RoleDAO) *PermissionService
func (*PermissionService) CreatePermission ¶
func (p *PermissionService) CreatePermission(ctx context.Context, operator uint, params *request.CreatePermissionRequest) error
func (*PermissionService) DeletePermission ¶
func (p *PermissionService) DeletePermission(ctx context.Context, id, operator uint) error
func (*PermissionService) GetPermissionDetail ¶
func (p *PermissionService) GetPermissionDetail(ctx context.Context, id uint) (*response.PermissionDetailResponse, error)
func (*PermissionService) GetPermissionList ¶
func (p *PermissionService) GetPermissionList(ctx context.Context, keyword string, limit, offset int) ([]*response.PermissionListRowResponse, int64, error)
func (*PermissionService) Key ¶
func (p *PermissionService) Key() string
func (*PermissionService) UpdatePermission ¶
func (p *PermissionService) UpdatePermission(ctx context.Context, operator uint, params *request.UpdatePermissionRequest) error
type PingService ¶
type PingService struct {
*BasicService
}
func NewPingService ¶
func NewPingService(basic *BasicService) *PingService
func (*PingService) LockPermissionField ¶
func (p *PingService) LockPermissionField(ctx context.Context) error
type RoleDAO ¶
type RoleDAO interface { Create(ctx context.Context, role *models.Role) error GetByIds(ctx context.Context, ids []uint, preload ...string) ([]*models.Role, error) GetList(ctx context.Context, keyword string, limit, offset int) ([]*models.Role, int64, error) GetByName(ctx context.Context, name string) (*models.Role, error) GetById(ctx context.Context, id uint, preload ...string) (*models.Role, error) Update(ctx context.Context, role *models.Role) error AssociateUsers(ctx context.Context, id uint, users []*models.User) error AssociatePermissions(ctx context.Context, id uint, permissions []*models.Permission) error DeleteById(ctx context.Context, id, updater uint) error GetUsersCount(ctx context.Context, id uint) int64 GetPermissionsCount(ctx context.Context, id uint) int64 }
type RoleService ¶
type RoleService struct { *BasicService // contains filtered or unexported fields }
func NewRoleService ¶
func NewRoleService(basic *BasicService, roleDAO RoleDAO, userDAO UserDAO, permissionDAO PermissionDAO) *RoleService
func (*RoleService) CreateRole ¶
func (r *RoleService) CreateRole(ctx context.Context, operator uint, params *request.CreateRoleRequest) error
func (*RoleService) DeleteRole ¶
func (r *RoleService) DeleteRole(ctx context.Context, id, operator uint) error
func (*RoleService) GetRoleDetail ¶
func (r *RoleService) GetRoleDetail(ctx context.Context, id uint) (*response.RoleDetailResponse, error)
func (*RoleService) GetRoleList ¶
func (r *RoleService) GetRoleList(ctx context.Context, keyword string, limit, offset int) ([]*response.RoleListRowResponse, int64, error)
func (*RoleService) UpdateRole ¶
func (r *RoleService) UpdateRole(ctx context.Context, operator uint, params *request.UpdateRoleRequest) error
type UserCache ¶
type UserCache interface { CacheTokenPair(ctx context.Context, email string, pair *models.TokenPair) error GetTokenPairIsExist(ctx context.Context, email string) (bool, error) GetTokenPair(ctx context.Context, email string) (*models.TokenPair, error) CacheActiveAccountCode(ctx context.Context, id uint, code string, duration time.Duration) error GetActiveAccountCode(ctx context.Context, id uint) (string, error) RemoveActiveAccountCode(ctx context.Context, id uint) error }
type UserDAO ¶
type UserDAO interface { Create(ctx context.Context, user *models.User) error GetByEmail(ctx context.Context, email string, preload ...string) (*models.User, error) GetById(ctx context.Context, uid uint, preload ...string) (*models.User, error) GetByIds(ctx context.Context, ids []uint, preload ...string) ([]*models.User, error) GetList(ctx context.Context, keyword string, limit, offset int) ([]*models.User, int64, error) GetAll(ctx context.Context) ([]*models.User, error) UpdateAccountStatus(ctx context.Context, id uint, status constant.UserStatus) error }
type UserEmailClient ¶
type UserService ¶
type UserService struct { *BasicService *CaptchaService // contains filtered or unexported fields }
func NewUserService ¶
func NewUserService( basic *BasicService, captchaService *CaptchaService, userDAO UserDAO, userCache UserCache, ec *initialize.EmailClient, tb *jwt.TokenBuilder, ) *UserService
func (*UserService) ActiveAccount ¶
func (*UserService) GetUserList ¶
func (u *UserService) GetUserList( ctx context.Context, keyword string, limit, offset int, ) ([]*response.UserListRowResponse, int64, error)
func (*UserService) Login ¶
func (u *UserService) Login(ctx context.Context, email string, password string) (*response.LoginResponse, error)
func (*UserService) Profile ¶
func (u *UserService) Profile(ctx context.Context, uid uint) (*response.ProfileResponse, error)
Click to show internal directories.
Click to hide internal directories.