domain

package
v0.0.0-...-fd201ba Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusActiveStr      = "ACTIVE"
	StatusDisabledStr    = "DISABLED"
	StatusUnpublishedStr = "UNPUBLISHED"
	StatusDraftStr       = "DRAFT"
)
View Source
const (
	ChallengeTOTPStr          = "TOTP"
	ChallengeRecoveryCodesStr = "RECOVERY_CODES"
)
View Source
const (
	ChallengeEnableStr   = "ENABLE"
	ChallengeDisabledStr = "DISABLED"
)
View Source
const (
	UserStatusUnknownStr    = "unknown"
	UserStatusActiveStr     = "ACTIVE"
	UserStatusInactiveStr   = "INACTIVE"
	UserStatusUnverifiedStr = "UNVERIFIED"
	UserStatusBannedStr     = "BANNED"
)
View Source
const (
	UserGenderMaleStr           = "MALE"
	UserGenderFemaleStr         = "FEMALE"
	UserGenderOtherStr          = "OTHER"
	UserGenderPreferNotToSayStr = "PREFER_NOT_TO_SAY"
)
View Source
const UnknownStr = "UNKNOWN"

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessControl

type AccessControl struct {
	Base
	Modifier

	UserID       uint
	RoleID       *uint
	PermissionID *uint
}

type AuthChallenge

type AuthChallenge struct {
	Type   ChallengeType
	Status ChallengeStatusType
}

type Base

type Base struct {
	ID   uint64
	UUID uuid.UUID

	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt time.Time
}

type ChallengeStatusType

type ChallengeStatusType string
const (
	ChallengeEnable   ChallengeStatusType = "ENABLE"
	ChallengeDisabled ChallengeStatusType = "DISABLED"
)

func (ChallengeStatusType) String

func (r ChallengeStatusType) String() string

type ChallengeType

type ChallengeType string
const (
	ChallengeTOTP          ChallengeType = ChallengeTOTPStr
	ChallengeRecoveryCodes ChallengeType = ChallengeRecoveryCodesStr
)

func (ChallengeType) String

func (r ChallengeType) String() string

type Grammar

type Grammar struct {
	Base
	Modifier

	Title  string
	Status StatusType
}

type Language

type Language struct {
	Base

	Name   string
	Code   string
	Status StatusType
}

type Modifier

type Modifier struct {
	CreatedBy *uint64
	UpdatedBy uint64
	DeleteBy  uint64
}

type OTP

type OTP struct {
	Value        string
	Used         bool
	RequestCount int8
	CreatedAt    int64
	LastRequest  int64
}

type Permission

type Permission struct {
	Base
	Modifier

	Title       *string
	Key         *PermissionKeyType
	Group       *string
	Description *string
}

type PermissionKeyType

type PermissionKeyType string
const (
	PermissionKeyNone                    PermissionKeyType = "NONE"
	PermissionKeyCreateUser              PermissionKeyType = "CREATE_USER"
	PermissionKeyReadUser                PermissionKeyType = "READ_USER"
	PermissionKeyUpdateUser              PermissionKeyType = "UPDATE_USER"
	PermissionKeyDeleteUser              PermissionKeyType = "DELETE_USER"
	PermissionKeyCreateRole              PermissionKeyType = "CREATE_ROLE"
	PermissionKeyReadRole                PermissionKeyType = "READ_ROLE"
	PermissionKeyUpdateRole              PermissionKeyType = "UPDATE_ROLE"
	PermissionKeyDeleteRole              PermissionKeyType = "DELETE_ROLE"
	PermissionKeyReadPermission          PermissionKeyType = "READ_PERMISSION"
	PermissionKeySyncRolesWithUser       PermissionKeyType = "SYNC_ROLES_WITH_USER"
	PermissionKeyReadUserRoles           PermissionKeyType = "READ_USER_ROLES"
	PermissionKeySyncPermissionsWithRole PermissionKeyType = "SYNC_PERMISSIONS_WITH_ROLE"
	PermissionKeyReadRolePermissions     PermissionKeyType = "READ_ROLE_PERMISSIONS"
)

type Role

type Role struct {
	Base
	Modifier

	Title       string
	Key         RoleKeyType
	Description string

	IsDefault bool

	Permissions []*Permission
}

func (*Role) SetKey

func (r *Role) SetKey(key string)

type RoleKeyType

type RoleKeyType string
const (
	RoleKeySuperAdmin RoleKeyType = "SUPER_ADMIN"
	RoleKeyAdmin      RoleKeyType = "ADMIN"
	RoleKeyManager    RoleKeyType = "MANAGER"
	RoleKeyAccountant RoleKeyType = "ACCOUNTANT"
	RoleKeySupplier   RoleKeyType = "SUPPLIER"
	RoleKeySales      RoleKeyType = "SALES"
	RoleKeyStaff      RoleKeyType = "STAFF"
	RoleKeyUser       RoleKeyType = "USER"
)

type Sentence

type Sentence struct {
	Base
	Modifier

	Text    string
	Grammar Grammar
	Level   SentenceLevelType
	Status  StatusType
}

type SentenceLevelType

type SentenceLevelType string
const (
	SentenceLevelEasy   SentenceLevelType = "EASY"
	SentenceLevelNormal SentenceLevelType = "NORMAL"
	SentenceLevelHard   SentenceLevelType = "HARD"
)

type StatusType

type StatusType string
const (
	StatusActive      StatusType = StatusActiveStr
	StatusDisabled    StatusType = StatusDisabledStr
	StatusUnpublished StatusType = StatusUnpublishedStr
	StatusDraft       StatusType = StatusDraftStr
)

type TOTPKey

type TOTPKey struct {
	Secret string
	URL    string
}

type User

type User struct {
	Base
	Modifier

	FirstName *string
	LastName  *string
	Email     string
	Password  *string
	Avatar    *string
	Status    UserStatusType

	WelcomeMessageSent bool

	GoogleID       *string
	TOTPSecret     *string
	Gender         UserGenderType
	AuthChallenges []AuthChallenge
}

func (*User) AuthChallengeTOTP

func (r *User) AuthChallengeTOTP()

func (*User) GetFullName

func (r *User) GetFullName() string

func (*User) IsActive

func (r *User) IsActive() bool

func (*User) SetFirstName

func (r *User) SetFirstName(firstName sql.NullString) *User

func (*User) SetGoogleID

func (r *User) SetGoogleID(googleID sql.NullString) *User

func (*User) SetLastName

func (r *User) SetLastName(lastName sql.NullString) *User

type UserGenderType

type UserGenderType string
const (
	UserGenderMale           UserGenderType = UserGenderMaleStr
	UserGenderFemale         UserGenderType = UserGenderFemaleStr
	UserGenderOther          UserGenderType = UserGenderOtherStr
	UserGenderPreferNotToSay UserGenderType = UserGenderPreferNotToSayStr
)

func ToUserGenderType

func ToUserGenderType(gender string) UserGenderType

func (*UserGenderType) String

func (r *UserGenderType) String() string

type UserStatusType

type UserStatusType string
const (
	UserStatusUnknown    UserStatusType = UserStatusUnknownStr
	UserStatusActive     UserStatusType = UserStatusActiveStr
	UserStatusInactive   UserStatusType = UserStatusInactiveStr
	UserStatusUnverified UserStatusType = UserStatusUnverifiedStr
	UserStatusBanned     UserStatusType = UserStatusBannedStr
)

func ToUserStatus

func ToUserStatus(status string) UserStatusType

func (UserStatusType) String

func (r UserStatusType) String() string

Jump to

Keyboard shortcuts

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