service

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFilterNotFound = apperr.New("filter_not_found", apperr.WithTextTranslate(i18n.ErrFilterNotFound), apperr.WithCode(code.NotFound))
	ErrFilterExists   = apperr.New("filter_exists_error", apperr.WithTextTranslate(i18n.ErrFilterExists), apperr.WithCode(code.AlreadyExists))
)
View Source
var (
	ErrRoleNotFound        = apperr.New("role_not_found", apperr.WithTextTranslate(i18n.ErrRoleNotFound), apperr.WithCode(code.NotFound))
	ErrRoleExists          = apperr.New("role_exists_error", apperr.WithTextTranslate(i18n.ErrRoleExists), apperr.WithCode(code.AlreadyExists))
	ErrRoleCannotBeChanged = apperr.New("role_cannot_be_changed", apperr.WithTextTranslate(i18n.ErrRoleCannotBeChanged), apperr.WithCode(code.PermissionDenied))
	ErrRoleCannotBeDeleted = apperr.New("role_cannot_be_deleted", apperr.WithTextTranslate(i18n.ErrRoleCannotBeDeleted), apperr.WithCode(code.PermissionDenied))
)
View Source
var (
	ErrUserNotFound             = apperr.New("user_not_found", apperr.WithTextTranslate(i18n.ErrUserNotFound), apperr.WithCode(code.NotFound))
	ErrUserExists               = apperr.New("user_exists_error", apperr.WithTextTranslate(i18n.ErrUserExists), apperr.WithCode(code.AlreadyExists))
	ErrUserRolesCannotBeChanged = apperr.New("user_roles_cannot_be_changed", apperr.WithTextTranslate(i18n.ErrUserRolesCannotBeChanged), apperr.WithCode(code.PermissionDenied))
	ErrUserCannotBeBlocked      = apperr.New("user_cannot_be_blocked", apperr.WithTextTranslate(i18n.ErrUserCannotBeBlocked), apperr.WithCode(code.PermissionDenied))
	ErrUserCannotBeDeleted      = apperr.New("user_cannot_be_deleted", apperr.WithTextTranslate(i18n.ErrUserCannotBeDeleted), apperr.WithCode(code.PermissionDenied))
	ErrSelfCannotBeDeleted      = apperr.New("self_cannot_be_deleted", apperr.WithTextTranslate(i18n.ErrSelfCannotBeDeleted), apperr.WithCode(code.PermissionDenied))
)
View Source
var (
	ErrSessionNotFound = apperr.New("session_not_found", apperr.WithTextTranslate(i18n.ErrSessionNotFound), apperr.WithCode(code.NotFound))
)

Functions

This section is empty.

Types

type AuthLogin

type AuthLogin struct {
	Login    string
	Password string
	Secret   string
	DeviceID int
}

type AuthLogout

type AuthLogout struct {
	Token string
}

type AuthRefresh

type AuthRefresh struct {
	Token    string
	DeviceID int
}

type AuthService

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

func NewAuthService

func NewAuthService(
	profileService profile.IProfileService,
	repositories repository2.Repositories,
	cache *fx.CacheHolder,
	cfg *fx.AuthHolder,
	ldapAuth *fx.LDAPHolder,
	oidcAuth *fx.OIDCHolder,
	samlAuth *fx.SAMLHolder,
) AuthService

func (AuthService) Account

func (s AuthService) Account(ctx context.Context) (*model2.User, error)

func (AuthService) Login

func (s AuthService) Login(ctx context.Context, input AuthLogin) (*model2.AuthToken, int, error)

func (AuthService) Logout

func (s AuthService) Logout(ctx context.Context, input AuthLogout) (int, error)

func (AuthService) Refresh

func (s AuthService) Refresh(ctx context.Context, input AuthRefresh) (*model2.AuthToken, int, error)

func (AuthService) SSO added in v2.3.146

func (s AuthService) SSO(ctx context.Context, input SSO) (*model2.AuthToken, int, error)

