entity

package
v0.0.0-...-5ea6051 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	ID          uuid.UUID `validate:"required"`
	TeamID      uuid.UUID `validate:"required"`
	Name        string    `validate:"required"`
	Slug        string    `validate:"required"`
	Description string
	IsActive    bool      `validate:"required"`
	CreatedBy   string    `validate:"required"`
	CreatedAt   time.Time `validate:"required"`
	UpdatedAt   time.Time `validate:"required"`
	Permissions []*Permission
}

func NewApplication

func NewApplication(name, desc string, user User) (*Application, error)

func (*Application) Ok

func (a *Application) Ok() error

type Client

type Client struct {
	ID                    uuid.UUID `validate:"required"`
	Name                  string    `validate:"required"`
	Description           string
	Slug                  string    `validate:"required"`
	IsActive              bool      `validate:"required"`
	ClientKey             string    `validate:"required"`
	HashClientSecret      string    `validate:"required"`
	RoundHashClientSecret int       `validate:"min=1"`
	SaltHashClientSecret  string    `validate:"required"`
	LastLogin             time.Time `validate:"required"`
	CreatedBy             string    `validate:"required"`
	CreatedAt             time.Time `validate:"required"`
	UpdatedAt             time.Time `validate:"required"`
	Permissions           []*Permission
}

func NewClient

func NewClient(name, desc, author string, permissions []*Permission) (*Client, string, error)

func (*Client) Ok

func (c *Client) Ok() error

type Permission

type Permission struct {
	ID                  uuid.UUID `validate:"required"`
	ApplicationID       uuid.UUID `validate:"required"`
	ApplicationResource string    `validate:"required"`
	Action              string    `validate:"required"`
	CreatedBy           string    `validate:"required"`
	CreatedAt           time.Time `validate:"required"`
	UpdatedAt           time.Time `validate:"required"`
}

func NewPermission

func NewPermission(application Application, resource, action, createdBy string) (*Permission, error)

func (*Permission) Ok

func (p *Permission) Ok() error

type Team

type Team struct {
	ID          uuid.UUID `validate:"required"`
	Name        string    `validate:"required"`
	Slug        string    `validate:"required"`
	CreatedAt   time.Time `validate:"required"`
	UpdatedAt   time.Time `validate:"required"`
	Description string
}

func NewTeam

func NewTeam(name, description string) (*Team, error)

func (*Team) Ok

func (t *Team) Ok() error

type User

type User struct {
	ID                uuid.UUID `validate:"required"`
	TeamID            uuid.UUID `validate:"required"`
	Name              string    `validate:"required"`
	Occupation        string    `validate:"required"`
	Email             string    `validate:"required"`
	HashPassword      string    `validate:"required"`
	RoundHashPassword int       `validate:"required"`
	SaltHashPassword  string    `validate:"required"`
	LastLogin         nullable.Time
	CreatedAt         time.Time `validate:"required"`
	UpdatedAt         time.Time `validate:"required"`
}

func NewUser

func NewUser(teamID uuid.UUID, name, occupation, email, password string) (*User, error)

func (*User) Ok

func (u *User) Ok() error

func (*User) SignIn

func (u *User) SignIn(password string) (string, error)

Jump to

Keyboard shortcuts

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