model

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EMAIL_DELIVER_BASEURL                = "https://email.illasoft.com/v1/"
	EMAIL_DELIVER_USAGE_SUBSCRIBE        = "subscribe"
	EMAIL_DELIVER_USAGE_VERIFICATIONCODE = "code"
	EMAIL_DELIVER_INVITE_EMAIL           = "invite"
	EMAIL_DELIVER_SHARE_APP_EMAIL        = "shareApp"
)
View Source
const (
	ILLA_UNIT_APPS                      = 1
	ILLA_UNIT_RESOURCES                 = 2
	ILLA_UNIT_ACTIONS                   = 3
	ILLA_UNIT_TREE_STATES               = 4
	ILLA_UNIT_KV_STATES                 = 5
	ILLA_UNIT_SET_STATES                = 6
	ILLA_UNIT_USERS                     = 7
	ILLA_UNIT_TEAMS                     = 8
	ILLA_UNIT_TEAM_MEMBERS              = 9
	ILLA_UNIT_INVITES                   = 10
	ILLA_UNIT_PROMOTE_CODES             = 11
	ILLA_UNIT_PROMOTE_CODE_USAGES       = 12
	ILLA_UNIT_ROLES                     = 13
	ILLA_UNIT_USER_ROLE_RELATIONS       = 14
	ILLA_UNIT_UNIT_ROLE_RELATIONS       = 15
	ILLA_UNIT_COMPENSATING_TRANSACTIONS = 16
	ILLA_UNIT_TRANSACTION_SERIALS       = 17
	ILLA_UNIT_CAPACITIES                = 18
	ILLA_UNIT_DRIVE                     = 19
	ILLA_UNIT_APP_SNAPSHOT              = 20
)
View Source
const (
	USER_ROLE_ANONYMOUS = -1
	USER_ROLE_OWNER     = 1
	USER_ROLE_ADMIN     = 2
	USER_ROLE_EDITOR    = 3
	USER_ROLE_VIEWER    = 4
)

User Role ID in Team @note: this will extend as role system later.

View Source
const CATEGORY_INVITE_BY_EMAIL = 2
View Source
const CATEGORY_INVITE_BY_LINK = 1

invite record category

View Source
const CUSTOMIZATION_LANGUAGE_CS_CZ = "cs-CZ"
View Source
const CUSTOMIZATION_LANGUAGE_DA_DK = "da-DK"
View Source
const CUSTOMIZATION_LANGUAGE_DE_DE = "de-DE"
View Source
const CUSTOMIZATION_LANGUAGE_EL_GR = "el-GR"
View Source
const CUSTOMIZATION_LANGUAGE_EN_US = "en-US"
View Source
const CUSTOMIZATION_LANGUAGE_ES_ES = "es-ES"
View Source
const CUSTOMIZATION_LANGUAGE_FI_FI = "fi-FI"
View Source
const CUSTOMIZATION_LANGUAGE_FR_FR = "fr-FR"
View Source
const CUSTOMIZATION_LANGUAGE_IT_IT = "it-IT"
View Source
const CUSTOMIZATION_LANGUAGE_JA_JP = "ja-JP"
View Source
const CUSTOMIZATION_LANGUAGE_KO_KR = "ko-KR"
View Source
const CUSTOMIZATION_LANGUAGE_NL_NL = "nl-NL"
View Source
const CUSTOMIZATION_LANGUAGE_NO_NO = "no-NO"
View Source
const CUSTOMIZATION_LANGUAGE_PL_PL = "pl-PL"
View Source
const CUSTOMIZATION_LANGUAGE_PT_PT = "pt-PT"
View Source
const CUSTOMIZATION_LANGUAGE_RO_RO = "ro-RO"
View Source
const CUSTOMIZATION_LANGUAGE_RU_RU = "ru-RU"
View Source
const CUSTOMIZATION_LANGUAGE_SV_SE = "sv-SE"
View Source
const CUSTOMIZATION_LANGUAGE_UK_UA = "uk-UA"
View Source
const CUSTOMIZATION_LANGUAGE_ZH_CN = "zh-CN"
View Source
const INVITE_EMAIL_AND_SHARE_APP_TEMPLATE = "&teamIdentifier=%s&email=%s&appID=%s"
View Source
const INVITE_EMAIL_TEMPLATE = "&teamIdentifier=%s&email=%s"
View Source
const INVITE_RECORD_STATUS_OK = 1

invite record status

View Source
const INVITE_SHARE_APP_TEMPLATE = "&teamIdentifier=%s&appID=%s"
View Source
const INVITE_URI_TEMPLATE = "?inviteToken=%s"
View Source
const PENDING_USER_AVATAR = ""
View Source
const PENDING_USER_ID = 0
View Source
const PENDING_USER_NICKNAME = "pending"
View Source
const PENDING_USER_PASSWORDDIGEST = "pending"
View Source
const SHARE_LINK_RECIRECT_PAGE_URI_PARAM = "&redirectPage="
View Source
const SHARE_LINK_REDIRECT_PAGE_EDIT = "edit"
View Source
const SHARE_LINK_REDIRECT_PAGE_RELEASE = "release"
View Source
const TEAM_DEFAULT_ID = 0
View Source
const TEAM_FIELD_ICON = "icon"
View Source
const TEAM_FIELD_IDENTIFIER = "identifier"
View Source
const TEAM_FIELD_NAME = "name"
View Source
const TEAM_FOLDER_PREFIX = "team-"
View Source
const TEAM_ICON_FOLDER = "/icon"
View Source
const TEAM_MEMBER_STATUS_OK = 1
View Source
const TEAM_MEMBER_STATUS_PENDING = 2
View Source
const TEAM_P_FIELD_ALLOW_EDITOR_INVITE = "allowEditorInvite"
View Source
const TEAM_P_FIELD_ALLOW_EDITOR_MANAGE_TEAM_MEMBER = "allowEditorManageTeamMember"
View Source
const TEAM_P_FIELD_ALLOW_VIEWER_INVITE = "allowViewerInvite"
View Source
const TEAM_P_FIELD_ALLOW_VIEWER_MANAGE_TEAM_MEMBER = "allowViewerManageTeamMember"
View Source
const TEAM_P_FIELD_BLOCK_REGISTER = "blockRegister"
View Source
const TEAM_P_FIELD_INVITE_LINK_ENABLED = "inviteLinkEnabled"
View Source
const TEAM_SPACE_FOLDER = "/team"
View Source
const TEAM_SYSTEM_FOLDER = "/system"
View Source
const USER_AVATAR_FOLVER = "/avatar"
View Source
const USER_FOLDER_PREFIX = "user-"
View Source
const (
	USER_JWT_TOKEN_KEY_TEMPLATE = "%d_jwt_expired_at"
)

Variables

View Source
var Config *config.Config

Functions

func BuildLookUpTableForInvitesExport

func BuildLookUpTableForInvitesExport(invites []*Invite) map[int]*InviteForExport

func BuildLookUpTableForUserExport

func BuildLookUpTableForUserExport(users []*User) map[int]*UserForExport

func BuildTeamIDLookUpTableForTeamMemberExport

func BuildTeamIDLookUpTableForTeamMemberExport(teamMembers []*TeamMember) map[int]*TeamMemberForExport

func CreateAccessToken

func CreateAccessToken(id int, uid uuid.UUID) (string, error)

func ExtractUserIDFromToken

func ExtractUserIDFromToken(accessToken string) (int, uuid.UUID, error)

func GenerateAndSendVerificationCode

func GenerateAndSendVerificationCode(email, usage string) (string, error)

func GenerateRedirectPageParam added in v0.0.12

func GenerateRedirectPageParam(redirectPage string) string

func PickUpTeamIDsInTeamMembers

func PickUpTeamIDsInTeamMembers(teamMembers []*TeamMember) []int

func PickUpTeamMemberIDsInTeamMembers

func PickUpTeamMemberIDsInTeamMembers(teamMembers []*TeamMember) []int

func PickUpUserIDsInUserMembers

func PickUpUserIDsInUserMembers(teamMembers []*TeamMember) []int

func SendInviteEmail

func SendInviteEmail(m *EmailInviteMessage) error

func SendShareAppEmail

func SendShareAppEmail(m *EmailShareAppMessage) error

func SendSubscriptionEmail

func SendSubscriptionEmail(email string) error

func SendVerificationEmail

func SendVerificationEmail(email, code, usage string) error

func ValidateAccessToken

func ValidateAccessToken(accessToken string) (bool, error)

func ValidateVerificationCode

func ValidateVerificationCode(vCode, codeToken, email, usage string) (bool, error)

Types

type AuthClaims

type AuthClaims struct {
	User   int       `json:"user"`
	UID    uuid.UUID `json:"uuid"`
	Random string    `json:"rnd"`
	jwt.RegisteredClaims
}