func (AuthService) Trx

func (s AuthService) Trx(db *gorm.DB) IAuthService

type FilterCreateInput added in v2.3.99

type FilterCreateInput struct {
	Name     string
	Endpoint string
	Value    string
}

type FilterService added in v2.3.99

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

func NewFilterService added in v2.3.99

func NewFilterService(
	repositories repository2.Repositories,
) FilterService

func (FilterService) Create added in v2.3.99

func (s FilterService) Create(ctx context.Context, input FilterCreateInput) (*model.Filter, error)

func (FilterService) Delete added in v2.3.99

func (s FilterService) Delete(ctx context.Context, id int) error

func (FilterService) GetById added in v2.3.99

func (s FilterService) GetById(ctx context.Context, id int) (*model.Filter, error)

func (FilterService) List added in v2.3.99

func (FilterService) Trx added in v2.3.99

func (s FilterService) Trx(db *gorm.DB) IFilterService

func (FilterService) Update added in v2.3.99

func (s FilterService) Update(ctx context.Context, id int, input FilterUpdateInput) error

type FilterUpdateInput added in v2.3.99

type FilterUpdateInput struct {
	Name  *string
	Value *string
}

type IAuthService

type IAuthService interface {
	Trx(db *gorm.DB) IAuthService
	Login(ctx context.Context, input AuthLogin) (*model2.AuthToken, int, error)
	Refresh(ctx context.Context, input AuthRefresh) (*model2.AuthToken, int, error)
	Logout(ctx context.Context, input AuthLogout) (int, error)
	Account(ctx context.Context) (*model2.User, error)
	SSO(ctx context.Context, input SSO) (*model2.AuthToken, int, error)
}

type IFilterService added in v2.3.99

type IFilterService interface {
	Trx(db *gorm.DB) IFilterService
	List(ctx context.Context, m *model2.Meta[model.Filter]) error
	GetById(ctx context.Context, id int) (*model.Filter, error)
	Create(ctx context.Context, input FilterCreateInput) (*model.Filter, error)
	Update(ctx context.Context, id int, input FilterUpdateInput) error
	Delete(ctx context.Context, id int) error
}

type IPermissionService

type IPermissionService interface {
	Trx(db *gorm.DB) IPermissionService
	List(ctx context.Context) ([]model.Permission, error)
}

type IRoleService

type IRoleService interface {
	Trx(db *gorm.DB) IRoleService
	List(ctx context.Context, m *model2.Meta[model.Role]) error
	UserList(ctx context.Context, id int, m *model2.Meta[model.UserRole]) error
	GetById(ctx context.Context, id int) (*model.Role, error)
	Create(ctx context.Context, input RoleCreateInput) (*model.Role, error)
	Update(ctx context.Context, id int, input RoleUpdateInput) (string, error)
	Delete(ctx context.Context, id int) (string, error)
}

type ISessionService added in v2.3.7

type ISessionService interface {
	Trx(db *gorm.DB) ISessionService
	List(ctx context.Context, m *model3.Meta[model2.RefreshToken]) error
	End(ctx context.Context, id int) (string, error)
}

type ISettingService

type ISettingService interface {
	Trx(db *gorm.DB) ISettingService
	Get(ctx context.Context) (*model.Setting, error)
	Update(ctx context.Context, input SettingUpdateInput) error
}

type IUserService

type IUserService interface {
	Trx(db *gorm.DB) IUserService
	List(ctx context.Context, m *model2.Meta[model.User]) error
	GetById(ctx context.Context, id int) (*model.User, error)
	Create(ctx context.Context, input UserCreateInput, profileInput any) (*model.User, error)
	Update(ctx context.Context, id int, input UserUpdateInput, profileInput any) (string, error)
	Delete(ctx context.Context, id int) (string, error)
}

type IVersionService added in v2.3.155

type IVersionService interface {
	Get(ctx context.Context) *model.Version
}

