models

package
v0.0.0-...-a3ed9dc Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrValidationSlice

func ErrValidationSlice(err error) ([]string, bool)

func InitCustomValidation

func InitCustomValidation()

Types

type Company

type Company struct {
	ID           string      `json:"id,omitempty" bson:"_id"`
	Name         string      `json:"name" bson:"company_name" binding:"required,min=3,max=15"`
	Description  string      `json:"description,omitempty" bson:"description" binding:"max=3000"`
	EmpCount     uint16      `json:"total_employees" bson:"total_employees" binding:"required"`
	IsRegistered bool        `json:"registered" bson:"registered" binding:"required"`
	Type         CompanyType `json:"type" bson:"type" binding:"required,companyType"`
}

func (*Company) Map

func (co *Company) Map() map[string]interface{}

Map function returns map values

func (*Company) Names

func (co *Company) Names() []string

Names function returns field names

type CompanyType

type CompanyType string
const (
	Corporation        CompanyType = "Corporations"
	NonProfit          CompanyType = "NonProfit"
	Cooperative        CompanyType = "Cooperative"
	SoleProprietorship CompanyType = "Sole Proprietorship"
)

func (CompanyType) IsValid

func (ct CompanyType) IsValid() bool

type CompanyUpdate

type CompanyUpdate struct {
	Name         *string      `json:"name,omitempty" binding:"omitempty,min=3,max=15"`
	Description  *string      `json:"description,omitempty" binding:"omitempty,max=3000"`
	EmpCount     *uint16      `json:"total_employees,omitempty"`
	IsRegistered *bool        `json:"registered,omitempty"`
	Type         *CompanyType `json:"type,omitempty" binding:"omitempty,companyType"`
}

type JwtClaims

type JwtClaims struct {
	jwt.RegisteredClaims
	TokenInfo
}

type TokenInfo

type TokenInfo struct {
	UserID    string `json:"user_id"`
	UserName  string `json:"user_name"`
	UserEmail string `json:"email"`
}

type User

type User struct {
	ID       string `json:"id,omitempty" bson:"_id"`
	Name     string `json:"name" bson:"user_name" binding:"required,min=4,max=30"`
	Email    string `json:"email" bson:"email" binding:"required,email"`
	Password string `json:"password" bson:"password" binding:"required,max=20"`
}

type UserLogin

type UserLogin struct {
	Email    string `json:"email" bson:"email" binding:"required,email"`
	Password string `json:"password" bson:"password" binding:"required,max=20"`
}

Jump to

Keyboard shortcuts

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