type Cache added in v0.0.8

type Cache struct {
	JWTCache *JWTCache
}

func NewCache added in v0.0.8

func NewCache(redisDriver *redis.Client, logger *zap.SugaredLogger) *Cache

type ChangePasswordRequest

type ChangePasswordRequest struct {
	CurrentPassword string `json:"currentPassword" validate:"required"`
	NewPassword     string `json:"newPassword" validate:"required"`
}

func NewChangePasswordRequest

func NewChangePasswordRequest() *ChangePasswordRequest

type ConfigInviteLinkRequest

type ConfigInviteLinkRequest struct {
	InviteLinkEnabled bool `json:"inviteLinkEnabled"`
}

func NewConfigInviteLinkRequest

func NewConfigInviteLinkRequest() *ConfigInviteLinkRequest

type CreateDomainRequest

type CreateDomainRequest struct {
	TeamID             int    `json:"team_id" gorm:"column:team_id;type:bigserial;index:domains_team_id"`
	UserDomain         string `json:"user_domain" gorm:"column:user_domain;type:varchar;size:255;not null"`
	SystemDomainPrefix string `json:"system_domain_prefix" gorm:"column:system_domain_prefix;type:varchar;size:255;not null"`
	ResolveStatus      int    `json:"resolve_status" gorm:"column:resolve_status;type:smallint;"`
	Category           int    `json:"category" gorm:"column:category;type:smallint;"`
}

func NewCreateDomainRequest

func NewCreateDomainRequest() *CreateDomainRequest

type CreateInvitationCodeRequest

type CreateInvitationCodeRequest struct {
	TeamID        int `json:"teamID" gorm:"column:team_id;type:bigserial;index:invitation_code_team_id"`
	ConsumeStatus int `json:"consumeStatus" gorm:"column:consume_status;type:smallint;"`
}

func NewCreateInvitationCodeRequest

func NewCreateInvitationCodeRequest() *CreateInvitationCodeRequest

type CreateInviteRequest

type CreateInviteRequest struct {
	TeamID       int    `json:"teamID" gorm:"column:team_id;type:bigserial;index:users_ukey"`
	Email        string `json:"email" gorm:"column:email;type:varchar;size:255;;index:invite_email"`
	UserRole     int    `json:"userRole" gorm:"column:user_role;type:smallint;index:invite_user_role"`
	InviteStatus int    `json:"inviteStatus" gorm:"column:invite_status;type:smallint;index:users_ukey"`
}

func NewCreateInviteRequest

func NewCreateInviteRequest() *CreateInviteRequest

type CreateTeamMemberRequest

type CreateTeamMemberRequest struct {
	TeamID     int    `json:"teamID" gorm:"column:team_id;type:bigserial;index:team_members_team_and_user_id"`
	UserID     int    `json:"userID" gorm:"column:user_id;type:bigserial;index:team_members_team_and_user_id"`
	UserRole   int    `json:"userRole" gorm:"column:user_role;type:smallint"`
	Permission string `json:"permission" gorm:"column:authority;type:jsonb"` // for user permission config
}

func NewCreateTeamMemberRequest

func NewCreateTeamMemberRequest() *CreateTeamMemberRequest

type CreateTeamRequest

type CreateTeamRequest struct {
	Name           string    `json:"name" validate:"required"`
	TeamDomain     string    `json:"teamDomain"`
	Identifier     string    `json:"identifier" validate:"required"`
	InvitationCode uuid.UUID `json:"invitationCode" validate:"required"`
}

func NewCreateTeamRequest

func NewCreateTeamRequest() *CreateTeamRequest

func (CreateTeamRequest) ExportIdentifier

func (req CreateTeamRequest) ExportIdentifier() string

func (CreateTeamRequest) ExportInvitationCodeInUUID

func (req CreateTeamRequest) ExportInvitationCodeInUUID() uuid.UUID

func (CreateTeamRequest) ExportName

func (req CreateTeamRequest) ExportName() string

func (CreateTeamRequest) ExportTeamDomain

func (req CreateTeamRequest) ExportTeamDomain() string

type CreateUserRequest

type CreateUserRequest struct {
	Nickname       string `json:"nickname" gorm:"column:nickname;type:varchar;size:15;not null"`
	PasswordDigest string `json:"passworddigest" gorm:"column:password_digest;type:varchar;size:60;not null"`
	Email          string `json:"email" gorm:"column:email;type:varchar;size:255;not null"`
	SSOConfig      string `json:"SSOConfig" gorm:"column:sso_config;type:jsonb"`        // for single sign-on data
	Customization  string `json:"customization" gorm:"column:customization;type:jsonb"` // for user itself customization config, including: Language, IsSubscribed

}

func NewCreateUserRequest

func NewCreateUserRequest() *CreateUserRequest

type CreateUserResponse

type CreateUserResponse struct {
	ID string `json:"id"`
}

func NewCreateUserResponse

func NewCreateUserResponse(id int) *CreateUserResponse

func (*CreateUserResponse) ExportForFeedback

func (resp *CreateUserResponse) ExportForFeedback() interface{}

type Drive

type Drive struct {
	SystemDriveS3Instance S3Instance
	TeamDriveS3Instance   S3Instance
	// contains filtered or unexported fields
}

func NewDrive

func NewDrive(systemDriveS3Instance S3Instance, teamDriveS3Instance S3Instance, logger *zap.SugaredLogger) *Drive

type EmailInviteMessage

type EmailInviteMessage struct {
	UserName      string `json:"userName"`
	TeamName      string `json:"teamName"`
	TeamIcon      string `json:"teamIcon"`
	Email         string `json:"email"`
	JoinLink      string `json:"joinLink"`
	Language      string `json:"language"`
	ValidateToken string `json:"validateToken"` // token for query authorize, base64.Encoding(md5(...param + ROTOR_TOKEN))
}

func NewEmailInviteMessage

func NewEmailInviteMessage(invite *Invite, team *Team, user *User) *EmailInviteMessage

func (*EmailInviteMessage) Export

func (m *EmailInviteMessage) Export() map[string]string

func (*EmailInviteMessage) SetValidateToken

func (m *EmailInviteMessage) SetValidateToken(token string)

type EmailShareAppMessage

type EmailShareAppMessage struct {
	UserName      string `json:"userName"`
	TeamName      string `json:"teamName"`
	TeamIcon      string `json:"teamIcon"`
	Email         string `json:"email"`
	AppLink       string `json:"appLink"`
	Language      string `json:"language"`
	ValidateToken string `json:"validateToken"` // token for query authorize, base64.Encoding(md5(...param + ROTOR_TOKEN))
}

func NewEmailShareAppMessage

func NewEmailShareAppMessage(invite *Invite, team *Team, user *User, redirectPage string) *EmailShareAppMessage

func (*EmailShareAppMessage) Export

func (m *EmailShareAppMessage) Export() map[string]string

func (*EmailShareAppMessage) SetValidateToken

func (m *EmailShareAppMessage) SetValidateToken(token string)

type ForgetPasswordRequest

type ForgetPasswordRequest struct {
	Email             string `json:"email" validate:"required"`
	NewPassword       string `json:"newPassword" validate:"required"`
	VerificationCode  string `json:"verificationCode" validate:"required"`
	VerificationToken string `json:"verificationToken" validate:"required"`
}

func NewForgetPasswordRequest

func NewForgetPasswordRequest() *ForgetPasswordRequest

type GenerateInviteLinkResponse

type GenerateInviteLinkResponse struct {
	TeamID     string `json:"teamID"`
	AppID      string `json:"appID"`
	UserRole   int    `json:"userRole"`
	InviteLink string `json:"inviteLink"`
}

func NewGenerateInviteLinkResponse

func NewGenerateInviteLinkResponse() *GenerateInviteLinkResponse

func NewGenerateInviteLinkResponseByInvite

func NewGenerateInviteLinkResponseByInvite(invite *Invite, redirectPage string) *GenerateInviteLinkResponse

func (*GenerateInviteLinkResponse) ExportForFeedback

func (resp *GenerateInviteLinkResponse) ExportForFeedback() interface{}

func (*GenerateInviteLinkResponse) SetAppID

func (u *GenerateInviteLinkResponse) SetAppID(appID int)
func (u *GenerateInviteLinkResponse) SetInviteLink(inviteLink string)

func (*GenerateInviteLinkResponse) SetTeamID

func (u *GenerateInviteLinkResponse) SetTeamID(teamID int)

func (*GenerateInviteLinkResponse) SetUserRole

func (u *GenerateInviteLinkResponse) SetUserRole(userRole int)

type GetAllTeamMembersResponse