type PermissionService

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

func NewPermissionService

func NewPermissionService(
	repositories repository.Repositories,
	cache *fx.CacheHolder,
) PermissionService

func (PermissionService) List

func (PermissionService) Trx

type RoleCreateInput

type RoleCreateInput struct {
	Name  string
	Write []int
	Read  []int
	Exec  []int
}

type RoleService

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

func NewRoleService

func NewRoleService(
	repositories repository.Repositories,
	cache *fx.CacheHolder,
) RoleService

func (RoleService) Create

func (s RoleService) Create(ctx context.Context, input RoleCreateInput) (*model.Role, error)

func (RoleService) Delete

func (s RoleService) Delete(ctx context.Context, id int) (string, error)

func (RoleService) GetById

func (s RoleService) GetById(ctx context.Context, id int) (*model.Role, error)

func (RoleService) List

func (s RoleService) List(ctx context.Context, m *model2.Meta[model.Role]) error

func (RoleService) Trx

func (s RoleService) Trx(db *gorm.DB) IRoleService

func (RoleService) Update

func (s RoleService) Update(ctx context.Context, id int, input RoleUpdateInput) (string, error)

func (RoleService) UserList added in v2.3.193

func (s RoleService) UserList(ctx context.Context, id int, m *model2.Meta[model.UserRole]) error

type RoleUpdateInput

type RoleUpdateInput struct {
	Name        *string
	Write       []int
	Read        []int
	Exec        []int
	LogDisabled *bool
}

type SSO added in v2.3.146

type SSO struct {
	Provider     string
	RefreshToken string
	Login        string
	DeviceID     int
}

type SessionService added in v2.3.7

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

func NewSessionService added in v2.3.7

func NewSessionService(
	repositories repository.Repositories,
	cache *fx.CacheHolder,
) SessionService

func (SessionService) End added in v2.3.7

func (s SessionService) End(ctx context.Context, id int) (string, error)

func (SessionService) List added in v2.3.7

func (SessionService) Trx added in v2.3.7

type SettingService

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

func NewSettingService

func NewSettingService(
	repositories repository.Repositories,
) SettingService

func (SettingService) Get

func (SettingService) Trx

func (SettingService) Update

func (s SettingService) Update(ctx context.Context, input SettingUpdateInput) error

type SettingUpdateInput

type SettingUpdateInput struct {
	Settings *string
}

type UserCreateInput

type UserCreateInput struct {
	Login      string
	FirstName  string
	SecondName *string
	LastName   *string
	Password   *string
	Email      *string
	Phone      *string
	Roles      []int
	Blocked    bool
	IsDomain   bool
}

type UserService

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

func NewUserService

func NewUserService(
	profileService profile.IProfileService,
	repositories repository.Repositories,
	cache *fx.CacheHolder,
) UserService

func (UserService) Create

func (s UserService) Create(ctx context.Context, input UserCreateInput, profileInput any) (*model.User, error)

func (UserService) Delete

func (s UserService) Delete(ctx context.Context, id int) (string, error)

func (UserService) GetById

func (s UserService) GetById(ctx context.Context, id int) (*model.User, error)

func (UserService) List

func (s UserService) List(ctx context.Context, m *model2.Meta[model.User]) error

func (UserService) Trx

func (s UserService) Trx(db *gorm.DB) IUserService

func (UserService) Update

func (s UserService) Update(ctx context.Context, id int, input UserUpdateInput, profileInput any) (string, error)

type UserUpdateInput

type UserUpdateInput struct {
	FirstName  *string
	SecondName *string
	LastName   *string
	Password   *string
	Email      *string
	Phone      *string
	Roles      []int
	Blocked    *bool
	IsDomain   *bool
}

type VersionService added in v2.3.155

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

func NewVersionService added in v2.3.155

func NewVersionService(version string, repositories repository.Repositories) VersionService

func (VersionService) Get added in v2.3.155

Jump to

Keyboard shortcuts

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