models

package
v0.0.0-...-01f85aa Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2022 License: Unlicense Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApplicationInactiveState      = 0
	ApplicationDraftState         = 1
	ApplicationPendingReviewState = 2
	ApplicationShutdownState      = 4
	ApplicationRunningState       = 5
)
View Source
const (
	AuthorizedApplicationPermissionGrantedState = 1
	AuthorizedApplicationPermissionDeniedState  = 0
)
View Source
const (
	TenantActiveState   = 1
	TenantInactiveState = 0
)
View Source
const (
	UserActiveState         = 1
	UserInactiveState       = 0
	UserSystemAdminRoleID   = 1
	UserTenantAdminRoleID   = 2
	UserTenantStudentRoleID = 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	ID           uint64    `json:"id"`
	UUID         string    `json:"uuid"`
	TenantID     uint64    `json:"tenant_id"`
	Name         string    `json:"name"`
	Description  string    `json:"description"`
	WebsiteURL   string    `json:"website_url"`
	Scope        string    `json:"scope"`
	RedirectURL  string    `json:"redirect_url"`
	ImageURL     string    `json:"image_url"`
	State        int8      `json:"state"`
	ClientID     string    `json:"client_id"`
	ClientSecret string    `json:"client_secret"`
	CreatedTime  time.Time `json:"created_time"`
	// CreatedFromIP  string    `json:"created_from_ip"`
	ModifiedTime time.Time `json:"modified_time"`
}

type ApplicationLite

type ApplicationLite struct {
	ID       uint64 `json:"id"`
	Name     string `json:"name"`
	Scope    string `json:"scope"`
	ImageURL string `json:"image_url"`
	State    int8   `json:"state"`
}

type ApplicationLiteFilter

type ApplicationLiteFilter struct {
	TenantID  uint64      `json:"tenant_id"`
	States    []int8      `json:"states"`
	SortOrder string      `json:"sort_order"`
	SortField string      `json:"sort_field"`
	Search    null.String `json:"search"`
	Offset    uint64      `json:"offset"`
	Limit     uint64      `json:"limit"`
}

Structure used to encapsulate the various filters we want to apply when we perform our `listing` functionality for the `ApplicationLite` model.

type ApplicationLiteRepository

type ApplicationLiteRepository interface {
	ListByFilter(ctx context.Context, filter *ApplicationLiteFilter) ([]*ApplicationLite, error)
	CountByFilter(ctx context.Context, filter *ApplicationLiteFilter) (uint64, error)
}

type ApplicationRepository

type ApplicationRepository interface {
	Insert(ctx context.Context, u *Application) error
	UpdateByID(ctx context.Context, u *Application) error
	GetByID(ctx context.Context, id uint64) (*Application, error)
	GetByUUID(ctx context.Context, uid string) (*Application, error)
	GetByClientID(ctx context.Context, cid string) (*Application, error)
	CheckIfExistsByID(ctx context.Context, id uint64) (bool, error)
	CheckIfRunningByClientID(ctx context.Context, clientID string) (bool, error)
	InsertOrUpdateByID(ctx context.Context, u *Application) error
	DeleteByID(ctx context.Context, id uint64) error
}

type AuthorizedApplication

type AuthorizedApplication struct {
	ID            uint64    `json:"id"`
	UUID          string    `json:"uuid"`
	TenantID      uint64    `json:"tenant_id"`
	ApplicationID uint64    `json:"application_id"`
	UserID        uint64    `json:"user_id"`
	SessionUUID   string    `json:"session_uuid"`
	State         int8      `json:"state"`
	CreatedTime   time.Time `json:"created_time"`
	// CreatedFromIP  string    `json:"created_from_ip"`
	ModifiedTime time.Time `json:"modified_time"`
}

type AuthorizedApplicationLite

type AuthorizedApplicationLite struct {
	ID            uint64 `json:"id"`
	ApplicationID uint64 `json:"application_id"`
	State         int8   `json:"state"`
}

type AuthorizedApplicationLiteFilter

type AuthorizedApplicationLiteFilter struct {
	TenantID  uint64      `json:"tenant_id"`
	States    []int8      `json:"states"`
	SortOrder string      `json:"sort_order"`
	SortField string      `json:"sort_field"`
	Search    null.String `json:"search"`
	Offset    uint64      `json:"offset"`
	Limit     uint64      `json:"limit"`
}

Structure used to encapsulate the various filters we want to apply when we perform our `listing` functionality for the `AuthorizedApplicationLite` model.

type AuthorizedApplicationLiteRepository

type AuthorizedApplicationLiteRepository interface {
	ListByFilter(ctx context.Context, filter *AuthorizedApplicationLiteFilter) ([]*AuthorizedApplicationLite, error)
	CountByFilter(ctx context.Context, filter *AuthorizedApplicationLiteFilter) (uint64, error)
}

