entities

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrManagerialAccessIsDenied = errors.New("managerial access is denied")
	ErrUserIsDisabled           = errors.New("user is disabled")
	ErrFailedPasswordChecking   = errors.New("failed password checking")
	ErrFailedTokenChecking      = errors.New("failed token checking")
	ErrUnableToFormatCode       = errors.New("unable to format the code")
	ErrNotFound                 = errors.New("not found")
)

...

Functions

This section is empty.

Types

type AccessTokenClaims added in v1.5.1

type AccessTokenClaims struct {
	jwt.StandardClaims

	User User
}

AccessTokenClaims ...

type Credentials added in v1.5.1

type Credentials struct {
	AccessToken string
}

Credentials ...

type Pagination added in v1.5.1

type Pagination struct {
	PageSize int
	Page     int
}

Pagination ...

func (Pagination) IsZero added in v1.5.1

func (pagination Pagination) IsZero() bool

IsZero ...

func (Pagination) Offset added in v1.5.1

func (pagination Pagination) Offset() int

Offset ...

type Solution

type Solution struct {
	gorm.Model

	UserID    uint `minimum:"1"`
	User      User
	TaskID    uint `minimum:"1"`
	Task      Task
	Code      string
	IsCorrect bool
	Result    datatypes.JSON `swaggertype:"object"`
}

Solution ...

func (*Solution) FormatCode added in v1.5.1

func (solution *Solution) FormatCode() error

FormatCode ...

type SolutionGetter

type SolutionGetter interface {
	GetSolution(id uint) (Solution, error)
}

SolutionGetter ...

type SolutionGroup added in v1.5.1

type SolutionGroup struct {
	Solutions  []Solution
	TotalCount int64 `minimum:"0"`
}

SolutionGroup ...

type SolutionRegister

type SolutionRegister interface {
	RegisterSolution(id uint)
}

SolutionRegister ...

type Task

type Task struct {
	gorm.Model

	UserID          uint `minimum:"1"`
	User            User
	Title           string
	Description     string
	BoilerplateCode string
	TestCases       datatypes.JSON `swaggertype:"object"`
	Status          int            `gorm:"->" enums:"0,1,2"`
}

Task ...

func (*Task) FormatBoilerplateCode added in v1.5.1

func (task *Task) FormatBoilerplateCode() error

FormatBoilerplateCode ...

type TaskGetter

type TaskGetter interface {
	GetTask(userID uint, taskID uint) (Task, error)
}

TaskGetter ...

type TaskGroup added in v1.5.1

type TaskGroup struct {
	Tasks      []Task
	TotalCount int64 `minimum:"0"`
}

TaskGroup ...

type User added in v1.5.1

type User struct {
	gorm.Model

	Username     string `gorm:"unique"`
	Password     string `gorm:"-"`
	PasswordHash string
	IsDisabled   *bool
}

User ...

func (User) CheckPassword added in v1.5.1

func (user User) CheckPassword(passwordHash string) error

CheckPassword ...

func (*User) GeneratePassword added in v1.7.1

func (user *User) GeneratePassword(length int) error

GeneratePassword ...

func (*User) HashPassword added in v1.5.1

func (user *User) HashPassword(cost int) error

HashPassword ...

Jump to

Keyboard shortcuts

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