tempuser

package
v0.0.0-kmdagger1 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTempUserNotFound = errors.New("user not found")
)

Typed errors

Functions

This section is empty.

Types

type CreateTempUserCommand

type CreateTempUserCommand struct {
	Email           string
	Name            string
	OrgID           int64 `xorm:"org_id"`
	InvitedByUserID int64 `xorm:"invited_by_user_id"`
	Status          TempUserStatus
	Code            string
	Role            org.RoleType
	RemoteAddr      string
}

type ExpireTempUsersCommand

type ExpireTempUsersCommand struct {
	OlderThan time.Time

	NumExpired int64
}

type GetTempUserByCodeQuery

type GetTempUserByCodeQuery struct {
	Code string
}

type GetTempUsersQuery

type GetTempUsersQuery struct {
	OrgID  int64 `xorm:"org_id"`
	Email  string
	Status TempUserStatus
}

type Service

type Service interface {
	UpdateTempUserStatus(ctx context.Context, cmd *UpdateTempUserStatusCommand) error
	CreateTempUser(ctx context.Context, cmd *CreateTempUserCommand) (*TempUser, error)
	UpdateTempUserWithEmailSent(ctx context.Context, cmd *UpdateTempUserWithEmailSentCommand) error
	GetTempUsersQuery(ctx context.Context, query *GetTempUsersQuery) ([]*TempUserDTO, error)
	GetTempUserByCode(ctx context.Context, query *GetTempUserByCodeQuery) (*TempUserDTO, error)
	ExpireOldUserInvites(ctx context.Context, cmd *ExpireTempUsersCommand) error
}

type TempUser

type TempUser struct {
	ID              int64 `xorm:"pk autoincr 'id'"`
	OrgID           int64 `xorm:"org_id"`
	Version         int
	Email           string
	Name            string
	Role            org.RoleType
	InvitedByUserID int64 `xorm:"invited_by_user_id"`
	Status          TempUserStatus

	EmailSent   bool
	EmailSentOn time.Time
	Code        string
	RemoteAddr  string

	Created int64
	Updated int64
}

TempUser holds data for org invites and unconfirmed sign ups

type TempUserDTO

type TempUserDTO struct {
	ID             int64          `json:"id" xorm:"id"`
	OrgID          int64          `json:"orgId" xorm:"org_id"`
	Name           string         `json:"name"`
	Email          string         `json:"email"`
	Role           org.RoleType   `json:"role"`
	InvitedByLogin string         `json:"invitedByLogin"`
	InvitedByEmail string         `json:"invitedByEmail"`
	InvitedByName  string         `json:"invitedByName"`
	Code           string         `json:"code"`
	Status         TempUserStatus `json:"status"`
	URL            string         `json:"url"`
	EmailSent      bool           `json:"emailSent"`
	EmailSentOn    time.Time      `json:"emailSentOn"`
	Created        time.Time      `json:"createdOn"`
}

type TempUserStatus

type TempUserStatus string
const (
	TmpUserSignUpStarted TempUserStatus = "SignUpStarted"
	TmpUserInvitePending TempUserStatus = "InvitePending"
	TmpUserCompleted     TempUserStatus = "Completed"
	TmpUserRevoked       TempUserStatus = "Revoked"
	TmpUserExpired       TempUserStatus = "Expired"
)

type UpdateTempUserStatusCommand

type UpdateTempUserStatusCommand struct {
	Code   string
	Status TempUserStatus
}

type UpdateTempUserWithEmailSentCommand

type UpdateTempUserWithEmailSentCommand struct {
	Code string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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