type AuthorizedApplicationRepository

type AuthorizedApplicationRepository interface {
	Insert(ctx context.Context, u *AuthorizedApplication) error
	UpdateByID(ctx context.Context, u *AuthorizedApplication) error
	GetByID(ctx context.Context, id uint64) (*AuthorizedApplication, error)
	GetByUUID(ctx context.Context, uid string) (*AuthorizedApplication, error)
	GetByUserIDAndApplicationID(ctx context.Context, uid uint64, aid uint64) (*AuthorizedApplication, error)
	CheckIfExistsByID(ctx context.Context, id uint64) (bool, error)
	CheckIfPermissionGrantedByUserIDAndByApplicationID(ctx context.Context, uid uint64, aid uint64) (bool, error)
	InsertOrUpdateByID(ctx context.Context, u *AuthorizedApplication) error
	DeleteByID(ctx context.Context, id uint64) error
}

type Tenant

type Tenant struct {
	ID           uint64    `json:"id"`
	UUID         string    `json:"uuid"`
	Name         string    `json:"name"`
	State        int8      `json:"state"`
	Timezone     string    `json:"timestamp"`
	Language     string    `json:"language"`
	CreatedTime  time.Time `json:"created_time"`
	ModifiedTime time.Time `json:"modified_time"`
}

type TenantRepository

type TenantRepository interface {
	Insert(ctx context.Context, u *Tenant) error
	UpdateByID(ctx context.Context, u *Tenant) error
	GetByID(ctx context.Context, id uint64) (*Tenant, error)
	GetByName(ctx context.Context, name string) (*Tenant, error)
	CheckIfExistsByID(ctx context.Context, id uint64) (bool, error)
	CheckIfExistsByName(ctx context.Context, name string) (bool, error)
	InsertOrUpdateByID(ctx context.Context, u *Tenant) error
}

type User

type User struct {
	ID                uint64    `json:"id,omitempty"`
	UUID              string    `json:"uuid,omitempty"`
	TenantID          uint64    `json:"tenant_id,omitempty"`
	Email             string    `json:"email,omitempty"`
	FirstName         string    `json:"first_name,omitempty"`
	LastName          string    `json:"last_name,omitempty"`
	Name              string    `json:"name,omitempty"`
	LexicalName       string    `json:"lexical_name,omitempty"`
	PasswordAlgorithm string    `json:"password_algorithm,omitempty"`
	PasswordHash      string    `json:"password_hash,omitempty"`
	State             int8      `json:"state,omitempty"`
	RoleID            int8      `json:"role_id,omitempty"`
	Timezone          string    `json:"timezone,omitempty"`
	Language          string    `json:"language"`
	CreatedTime       time.Time `json:"created_time,omitempty"`
	ModifiedTime      time.Time `json:"modified_time,omitempty"`
	JoinedTime        time.Time `json:"joined_time,omitempty"`
	Salt              string    `json:"salt,omitempty"`
	WasEmailActivated bool      `json:"was_email_activated,omitempty"`
	PrAccessCode      string    `json:"pr_access_code,omitempty"`
	PrExpiryTime      time.Time `json:"pr_expiry_time,omitempty"`
	AccessToken       string    `json:"access_token,omitempty"`
	RefreshToken      string    `json:"refresh_token,omitempty"`
}

type UserData

type UserData struct {
	TenantID uint64 `json:"tenant_id,omitempty"`
	UserID   uint64 `json:"user_id,omitempty"`
	UserUUID string `json:"user_uuid,omitempty"`
}

UserData is used by the oAuth 2.0 system as extra data to include in the tokens that are sent back and forth by our system.

type UserLite

type UserLite struct {
	ID       uint64 `json:"id,omitempty"`
	UUID     string `json:"uuid,omitempty"`
	TenantID uint64 `json:"tenant_id,omitempty"`
	Email    string `json:"email,omitempty"`
	Name     string `json:"name,omitempty"`
	State    int8   `json:"state,omitempty"`
	RoleID   int8   `json:"role_id,omitempty"`
	Timezone string `json:"timezone,omitempty"`
	Language string `json:"language"`
}

type UserRepository

type UserRepository interface {
	Insert(ctx context.Context, u *User) error
	UpdateByID(ctx context.Context, u *User) error
	UpdateByEmail(ctx context.Context, u *User) error
	GetByID(ctx context.Context, id uint64) (*User, error)
	GetByEmail(ctx context.Context, email string) (*User, error)
	GetByUUID(ctx context.Context, uid string) (*User, error)
	CheckIfExistsByID(ctx context.Context, id uint64) (bool, error)
	CheckIfExistsByEmail(ctx context.Context, email string) (bool, error)
	InsertOrUpdateByID(ctx context.Context, u *User) error
	InsertOrUpdateByEmail(ctx context.Context, u *User) error
}

Jump to

Keyboard shortcuts

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