models

package
v0.0.0-...-10cef3e Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LoginRequest

type LoginRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

func (LoginRequest) Validate

func (data LoginRequest) Validate() error

type Problem

type Problem struct {
	Id        uint64     `json:"id"`
	CreatedAt *time.Time `json:"createdAt" db:"created_at"`

	Name             string            `json:"name"`
	Description      string            `json:"description"`
	ShortDescription string            `json:"shortDescription" db:"short_description"`
	AuthorId         uint64            `json:"authorId" db:"author_id"`
	Visible          bool              `json:"visible"`
	Difficulty       ProblemDifficulty `json:"difficulty"`
	Grade            ProblemGrade      `json:"grade"`

	TimeLimit   float64 `json:"timeLimit" db:"time_limit"`
	MemoryLimit int     `json:"memoryLimit" db:"memory_limit"`
	StackLimit  int     `json:"stackLimit" db:"stack_limit"`
	SourceSize  int     `json:"sourceSize" db:"source_size"`
}

type ProblemDifficulty

type ProblemDifficulty string
const (
	Easy    ProblemDifficulty = "easy"
	Medium  ProblemDifficulty = "medium"
	Hard    ProblemDifficulty = "hard"
	Contest ProblemDifficulty = "contest"
)

type ProblemGrade

type ProblemGrade string

ex. clasa a 9, clasa a 10 etc

const (
	NINE   ProblemGrade = "9"
	TEN    ProblemGrade = "10"
	ELEVEN ProblemGrade = "11"
)

type SignupRequest

type SignupRequest struct {
	Username string `json:"username"`
	Email    string `json:"email"`
	Password string `json:"password"`
}

func (SignupRequest) Validate

func (data SignupRequest) Validate() error

type User

type User struct {
	Id        uint64     `json:"id"`
	CreatedAt *time.Time `json:"createdAt" db:"created_at"`

	Username string `json:"username"`
	Email    string `json:"email"`
	Password string `json:"-"`
	Bio      string `json:"bio"`
	Visible  bool   `json:"visible"`

	IsAdmin    bool `json:"isAdmin" db:"is_admin"`
	IsProposer bool `json:"isProposer" db:"is_proposer"`
	IsBanned   bool `json:"isBanned" db:"is_banned"`

	VerifiedEmail           bool       `json:"verifiedEmail" db:"verified_email"`
	EmailVerificationSentAt *time.Time `json:"emailVerificationSentAt" db:"email_verification_sent_at"`
}

User represents a user entity

func NewUser

func NewUser(username, email, password string) *User

NewUser creates a new user with the given username, email and password

Jump to

Keyboard shortcuts

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