type GetAllTeamMembersResponse struct {
	AllTeamMembers []*TeamMemberWithUserInfoForExportConverted
}

func (*GetAllTeamMembersResponse) ExportForFeedback

func (resp *GetAllTeamMembersResponse) ExportForFeedback() interface{}

type GetMyTeamsResponse

type GetMyTeamsResponse struct {
	MyTeams []*MyTeamResponse
}

func NewGetMyTeamsResponse

func NewGetMyTeamsResponse(teams []*Team, teamMembersLT map[int]*TeamMemberForExport) *GetMyTeamsResponse

func (*GetMyTeamsResponse) ExportForFeedback

func (resp *GetMyTeamsResponse) ExportForFeedback() interface{}

type GetTargetTeamByInternalRequestResponse

type GetTargetTeamByInternalRequestResponse struct {
	ID         string    `json:"id"`
	UID        uuid.UUID `json:"uid"`
	Name       string    `json:"name"`
	Identifier string    `json:"identifier"`
	Icon       string    `json:"icon"`
	Permission string    `json:"permission"` // for team permission config
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`
}

func NewGetTargetTeamByInternalRequestResponse

func NewGetTargetTeamByInternalRequestResponse(team *Team) *GetTargetTeamByInternalRequestResponse

func (*GetTargetTeamByInternalRequestResponse) ExportForFeedback

func (resp *GetTargetTeamByInternalRequestResponse) ExportForFeedback() interface{}

type GetTargetUserByInternalRequestResponse

type GetTargetUserByInternalRequestResponse struct {
	ID           string    `json:"id"`
	UID          uuid.UUID `json:"uid"`
	TeamMemberID string    `json:"teamMemberID"`
	Nickname     string    `json:"nickname"`
	Email        string    `json:"email"`
	Avatar       string    `json:"avatar"`
	Language     string    `json:"language"`
	IsSubscribed bool      `json:"isSubscribed"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

func NewGetTargetUserByInternalRequestResponse

func NewGetTargetUserByInternalRequestResponse(user *User) *GetTargetUserByInternalRequestResponse

func (*GetTargetUserByInternalRequestResponse) ExportForFeedback

func (resp *GetTargetUserByInternalRequestResponse) ExportForFeedback() interface{}

func (*GetTargetUserByInternalRequestResponse) SetTeamMemberID

func (resp *GetTargetUserByInternalRequestResponse) SetTeamMemberID(id int)

type GetTargetUsersByInternalRequestResponse added in v0.0.12

type GetTargetUsersByInternalRequestResponse struct {
	Users map[string]*GetTargetUserByInternalRequestResponse `json:"users"`
}

func NewGetTargetUsersByInternalRequestResponse added in v0.0.12

func NewGetTargetUsersByInternalRequestResponse(users []*User) *GetTargetUsersByInternalRequestResponse

func (*GetTargetUsersByInternalRequestResponse) ExportForFeedback added in v0.0.12

func (resp *GetTargetUsersByInternalRequestResponse) ExportForFeedback() interface{}

type GetTeamByTeamIDResponse

type GetTeamByTeamIDResponse struct {
	ID         string          `json:"id"`
	UID        uuid.UUID       `json:"uid"`
	Name       string          `json:"name"`
	Identifier string          `json:"identifier"`
	Icon       string          `json:"icon"`
	Permission *TeamPermission `json:"permission"`
	CreatedAt  time.Time       `json:"createdAt"`
	UpdatedAt  time.Time       `json:"updatedAt"`
}

func NewGetTeamByTeamIDResponse

func NewGetTeamByTeamIDResponse(t *Team) *GetTeamByTeamIDResponse

func (*GetTeamByTeamIDResponse) ExportForFeedback

func (resp *GetTeamByTeamIDResponse) ExportForFeedback() interface{}

type GetTeamMemberResponse

type GetTeamMemberResponse struct {
	ID           string                `json:"userID"`
	UID          uuid.UUID             `json:"uid"`
	TeamMemberID string                `json:"teamMemberID"`
	Nickname     string                `json:"nickname"`
	Email        string                `json:"email"`
	Avatar       string                `json:"avatar"`
	Language     string                `json:"language"`
	IsSubscribed bool                  `json:"isSubscribed"`
	UserRole     int                   `json:"userRole"`
	Permission   *TeamMemberPermission `json:"permission"` // for user permission config
	UserStatus   int                   `json:"userStatus"`
	CreatedAt    time.Time             `json:"createdAt"`
	UpdatedAt    time.Time             `json:"updatedAt"`
}

func (*GetTeamMemberResponse) ExportForFeedback

func (resp *GetTeamMemberResponse) ExportForFeedback() interface{}

type GetTeamPermissionResponse

type GetTeamPermissionResponse struct {
	AllowEditorInvite           bool `json:"allowEditorInvite"`
	AllowViewerInvite           bool `json:"allowViewerInvite"`
	AllowEditorManageTeamMember bool `json:"allowEditorManageTeamMember"`
	AllowViewerManageTeamMember bool `json:"allowViewerManageTeamMember"`
	InviteLinkEnabled           bool `json:"inviteLinkEnabled"`
}

func NewGetTeamPermissionResponse

func NewGetTeamPermissionResponse(team *Team) *GetTeamPermissionResponse

func (*GetTeamPermissionResponse) ExportForFeedback

func (resp *GetTeamPermissionResponse) ExportForFeedback() interface{}

type GetUserByIDResponse

type GetUserByIDResponse struct {
	ID               string    `json:"userID"`
	UID              uuid.UUID `json:"uid"`
	Nickname         string    `json:"nickname"`
	Email            string    `json:"email"`
	Avatar           string    `json:"avatar"`
	Language         string    `json:"language"`
	IsTutorialViewed bool      `json:"isTutorialViewed"`
	CreatedAt        time.Time `json:"createdAt"`
	UpdatedAt        time.Time `json:"updatedAt"`
}

func NewGetUserByIDResponse

func NewGetUserByIDResponse(user *User) *GetUserByIDResponse

func (*GetUserByIDResponse) ExportForFeedback

func (resp *GetUserByIDResponse) ExportForFeedback() interface{}

type GetVerificationCodeResponse

type GetVerificationCodeResponse struct {
	VerificationToken string `json:"verificationToken"`
}

func NewGetVerificationCodeResponse

func NewGetVerificationCodeResponse(token string) *GetVerificationCodeResponse

func (*GetVerificationCodeResponse) ExportForFeedback

func (resp *GetVerificationCodeResponse) ExportForFeedback() interface{}

type Invite

type Invite struct {
	ID             int       `json:"id" gorm:"column:id;type:bigserial;primary_key;index:invite_ukey"`
	UID            uuid.UUID `json:"uid" gorm:"column:uid;type:uuid;not null;index:invite_uid"`
	Category       int       `json:"category" gorm:"column:category;type:smallint;not null"`
	TeamID         int       `json:"teamID" gorm:"column:team_id;type:bigserial;index:users_ukey"`
	TeamMemberID   int       `json:"teamMemberID" gorm:"column:team_member_id;type:bigserial"`
	TeamIdentifier string    `json:"teamIdentifier" sql:"-" gorm:"-"`
	AppID          int       `json:"appID" sql:"-" gorm:"-"`
	Hosts          string    `json:"hosts" sql:"-" gorm:"-"`
	Email          string    `json:"email" gorm:"column:email;type:varchar;size:255;;index:invite_email"`
	EmailStatus    bool      `json:"emailStatus" gorm:"column:email_status;type:bool"`
	UserRole       int       `json:"userRole" gorm:"column:user_role;type:smallint;index:invite_user_role"`
	Status         int       `json:"status" gorm:"column:status;type:smallint;index:users_ukey"`
	CreatedAt      time.Time `gorm:"column:created_at;type:timestamp"`
	UpdatedAt      time.Time `gorm:"column:updated_at;type:timestamp"`
}

func NewInvite

func NewInvite() *Invite

func NewInviteByCreateInviteRequest

func NewInviteByCreateInviteRequest(req *CreateInviteRequest) *Invite

func NewInviteByUpdateInviteRequest

func NewInviteByUpdateInviteRequest(req *UpdateInviteRequest) *Invite

func NewInviteEmailLinkByTeamAndRequest

func NewInviteEmailLinkByTeamAndRequest(team *Team, req *InviteMemberByEmailRequest) *Invite

func NewInviteLinkByTeamAndUserRole

func NewInviteLinkByTeamAndUserRole(team *Team, userRole int) *Invite

func (*Invite) ConstructByJSON

func (u *Invite) ConstructByJSON(InviteJSON []byte) error

func (*Invite) Export

func (u *Invite) Export() *InviteForExport

func (*Invite) ExportAppIDInString

func (u *Invite) ExportAppIDInString() string

func (*Invite) ExportEmail

func (u *Invite) ExportEmail() string

func (*Invite) ExportEmailStatus

func (u *Invite) ExportEmailStatus() bool

func (*Invite) ExportID

func (u *Invite) ExportID() int
func (u *Invite) ExportInviteLink() string

func (*Invite) ExportInviteLinkWithEmailAndTeam

func (u *Invite) ExportInviteLinkWithEmailAndTeam(team *Team) string
func (u *Invite) ExportShareAppLink() string

func (*Invite) ExportShareAppLinkWithEmailANDTeamIdentifier

func (u *Invite) ExportShareAppLinkWithEmailANDTeamIdentifier(team *Team) string

func (*Invite) ExportTeamID

func (u *Invite) ExportTeamID() int

func (*Invite) ExportTeamMemberID

func (u *Invite) ExportTeamMemberID() int

func (*Invite) ExportUID

func (u *Invite) ExportUID() uuid.UUID

func (*Invite) ExportUserRole

func (u *Invite) ExportUserRole() int
func (u *Invite) ImportInviteLink(link string) error

func (*Invite) InitCreatedAt

func (u *Invite) InitCreatedAt()

func (*Invite) InitUID

func (u *Invite) InitUID()

func (*Invite) InitUpdatedAt

func (u *Invite) InitUpdatedAt()

func (*Invite) IsAvaliable

func (u *Invite) IsAvaliable() bool
func (u *Invite) IsEmailInviteLink() bool
func (u *Invite) IsInviteLink() bool

func (*Invite) IsShareAppInvite

func (u *Invite) IsShareAppInvite() bool

func (*Invite) SetAppID

func (u *Invite) SetAppID(appID int)

func (*Invite) SetEmailStatusFailed

func (u *Invite) SetEmailStatusFailed()

func (*Invite) SetEmailStatusSuccess

func (u *Invite) SetEmailStatusSuccess()

func (*Invite) SetHosts

func (u *Invite) SetHosts(hosts string)

func (*Invite) SetTeamIdentifier

func (u *Invite) SetTeamIdentifier(teamIdentifier string)

func (*Invite) SetTeamMemberID

func (u *Invite) SetTeamMemberID(teamMemberID int)

func (*Invite) SetUserRole

func (u *Invite) SetUserRole(role int)

type InviteForExport

type InviteForExport struct {
	ID             int       `json:"id"`
	UID            uuid.UUID `json:"uid"`
	Category       int       `json:"category"`
	TeamID         int       `json:"teamID"`
	TeamMemberID   int       `json:"teamMemberID"`
	TeamIdentifier string    `json:"teamIdentifier"`
	AppID          int       `json:"appID"`
	Email          string    `json:"email"`
	EmailStatus    bool      `json:"emailStatus"`
	UserRole       int       `json:"userRole"`
	Status         int       `json:"status"`
	CreatedAt      time.Time `json:"createdAt"`
	UpdatedAt      time.Time `json:"updatedAt"`
}

type InviteMemberByEmailRequest

type InviteMemberByEmailRequest struct {
	UserRole     int    `json:"userRole" validate:"required"`
	Email        string `json:"email" validate:"required,email"`
	AppIDRaw     string `json:"appID"`        // optional
	Hosts        string `json:"hosts"`        // optional
	AppID        int    `json:"-"`            // optional
	RedirectPage string `json:"redirectPage"` // optional

}

func NewInviteMemberByEmailRequest

func NewInviteMemberByEmailRequest() *InviteMemberByEmailRequest

func (*InviteMemberByEmailRequest) ExportAppID

func (u *InviteMemberByEmailRequest) ExportAppID() int

func (*InviteMemberByEmailRequest) ExportEmail

func (u *InviteMemberByEmailRequest) ExportEmail() string

func (*InviteMemberByEmailRequest) ExportHosts

func (u *InviteMemberByEmailRequest) ExportHosts() string

func (*InviteMemberByEmailRequest) ExportRedirectPage added in v0.0.12

func (u *InviteMemberByEmailRequest) ExportRedirectPage() string

func (*InviteMemberByEmailRequest) ExportUserRole

func (u *InviteMemberByEmailRequest) ExportUserRole() int

func (*InviteMemberByEmailRequest) Init

func (u *InviteMemberByEmailRequest) Init()

func (*InviteMemberByEmailRequest) IsShareAppInvite

func (u *InviteMemberByEmailRequest) IsShareAppInvite() bool

type InviteMemberByEmailResponse

type InviteMemberByEmailResponse struct {
	Email        string `json:"email"`
	EmailStatus  bool   `json:"emailStatus"`
	UserRole     int    `json:"userRole"`
	TeamMemberID string `json:"teamMemberID"`
	AppID        string `json:"appID"`
	Feedback     string `json:"feedback"`
}

func NewInviteMemberByEmailResponse

func NewInviteMemberByEmailResponse() *InviteMemberByEmailResponse

func NewInviteMemberByEmailResponseByInviteRecord

func NewInviteMemberByEmailResponseByInviteRecord(i *Invite, feedback string) *InviteMemberByEmailResponse

func (*InviteMemberByEmailResponse) ExportForFeedback

func (resp *InviteMemberByEmailResponse) ExportForFeedback() interface{}

func (*InviteMemberByEmailResponse) SetEmail

func (u *InviteMemberByEmailResponse) SetEmail(email string)

func (*InviteMemberByEmailResponse) SetEmailStatus

func (u *InviteMemberByEmailResponse) SetEmailStatus(emailStatus bool)

func (*InviteMemberByEmailResponse) SetEmailStatusByInvite

func (u *InviteMemberByEmailResponse) SetEmailStatusByInvite(i *Invite)

func (*InviteMemberByEmailResponse) SetFeedback

func (u *InviteMemberByEmailResponse) SetFeedback(f string)

func (*InviteMemberByEmailResponse) SetUserRole

func (u *InviteMemberByEmailResponse) SetUserRole(userRole int)

type InviteStorage

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

func NewInviteStorage

func NewInviteStorage(db *gorm.DB, logger *zap.SugaredLogger) *InviteStorage

func (*InviteStorage) Create

func (d *InviteStorage) Create(u *Invite) (int, error)

func (*InviteStorage) DeleteByID

func (d *InviteStorage) DeleteByID(id int) error

func (*InviteStorage) DeleteByTeamID

func (d *InviteStorage) DeleteByTeamID(teamID int) error

func (*InviteStorage) DeleteByTeamIDAndTeamMemberID

func (d *InviteStorage) DeleteByTeamIDAndTeamMemberID(teamID int, teamMemberID int) error

func (*InviteStorage) DeleteByUID

func (d *InviteStorage) DeleteByUID(uid uuid.UUID) error

func (*InviteStorage) RetrieveAvaliableInviteByTeamIDAndEmail

func (d *InviteStorage) RetrieveAvaliableInviteByTeamIDAndEmail(teamID int, email string) (*Invite, error)

func (*InviteStorage) RetrieveAvaliableInviteByTeamIDAndTeamMemberID

func (d *InviteStorage) RetrieveAvaliableInviteByTeamIDAndTeamMemberID(teamID int, teamMemberID int) (*Invite, error)

func (*InviteStorage) RetrieveAvaliableInviteLinkByTeamIDAndUserRole

func (d *InviteStorage) RetrieveAvaliableInviteLinkByTeamIDAndUserRole(teamID int, userRole int) (*Invite, error)

func (*InviteStorage) RetrieveByID

func (d *InviteStorage) RetrieveByID(id int) (*Invite, error)

func (*InviteStorage) RetrieveByIDs

func (d *InviteStorage) RetrieveByIDs(ids []int) ([]*Invite, error)

func (*InviteStorage) RetrieveByUID

func (d *InviteStorage) RetrieveByUID(uid uuid.UUID) (*Invite, error)

func (*InviteStorage) RetrieveInviteByEmailAndTeamIDAndUserRole

func (d *InviteStorage) RetrieveInviteByEmailAndTeamIDAndUserRole(teamID int, email string, userRole int) (*Invite, error)

Note: this method is not avaliable invite record inluded.

func (*InviteStorage) RetrieveInviteByEmailByIDs

func (d *InviteStorage) RetrieveInviteByEmailByIDs(ids []int) ([]*Invite, error)

func (*InviteStorage) RetrieveInviteByTeamIDAndEmail

func (d *InviteStorage) RetrieveInviteByTeamIDAndEmail(teamID int, email string) (*Invite, error)

func (*InviteStorage) Update

func (d *InviteStorage) Update(u *Invite) error

type JWTCache added in v0.0.8

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

func NewJWTCache added in v0.0.8

func NewJWTCache(cache *redis.Client, logger *zap.SugaredLogger) *JWTCache

func (*JWTCache) CleanUserJWTTokenExpiredAt added in v0.0.8

func (c *JWTCache) CleanUserJWTTokenExpiredAt(user *User) error

func (*JWTCache) DoesUserJWTTokenAvaliable added in v0.0.8

func (c *JWTCache) DoesUserJWTTokenAvaliable(user *User, jwtTokenExpireAt string) (bool, error)

func (*JWTCache) InitUserJWTTokenExpiredAt added in v0.0.8

func (c *JWTCache) InitUserJWTTokenExpiredAt(user *User, jwtTokenExpireAt string) error

type MyTeamResponse added in v0.0.5

type MyTeamResponse struct {
	ID                   string                `json:"id"`
	UID                  uuid.UUID             `json:"uid"`
	Name                 string                `json:"name"`
	Identifier           string                `json:"identifier"`
	Icon                 string                `json:"icon"`
	MyRole               int                   `json:"myRole"`
	TeamMemberID         string                `json:"teamMemberID"`
	TeamMemberPermission *TeamMemberPermission `json:"teamMemberPermission"`
	TeamPermission       *TeamPermission       `json:"permission"`
	JoinedAt             time.Time             `json:"-"`
}

func NewMyTeamResponse added in v0.0.5

func NewMyTeamResponse(team *Team, targetTeamMember *TeamMember) *MyTeamResponse

func (*MyTeamResponse) ExportForFeedback added in v0.0.5

func (resp *MyTeamResponse) ExportForFeedback() interface{}

type Response

type Response interface {
	ExportForFeedback() interface{}
}

type S3Instance

type S3Instance interface {
	GetPreSignedPutURL(fileName string) (string, error)
}

type SignInRequest

type SignInRequest struct {
	Email    string `json:"email" validate:"required"`
	Password string `json:"password" validate:"required"`
}

func NewSignInRequest

func NewSignInRequest() *SignInRequest

type SignUpRequest

type SignUpRequest struct {
	Nickname          string `json:"nickname" validate:"required"`
	Email             string `json:"email" validate:"required"`
	Password          string `json:"password" validate:"required"`
	Language          string ``                    /* 152-byte string literal not displayed */
	IsSubscribed      bool   `json:"isSubscribed"` // is subscribed are optional
	IsTutorialViewed  bool   `json:"isTutorialViewed"`
	VerificationCode  string `json:"verificationCode"`  // @todo: add validate:"required" when uset smtp server configureable
	VerificationToken string `json:"verificationToken"` // @todo: add validate:"required" when uset smtp server configureable
	InviteToken       string `json:"inviteToken"`       // invite token are optional
}

func NewSignUpRequest

func NewSignUpRequest() *SignUpRequest

func (*SignUpRequest) ExportEmail

func (u *SignUpRequest) ExportEmail() string

func (*SignUpRequest) ExportInviteToken

func (u *SignUpRequest) ExportInviteToken() string
func (u *SignUpRequest) IsSignUpWithInviteLink() bool

type SignUpResponse

type SignUpResponse struct {
	ID           string    `json:"id"`
	UID          uuid.UUID `json:"uid"`
	TeamMemberID string    `json:"teamMemberID"`
	Nickname     string    `json:"nickname"`
	Email        string    `json:"email"`
	Avatar       string    `json:"avatar"`
	Language     string    `json:"language"`
	IsSubscribed bool      `json:"isSubscribed"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

func NewSignUpResponse

func NewSignUpResponse(u *User) *SignUpResponse

func (*SignUpResponse) ExportForFeedback

func (resp *SignUpResponse) ExportForFeedback() interface{}

type Storage

type Storage struct {
	UserStorage       *UserStorage
	TeamStorage       *TeamStorage
	TeamMemberStorage *TeamMemberStorage
	InviteStorage     *InviteStorage
}

func NewStorage

func NewStorage(postgresDriver *gorm.DB, logger *zap.SugaredLogger) *Storage

type SystemDrive

type SystemDrive struct {
	Drive      S3Instance `json:"-"`
	UserFolder string     `json:"userFolder"`
}

func NewSystemDrive

func NewSystemDrive(drive *Drive) *SystemDrive

func (*SystemDrive) GetUserAvatarUploadPreSignedURL

func (d *SystemDrive) GetUserAvatarUploadPreSignedURL(fileName string) (string, error)

func (*SystemDrive) SetUser

func (d *SystemDrive) SetUser(user *User)

type Team

type Team struct {
	ID         int       `json:"id" gorm:"column:id;type:bigserial;primary_key;index:teams_ukey"`
	UID        uuid.UUID `json:"uid" gorm:"column:uid;type:uuid;not null;index:teams_ukey"`
	Name       string    `json:"name" gorm:"column:name;type:varchar;size:255;not null"`
	Identifier string    `json:"identifier" gorm:"column:identifier;type:varchar;size:255;not null"`
	Icon       string    `json:"icon" gorm:"column:icon;type:varchar;size:255;not null"`
	Permission string    `json:"permission" gorm:"column:permission;type:jsonb"` // for team permission config
	CreatedAt  time.Time `gorm:"column:created_at;type:timestamp"`
	UpdatedAt  time.Time `gorm:"column:updated_at;type:timestamp"`
}

func NewTeam

func NewTeam() *Team

func (*Team) ConfigInviteLinkByRequest

func (u *Team) ConfigInviteLinkByRequest(req *ConfigInviteLinkRequest)

func (*Team) ConstructByJSON

func (u *Team) ConstructByJSON(TeamJSON []byte) error

func (*Team) DoesEditorOrViewerCanInviteMember

func (u *Team) DoesEditorOrViewerCanInviteMember() bool

func (*Team) Export

func (t *Team) Export() *TeamForExport

func (*Team) ExportID

func (u *Team) ExportID() int

func (*Team) ExportTeamPermission

func (u *Team) ExportTeamPermission() *TeamPermission

func (*Team) GetIdentifier

func (u *Team) GetIdentifier() string

func (*Team) GetUID

func (u *Team) GetUID() uuid.UUID

func (*Team) GetUIDInString

func (u *Team) GetUIDInString() string

func (*Team) InitCreatedAt

func (u *Team) InitCreatedAt()

func (*Team) InitUID

func (u *Team) InitUID()

func (*Team) InitUpdatedAt

func (u *Team) InitUpdatedAt()

func (*Team) SetTeamPermission

func (u *Team) SetTeamPermission(tp *TeamPermission)

func (*Team) UpdateByUpdateTeamConfigRawRequest

func (u *Team) UpdateByUpdateTeamConfigRawRequest(rawReq map[string]interface{}) error

func (*Team) UpdateByUpdateTeamPermissionRawRequest

func (u *Team) UpdateByUpdateTeamPermissionRawRequest(rawReq map[string]interface{}) error

type TeamDrive

type TeamDrive struct {
	UID              uuid.UUID  `json:"uid"`
	Drive            S3Instance `json:"-"`
	TeamSystemFolder string     `json:"teamsystemfolder"`
	TeamSpaceFolder  string     `json:"teamspacefolder"`
}

func NewTeamDrive

func NewTeamDrive(drive *Drive) *TeamDrive

func (*TeamDrive) GetIconUploadPreSignedURL

func (d *TeamDrive) GetIconUploadPreSignedURL(fileName string) (string, error)

func (*TeamDrive) SetTeam

func (d *TeamDrive) SetTeam(team *Team)

type TeamForExport

type TeamForExport struct {
	ID         int             `json:"id"`
	UID        uuid.UUID       `json:"uid"`
	Name       string          `json:"name"`
	Identifier string          `json:"identifier"`
	Icon       string          `json:"icon"`
	Permission *TeamPermission `json:"permission"`
	CreatedAt  time.Time       `json:"createdAt"`
	UpdatedAt  time.Time       `json:"updatedAt"`
}

type TeamIconUploadAddressResponse

type TeamIconUploadAddressResponse struct {
	UploadAddress string `json:"uploadAddress"`
}

func NewTeamIconUploadAddressResponse

func NewTeamIconUploadAddressResponse(presignedURL string) *TeamIconUploadAddressResponse

func (*TeamIconUploadAddressResponse) ExportForFeedback

func (resp *TeamIconUploadAddressResponse) ExportForFeedback() interface{}

type TeamMember

type TeamMember struct {
	ID         int       `json:"id" gorm:"column:id;type:bigserial;primary_key;index:team_members_ukey"`
	TeamID     int       `json:"team_id" gorm:"column:team_id;type:bigserial;index:team_members_team_and_user_id"`
	UserID     int       `json:"user_id" gorm:"column:user_id;type:bigserial;index:team_members_team_and_user_id"`
	UserRole   int       `json:"user_role" gorm:"column:user_role;type:smallint"`
	Permission string    `json:"permission" gorm:"column:permission;type:jsonb"` // for user permission config
	Status     int       `json:"status" gorm:"column:status;type:smallint"`
	CreatedAt  time.Time `gorm:"column:created_at;type:timestamp"`
	UpdatedAt  time.Time `gorm:"column:updated_at;type:timestamp"`
}

func NewEditorTeamMemberByUserID

func NewEditorTeamMemberByUserID(userID int) *TeamMember

func NewPendingTeamMemberByInvite

func NewPendingTeamMemberByInvite(invite *Invite) *TeamMember

func NewTeamMember

func NewTeamMember() *TeamMember

func NewTeamMemberByCreateTeamMemberRequest

func NewTeamMemberByCreateTeamMemberRequest(req *CreateTeamMemberRequest) *TeamMember

func NewTeamMemberByInviteAndUserID

func NewTeamMemberByInviteAndUserID(invite *Invite, userID int) *TeamMember

func NewTeamMemberByTeamIDAndUserIDAndUserRole

func NewTeamMemberByTeamIDAndUserIDAndUserRole(teamID, userID, userRole int) *TeamMember

func NewTeamMemberByUpdateTeamMemberRequest

func NewTeamMemberByUpdateTeamMemberRequest(req *UpdateTeamMemberRequest) *TeamMember

func (*TeamMember) ActiveUser

func (u *TeamMember) ActiveUser()

func (*TeamMember) ConstructByJSON

func (u *TeamMember) ConstructByJSON(TeamMemberJSON []byte) error

func (*TeamMember) Export

func (u *TeamMember) Export() *TeamMemberForExport

func (*TeamMember) ExportID

func (u *TeamMember) ExportID() int

func (*TeamMember) ExportPermission

func (u *TeamMember) ExportPermission() *TeamMemberPermission

func (*TeamMember) ExportUserID

func (u *TeamMember) ExportUserID() int

func (*TeamMember) ExportUserRole

func (u *TeamMember) ExportUserRole() int

func (*TeamMember) ExportWithPendingUserInfo

func (u *TeamMember) ExportWithPendingUserInfo(userForExport *UserForExport) *TeamMemberWithUserInfoForExport

func (*TeamMember) ExportWithUserInfo

func (u *TeamMember) ExportWithUserInfo(userForExport *UserForExport) *TeamMemberWithUserInfoForExport

func (*TeamMember) InitCreatedAt

func (u *TeamMember) InitCreatedAt()

func (*TeamMember) InitUpdatedAt

func (u *TeamMember) InitUpdatedAt()

func (*TeamMember) IsAdmin

func (u *TeamMember) IsAdmin() bool

func (*TeamMember) IsEditor

func (u *TeamMember) IsEditor() bool

func (*TeamMember) IsOwner

func (u *TeamMember) IsOwner() bool

func (*TeamMember) IsStatusOK

func (u *TeamMember) IsStatusOK() bool

func (*TeamMember) IsStatusPending

func (u *TeamMember) IsStatusPending() bool

func (*TeamMember) IsViewer

func (u *TeamMember) IsViewer() bool

func (*TeamMember) SetID

func (u *TeamMember) SetID(id int)

func (*TeamMember) SetUserID

func (u *TeamMember) SetUserID(userID int)

func (*TeamMember) SetUserRole

func (u *TeamMember) SetUserRole(userRole int)

func (*TeamMember) UpdateByUpdateTeamMemberRoleRequest

func (u *TeamMember) UpdateByUpdateTeamMemberRoleRequest(req *UpdateTeamMemberRoleRequest)

func (*TeamMember) UpdateTeamMemberRole

func (u *TeamMember) UpdateTeamMemberRole(userRole int)

type TeamMemberForExport

type TeamMemberForExport struct {
	ID         int                   `json:"id"`
	TeamID     int                   `json:"teamID"`
	UserID     int                   `json:"userID"`
	UserRole   int                   `json:"userRole"`
	Permission *TeamMemberPermission `json:"permission"` // for user permission config
	Status     int                   `json:"status"`
	CreatedAt  time.Time             `json:"createdAt"`
	UpdatedAt  time.Time             `json:"updatedAt"`
}

type TeamMemberPermission

type TeamMemberPermission struct {
	Config int `json:"config"`
}

func NewTeamMemberPermission

func NewTeamMemberPermission() *TeamMemberPermission

func (*TeamMemberPermission) ExportForTeam

func (tmp *TeamMemberPermission) ExportForTeam() string

type TeamMemberStorage

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

func NewTeamMemberStorage

func NewTeamMemberStorage(db *gorm.DB, logger *zap.SugaredLogger) *TeamMemberStorage

func (*TeamMemberStorage) Create

func (d *TeamMemberStorage) Create(u *TeamMember) (int, error)

func (*TeamMemberStorage) DeleteByID

func (d *TeamMemberStorage) DeleteByID(id int) error

func (*TeamMemberStorage) DeleteByIDAndTeamID

func (d *TeamMemberStorage) DeleteByIDAndTeamID(id int, teamID int) error

func (*TeamMemberStorage) DeleteByTeamID

func (d *TeamMemberStorage) DeleteByTeamID(teamID int) error

func (*TeamMemberStorage) DeleteByTeamIDAndUserID

func (d *TeamMemberStorage) DeleteByTeamIDAndUserID(teamID int, userID int) error

func (*TeamMemberStorage) DeleteByUID

func (d *TeamMemberStorage) DeleteByUID(uid string) error

func (*TeamMemberStorage) DeleteByUserID

func (d *TeamMemberStorage) DeleteByUserID(userID int) error

func (*TeamMemberStorage) DoesTeamIncludedTargetUser

func (d *TeamMemberStorage) DoesTeamIncludedTargetUser(teamID int, userID int) (bool, error)

func (*TeamMemberStorage) IsNowUserIsTeamOwner

func (d *TeamMemberStorage) IsNowUserIsTeamOwner(userID int) (bool, error)

func (*TeamMemberStorage) RetrieveByID

func (d *TeamMemberStorage) RetrieveByID(id int) (*TeamMember, error)

func (*TeamMemberStorage) RetrieveByTeamID

func (d *TeamMemberStorage) RetrieveByTeamID(team_id int) ([]*TeamMember, error)

func (*TeamMemberStorage) RetrieveByTeamIDAndID

func (d *TeamMemberStorage) RetrieveByTeamIDAndID(team_id int, id int) (*TeamMember, error)

func (*TeamMemberStorage) RetrieveByTeamIDAndUserID

func (d *TeamMemberStorage) RetrieveByTeamIDAndUserID(teamID int, userID int) (*TeamMember, error)

func (*TeamMemberStorage) RetrieveByUID

func (d *TeamMemberStorage) RetrieveByUID(uid string) (*TeamMember, error)

func (*TeamMemberStorage) RetrieveByUserID

func (d *TeamMemberStorage) RetrieveByUserID(user_id int) ([]*TeamMember, error)

func (*TeamMemberStorage) RetrieveTeamMemberByTeamIDAndID

func (d *TeamMemberStorage) RetrieveTeamMemberByTeamIDAndID(teamID int, id int) (*TeamMember, error)

func (*TeamMemberStorage) Update

func (d *TeamMemberStorage) Update(u *TeamMember) error

type TeamMemberWithUserInfoForExport

type TeamMemberWithUserInfoForExport struct {
	ID           int                   `json:"userID"`
	UID          uuid.UUID             `json:"uid"`
	TeamMemberID int                   `json:"teamMemberID"`
	Nickname     string                `json:"nickname"`
	Email        string                `json:"email"`
	Avatar       string                `json:"avatar"`
	Language     string                `json:"language"`
	IsSubscribed bool                  `json:"isSubscribed"`
	UserRole     int                   `json:"userRole"`
	Permission   *TeamMemberPermission `json:"permission"` // for user permission config
	UserStatus   int                   `json:"userStatus"`
	CreatedAt    time.Time             `json:"createdAt"`
	UpdatedAt    time.Time             `json:"updatedAt"`
}

type TeamMemberWithUserInfoForExportConverted

type TeamMemberWithUserInfoForExportConverted struct {
	ID           string                `json:"userID"`
	UID          uuid.UUID             `json:"uid"`
	TeamMemberID string                `json:"teamMemberID"`
	Nickname     string                `json:"nickname"`
	Email        string                `json:"email"`
	Avatar       string                `json:"avatar"`
	Language     string                `json:"language"`
	IsSubscribed bool                  `json:"isSubscribed"`
	UserRole     int                   `json:"userRole"`
	Permission   *TeamMemberPermission `json:"permission"` // for user permission config
	UserStatus   int                   `json:"userStatus"`
	CreatedAt    time.Time             `json:"createdAt"`
	UpdatedAt    time.Time             `json:"updatedAt"`
}

type TeamPermission

type TeamPermission struct {
	AllowEditorInvite           bool `json:"allowEditorInvite"`
	AllowViewerInvite           bool `json:"allowViewerInvite"`
	AllowEditorManageTeamMember bool `json:"allowEditorManageTeamMember"`
	AllowViewerManageTeamMember bool `json:"allowViewerManageTeamMember"`
	InviteLinkEnabled           bool `json:"inviteLinkEnabled"`
	BlockRegister               bool `json:"blockRegister"`
}

func NewTeamPermission

func NewTeamPermission() *TeamPermission
func (tp *TeamPermission) DisableInviteLink()

func (*TeamPermission) DoesBlockRegister added in v0.0.15

func (tp *TeamPermission) DoesBlockRegister() bool

func (*TeamPermission) DoesEditorCanManageTeamMember

func (tp *TeamPermission) DoesEditorCanManageTeamMember() bool

func (*TeamPermission) DoesInviteLinkEnabled

func (tp *TeamPermission) DoesInviteLinkEnabled() bool

func (*TeamPermission) DoesViewerCanManageTeamMember

func (tp *TeamPermission) DoesViewerCanManageTeamMember() bool
func (tp *TeamPermission) EnableInviteLink()

func (*TeamPermission) ExportForTeam

func (tp *TeamPermission) ExportForTeam() string

func (*TeamPermission) ImportFromTeam

func (tp *TeamPermission) ImportFromTeam(team *Team)

type TeamStorage

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

func NewTeamStorage

func NewTeamStorage(db *gorm.DB, logger *zap.SugaredLogger) *TeamStorage

func (*TeamStorage) Create

func (d *TeamStorage) Create(u *Team) (int, error)

func (*TeamStorage) DeleteByID

func (d *TeamStorage) DeleteByID(id int) error

func (*TeamStorage) DeleteByUID

func (d *TeamStorage) DeleteByUID(uid string) error

func (*TeamStorage) IsIdentifierExists

func (d *TeamStorage) IsIdentifierExists(identifier string) bool

func (*TeamStorage) RetrieveByID

func (d *TeamStorage) RetrieveByID(id int) (*Team, error)

func (*TeamStorage) RetrieveByIDs

func (d *TeamStorage) RetrieveByIDs(ids []int) ([]*Team, error)

func (*TeamStorage) RetrieveByIdentifier

func (d *TeamStorage) RetrieveByIdentifier(identifier string) (*Team, error)

func (*TeamStorage) RetrieveByUID

func (d *TeamStorage) RetrieveByUID(uid string) (*Team, error)

func (*TeamStorage) UpdateByID

func (d *TeamStorage) UpdateByID(u *Team) error

type TeamsForExport

type TeamsForExport []*TeamForExport

func NewTeamsForExport

func NewTeamsForExport(teams []*Team) (r TeamsForExport)

type UpdateAvatarRequest

type UpdateAvatarRequest struct {
	Avatar string `json:"avatar" validate:"required"`
}

func NewUpdateAvatarRequest

func NewUpdateAvatarRequest() *UpdateAvatarRequest

type UpdateDomainRequest

type UpdateDomainRequest struct {
	ID                 int       `json:"id" gorm:"column:id;type:bigserial;primary_key;index:domains_ukey"`
	UID                uuid.UUID `json:"uid" gorm:"column:uid;type:uuid;not null;index:domains_ukey"`
	TeamID             int       `json:"teamID" gorm:"column:team_id;type:bigserial;index:domains_team_id"`
	UserDomain         string    `json:"userDomain" gorm:"column:user_domain;type:varchar;size:255;not null"`
	SystemDomainPrefix string    `json:"systemDomain_prefix" gorm:"column:system_domain_prefix;type:varchar;size:255;not null"`
	ResolveStatus      int       `json:"resolveStatus" gorm:"column:resolve_status;type:smallint;"`
	Category           int       `json:"category" gorm:"column:category;type:smallint;"`
}

func NewUpdateDomainRequest

func NewUpdateDomainRequest() *UpdateDomainRequest

type UpdateInvitationCodeRequest

type UpdateInvitationCodeRequest struct {
	ID            int       `json:"id" gorm:"column:id;type:bigserial;primary_key;index:teams_ukey"`
	UID           uuid.UUID `json:"uid" gorm:"column:uid;type:uuid;not null;index:teams_ukey"`
	TeamID        int       `json:"teamID" gorm:"column:team_id;type:bigserial;index:invitation_code_team_id"`
	ConsumeStatus int       `json:"consumeStatus" gorm:"column:consume_status;type:smallint;"`
}

func NewUpdateInvitationCodeRequest

func NewUpdateInvitationCodeRequest() *UpdateInvitationCodeRequest

type UpdateInviteRequest

type UpdateInviteRequest struct {
	ID       int       `json:"id" gorm:"column:id;type:bigserial;primary_key;index:invite_ukey"`
	UID      uuid.UUID `json:"uid" gorm:"column:uid;type:uuid;not null;index:invite_uid"`
	TeamID   int       `json:"teamID" gorm:"column:team_id;type:bigserial;index:users_ukey"`
	Email    string    `json:"email" gorm:"column:email;type:varchar;size:255;;index:invite_email"`
	UserRole int       `json:"userRole" gorm:"column:user_role;type:smallint;index:invite_user_role"`
	Status   int       `json:"status" gorm:"column:status;type:smallint;index:users_ukey"`
}

func NewUpdateInviteRequest

func NewUpdateInviteRequest() *UpdateInviteRequest

type UpdateIsTutorialViewedRequest added in v0.0.7

type UpdateIsTutorialViewedRequest struct {
	IsTutorialViewed bool `json:"isTutorialViewed" validate:"boolean"`
}

func NewUpdateIsTutorialViewedRequest added in v0.0.7

func NewUpdateIsTutorialViewedRequest() *UpdateIsTutorialViewedRequest

type UpdateLanguageRequest

type UpdateLanguageRequest struct {
	Language string `` /* 152-byte string literal not displayed */
}

func NewUpdateLanguageRequest

func NewUpdateLanguageRequest() *UpdateLanguageRequest

type UpdateNicknameRequest

type UpdateNicknameRequest struct {
	Nickname string `json:"nickname" validate:"required"`
}

func NewUpdateNicknameRequest

func NewUpdateNicknameRequest() *UpdateNicknameRequest

type UpdateTeamConfigRequest

type UpdateTeamConfigRequest struct {
	Name       string `json:"name" validate:"required"`
	Identifier string `json:"identifier" validate:"required"`
	Icon       string `json:"icon"`
}

func NewUpdateTeamConfigRequest

func NewUpdateTeamConfigRequest(rawReq map[string]interface{}) *UpdateTeamConfigRequest

type UpdateTeamMemberRequest

type UpdateTeamMemberRequest struct {
	ID         int    `json:"id" gorm:"column:id;type:bigserial;primary_key;index:team_members_ukey"`
	TeamID     int    `json:"teamID" gorm:"column:team_id;type:bigserial;index:team_members_team_and_user_id"`
	UserID     int    `json:"userID" gorm:"column:user_id;type:bigserial;index:team_members_team_and_user_id"`
	UserRole   int    `json:"userRole" gorm:"column:user_role;type:smallint"`
	Permission string `json:"permission" gorm:"column:authority;type:jsonb"` // for user permission config
}

func NewUpdateTeamMemberRequest

func NewUpdateTeamMemberRequest() *UpdateTeamMemberRequest

type UpdateTeamMemberRoleRequest

type UpdateTeamMemberRoleRequest struct {
	UserRole int `json:"userRole" validate:"required"`
}

func NewUpdateTeamMemberRoleRequest

func NewUpdateTeamMemberRoleRequest() *UpdateTeamMemberRoleRequest

func (*UpdateTeamMemberRoleRequest) ExportUserRole

func (u *UpdateTeamMemberRoleRequest) ExportUserRole() int

func (*UpdateTeamMemberRoleRequest) IsTransferOwner

func (u *UpdateTeamMemberRoleRequest) IsTransferOwner() bool

type UpdateTeamPermissionRequest

type UpdateTeamPermissionRequest struct {
	AllowEditorInvite           bool `json:"allowEditorInvite"`
	AllowViewerInvite           bool `json:"allowViewerInvite"`
	AllowEditorManageTeamMember bool `json:"allowEditorManageTeamMember"`
	AllowViewerManageTeamMember bool `json:"allowViewerManageTeamMember"`
}

func NewUpdateTeamPermissionRequest

func NewUpdateTeamPermissionRequest(rawReq map[string]interface{}) *UpdateTeamPermissionRequest

type UpdateUserRequest

type UpdateUserRequest struct {
	ID             string    `json:"id" gorm:"column:id;type:bigserial;primary_key;index:users_ukey"`
	UID            uuid.UUID `json:"uid" gorm:"column:uid;type:uuid;not null;index:users_ukey"`
	Nickname       string    `json:"nickname" gorm:"column:nickname;type:varchar;size:15;not null"`
	PasswordDigest string    `json:"passworddigest" gorm:"column:password_digest;type:varchar;size:60;not null"`
	Email          string    `json:"email" gorm:"column:email;type:varchar;size:255;not null"`
	Avatar         string    `json:"avatar" gorm:"column:avatar;type:varchar;size:255;not null"`
	SSOConfig      string    `json:"SSOConfig" gorm:"column:sso_config;type:jsonb"`        // for single sign-on data
	Customization  string    `json:"customization" gorm:"column:customization;type:jsonb"` // for user itself customization config, including: Language, IsSubscribed

}

func NewUpdateUserRequest

func NewUpdateUserRequest() *UpdateUserRequest

type UpdateUserResponse

type UpdateUserResponse struct {
	ID           string    `json:"id"`
	UID          uuid.UUID `json:"uid"`
	TeamMemberID string    `json:"teamMemberID"`
	Nickname     string    `json:"nickname"`
	Email        string    `json:"email"`
	Avatar       string    `json:"avatar"`
	Language     string    `json:"language"`
	IsSubscribed bool      `json:"isSubscribed"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

func NewUpdateUserResponse

func NewUpdateUserResponse(user *User) *UpdateUserResponse

func (*UpdateUserResponse) ExportForFeedback

func (resp *UpdateUserResponse) ExportForFeedback() interface{}

type User

type User struct {
	ID             int       `json:"id" gorm:"column:id;type:bigserial;primary_key;index:users_ukey"`
	UID            uuid.UUID `json:"uid" gorm:"column:uid;type:uuid;not null;index:users_ukey"`
	Nickname       string    `json:"nickname" gorm:"column:nickname;type:varchar;size:15"`
	PasswordDigest string    `json:"passworddigest" gorm:"column:password_digest;type:varchar;size:60;not null"`
	Email          string    `json:"email" gorm:"column:email;type:varchar;size:255;not null"`
	Avatar         string    `json:"avatar" gorm:"column:avatar;type:varchar;size:255;not null"`
	SSOConfig      string    `json:"SSOConfig" gorm:"column:sso_config;type:jsonb"`        // for single sign-on data
	Customization  string    `json:"customization" gorm:"column:customization;type:jsonb"` // for user itself customization config, including: Language, IsSubscribed
	CreatedAt      time.Time `gorm:"column:created_at;type:timestamp"`
	UpdatedAt      time.Time `gorm:"column:updated_at;type:timestamp"`
}

func NewPendingUserByInvite

func NewPendingUserByInvite(i *Invite) (*User, error)

func NewPendingUserByInviteForExport

func NewPendingUserByInviteForExport(inviteForExport *InviteForExport) (*User, error)

func NewUser

func NewUser() *User

func NewUserByCreateUserRequest

func NewUserByCreateUserRequest(req *CreateUserRequest) *User

func NewUserBySignUpRequest

func NewUserBySignUpRequest(req *SignUpRequest) (*User, error)

func (*User) ConstructByJSON

func (u *User) ConstructByJSON(userJSON []byte) error

func (*User) Export

func (u *User) Export() *UserForExport

func (*User) ExportEmail

func (u *User) ExportEmail() string

func (*User) ExportID

func (u *User) ExportID() int

func (*User) ExportLanguage

func (u *User) ExportLanguage() string

func (*User) ExportUserCustomization

func (u *User) ExportUserCustomization() *UserCustomization

func (*User) GetUIDInString

func (u *User) GetUIDInString() string

func (*User) InitCreatedAt

func (u *User) InitCreatedAt()

func (*User) InitUID

func (u *User) InitUID()

func (*User) InitUpdatedAt

func (u *User) InitUpdatedAt()

func (*User) SetAvatar

func (u *User) SetAvatar(avatar string)

func (*User) SetID

func (u *User) SetID(id int)

func (*User) SetIsTutorialViewed added in v0.0.7

func (u *User) SetIsTutorialViewed(isTutorialViewed bool)

func (*User) SetLanguage

func (u *User) SetLanguage(language string)

func (*User) SetNickname

func (u *User) SetNickname(nickname string)

func (*User) SetPasswordByByte

func (u *User) SetPasswordByByte(password []byte)

func (*User) SetUserCustomization

func (u *User) SetUserCustomization(userCustomization *UserCustomization)

func (*User) UpdateByUpdateUserAvatarRequest

func (u *User) UpdateByUpdateUserAvatarRequest(req *UpdateAvatarRequest)

func (*User) UpdatePendingUserBySignUpRequest

func (u *User) UpdatePendingUserBySignUpRequest(req *SignUpRequest) error

type UserAvatarUploadAddressResponse

type UserAvatarUploadAddressResponse struct {
	UploadAddress string `json:"uploadAddress"`
}

func NewUserAvatarUploadAddressResponse

func NewUserAvatarUploadAddressResponse(presignedURL string) *UserAvatarUploadAddressResponse

func (*UserAvatarUploadAddressResponse) ExportForFeedback

func (resp *UserAvatarUploadAddressResponse) ExportForFeedback() interface{}

type UserCustomization

type UserCustomization struct {
	Language         string
	IsSubscribed     bool
	IsTutorialViewed bool
}

func NewUserCustomization

func NewUserCustomization() *UserCustomization

func NewUserCustomizationBySignUpRequest

func NewUserCustomizationBySignUpRequest(req *SignUpRequest) *UserCustomization

func (*UserCustomization) Export

func (c *UserCustomization) Export() (string, error)

func (*UserCustomization) SetIsSubscribed

func (c *UserCustomization) SetIsSubscribed(isSubscribed bool)

func (*UserCustomization) SetIsTutorialViewed added in v0.0.7

func (c *UserCustomization) SetIsTutorialViewed(isTutorialViewed bool)

func (*UserCustomization) SetLanguage

func (c *UserCustomization) SetLanguage(language string)

type UserForExport

type UserForExport struct {
	ID           int       `json:"id"`
	UID          uuid.UUID `json:"uid"`
	TeamMemberID int       `json:"teamMemberID"`
	Nickname     string    `json:"nickname"`
	Email        string    `json:"email"`
	Avatar       string    `json:"avatar"`
	Language     string    `json:"language"`
	IsSubscribed bool      `json:"isSubscribed"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

func (*UserForExport) SetTeamMemberID

func (ufe *UserForExport) SetTeamMemberID(teamMemberID int)

type UserSSOConfig

type UserSSOConfig struct {
	Github string
}

func NewUserSSOConfig

func NewUserSSOConfig() *UserSSOConfig

func (*UserSSOConfig) Export

func (u *UserSSOConfig) Export() string

type UserStorage

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

func NewUserStorage

func NewUserStorage(db *gorm.DB, logger *zap.SugaredLogger) *UserStorage

func (*UserStorage) Create

func (d *UserStorage) Create(u *User) (int, error)

func (*UserStorage) DeleteByID

func (d *UserStorage) DeleteByID(id int) error

func (*UserStorage) DeleteByUID

func (d *UserStorage) DeleteByUID(uid string) error

func (*UserStorage) RetrieveByEmail

func (d *UserStorage) RetrieveByEmail(email string) (*User, error)

func (*UserStorage) RetrieveByID

func (d *UserStorage) RetrieveByID(id int) (*User, error)

func (*UserStorage) RetrieveByIDAndUID

func (d *UserStorage) RetrieveByIDAndUID(id int, uid uuid.UUID) (*User, error)

func (*UserStorage) RetrieveByIDs

func (d *UserStorage) RetrieveByIDs(ids []int) ([]*User, error)

func (*UserStorage) RetrieveByUID

func (d *UserStorage) RetrieveByUID(uid uuid.UUID) (*User, error)

func (*UserStorage) UpdateByID

func (d *UserStorage) UpdateByID(u *User) error

func (*UserStorage) ValidateUser

func (d *UserStorage) ValidateUser(id int, uid uuid.UUID) (bool, error)

type VCodeClaims

type VCodeClaims struct {
	Email string `json:"email"`
	Code  string `json:"code"`
	Usage string `json:"usage"`
	jwt.RegisteredClaims
}

type VerificationRequest

type VerificationRequest struct {
	Email string `json:"email" validate:"required"`
	Usage string `json:"usage" validate:"oneof=signup forgetpwd"`
}

func NewVerificationRequest

func NewVerificationRequest() *VerificationRequest

Source Files

Jump to

Keyboard shortcuts

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