entities

package
v0.0.0-...-7a4b419 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2022 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 Business

type Business struct {
	ID            string                 `json:"id"`
	Name          string                 `json:"name"`
	Description   string                 `json:"description"`
	Type          commons.BusinessTypes  `json:"type"`
	Level         commons.BusinessLevels `json:"level"`
	Founded       time.Time              `json:"founded"`
	Growths       []Growth               `json:"growths"`
	ContactPerson Contact                `json:"contactPerson"`
	Entrepreneurs []Entrepreneur         `json:"entrepreneurs"`
	CreatedAt     time.Time              `json:"createdAt"`
	UpdatedAt     time.Time              `json:"updatedAt"`
}

func (Business) Validate

func (b Business) Validate() map[string]string

type BusinessRepo

type BusinessRepo interface {
	Create(business *Business) (*Business, map[string]string)
	List() (*[]Business, error)
	Get(id string) (*Business, error)
	GetByName(name string) (*Business, error)
	Update(business *Business) (string, error)
	AddGrowthToBusiness(growth *Growth) (string, error)
}

type Contact

type Contact struct {
	Name  string `json:"name"`
	Phone string `json:"phone"`
}

type Entrepreneur

type Entrepreneur struct {
	ID         string          `json:"id"`
	Forename   string          `json:"forename"`
	Surname    string          `json:"surname"`
	Gender     commons.Genders `json:"gender"`
	BirthDate  time.Time       `json:"birthDate"`
	Phone      string          `json:"phone"`
	Email      string          `json:"email"`
	BusinessID string          `json:"businessId"`
	Business   Business        `json:"business"`
	CreatedAt  time.Time       `json:"createdAt"`
	UpdatedAt  time.Time       `json:"updatedAt"`
}

func (*Entrepreneur) Validate

func (e *Entrepreneur) Validate() map[string]string

type EntrepreneurRepo

type EntrepreneurRepo interface {
	Create(person *Entrepreneur) (*Entrepreneur, map[string]string)
	List() (*[]Entrepreneur, error)
	Get(id string) (*Entrepreneur, error)
	GetByPhoneEmail(phone, email string) (*Entrepreneur, error)
	AddToBusiness(person *Entrepreneur) (string, error)
}

type Event

type Event struct {
	ID            string      `json:"id"`
	Name          string      `json:"name"`
	Description   string      `json:"description"`
	StartDate     time.Time   `json:"startDate"`
	EndDate       time.Time   `json:"endDate"`
	InstitutionID string      `json:"institutionId"`
	Institution   Institution `json:"institution"`
	Trainees      []Trainee   `json:"trainees"`
	Teams         []Team      `json:"teams"`
	Rewards       []Reward    `json:"rewards"`
	CreatedAt     time.Time   `json:"createdAt"`
	UpdatedAt     time.Time   `json:"updatedAt"`
}

func (*Event) Validate

func (i *Event) Validate() map[string]string

type EventRepo

type EventRepo interface {
	Create(event *Event) (*Event, map[string]string)
	List() (*[]Event, error)
	Get(id string) (*Event, error)
	GetByName(name string) (*Event, error)
	Update(event *Event) (string, error)
}

type Growth

type Growth struct {
	ID          string    `json:"id"`
	Year        int64     `json:"year"`
	NetWorth    float64   `json:"netWorth"`
	Income      float64   `json:"income"`
	Expenditure float64   `json:"expenditure"`
	Assets      string    `json:"assets"`
	BusinessID  string    `json:"businessId"`
	Business    Business  `json:"business"`
	CreatedAt   time.Time `json:"createdAt"`
	UpdatedAt   time.Time `json:"updatedAt"`
}

type Institution

type Institution struct {
	ID            string    `json:"id"`
	Name          string    `json:"name"`
	Description   string    `json:"description"`
	Address       string    `json:"address"`
	ContactPerson Contact   `json:"contactPerson"`
	CreatedAt     time.Time `json:"createdAt"`
	UpdatedAt     time.Time `json:"updatedAt"`
}

func (*Institution) Validate

func (i *Institution) Validate() map[string]string

type InstitutionRepo

type InstitutionRepo interface {
	Create(institute *Institution) (*Institution, map[string]string)
	List() (*[]Institution, error)
	Get(id string) (*Institution, error)
	GetByName(name string) (*Institution, error)
	Update(institute *Institution) (string, error)
}

type PublicUser

type PublicUser struct {
	ID        string        `json:"id"`
	FirstName string        `json:"firstName" binding:"required"`
	LastName  string        `json:"lastName" binding:"required"`
	Phone     string        `json:"phone" binding:"required"`
	Role      commons.Roles `json:"role"`
	Status    string        `json:"status"`
}

type Reward

type Reward struct {
	ID          string    `json:"id"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
	EventID     string    `json:"eventId"`
	Event       Event     `json:"event"`
	Position    int       `json:"position"`
	CreatedAt   time.Time `json:"createdAt"`
	UpdatedAt   time.Time `json:"updatedAt"`
}

func (*Reward) Validate

func (r *Reward) Validate() map[string]string

type RewardRepo

type RewardRepo interface {
	Create(reward *Reward) (*Reward, map[string]string)
	List(event string) (*[]Reward, error)
	Get(id string) (*Reward, error)
	Update(reward *Reward) (string, error)
}

type Solution

type Solution struct {
	ID          string    `json:"id"`
	Title       string    `json:"title"`
	Description string    `json:"description"`
	EventID     string    `json:"eventId"`
	Event       Event     `json:"event"`
	TeamID      string    `json:"teamId"`
	Team        Team      `json:"team"`
	RewardID    string    `json:"RewardId"`
	Reward      Reward    `json:"reward"`
	Position    int       `json:"position"`
	CreatedAt   time.Time `json:"createdAt"`
	UpdatedAt   time.Time `json:"updatedAt"`
}

func (*Solution) Validate

func (r *Solution) Validate() map[string]string

type SolutionRepo

type SolutionRepo interface {
	Create(solution *Solution) (*Solution, map[string]string)
	List(event string) (*[]Solution, error)
	Get(id string) (*Solution, error)
	Update(solution *Solution) (string, error)
	AddReward(solution *Solution) (string, error)
}

type Team

type Team struct {
	ID          string    `json:"id"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
	EventID     string    `json:"eventId"`
	Event       Event     `json:"event"`
	Trainees    []Trainee `json:"trainees"`
	CreatedAt   time.Time `json:"createdAt"`
	UpdatedAt   time.Time `json:"updatedAt"`
}

func (*Team) Validate

func (r *Team) Validate() map[string]string

type TeamRepo

type TeamRepo interface {
	Create(team *Team) (*Team, map[string]string)
	List(event string) (*[]Team, error)
	Get(id string) (*Team, error)
	Update(team *Team) (string, error)
	GetByName(event, name string) (*Team, error)
}

type Trainee

type Trainee struct {
	ID            string          `json:"id"`
	Forename      string          `json:"forename"`
	Surname       string          `json:"surname"`
	Gender        commons.Genders `json:"gender"`
	BirthDate     time.Time       `json:"birthDate"`
	Phone         string          `json:"phone"`
	Email         string          `json:"email"`
	Qualification string          `json:"qualification"`
	EventID       string          `json:"eventId"`
	Event         Event           `json:"event"`
	TeamID        string          `json:"teamId"`
	Team          Team            `json:"team"`
	CreatedAt     time.Time       `json:"createdAt"`
	UpdatedAt     time.Time       `json:"updatedAt"`
}

func (*Trainee) Validate

func (trainee *Trainee) Validate() map[string]string

type TraineeRepo

type TraineeRepo interface {
	Create(trainee *Trainee) (*Trainee, map[string]string)
	List(event string) (*[]Trainee, error)
	Get(id string) (*Trainee, error)
	GetByPhoneEmail(event, phoneEmail string) (*Trainee, error)
	GetByEmail(event, email string) (*Trainee, error)
	AddToTeam(trainee *Trainee) (*Trainee, error)
}

type User

type User struct {
	ID           string        `json:"id"`
	FirstName    string        `json:"firstName"`
	LastName     string        `json:"lastName"`
	Phone        string        `json:"phone"`
	Password     string        `json:"password"`
	BasePassword string        `json:"basePassword"`
	Status       string        `json:"status"`
	Role         commons.Roles `json:"role"`
	CreatedAt    time.Time     `json:"createdAt"`
	UpdatedAt    time.Time     `json:"updatedAt"`
}

func (*User) CheckPassword

func (user *User) CheckPassword(password string) bool

func (*User) HashPassword

func (user *User) HashPassword()

func (*User) PublicUser

func (user *User) PublicUser() *PublicUser

func (*User) RetrievePassword

func (user *User) RetrievePassword() *UserWithPassword

func (*User) Validate

func (user *User) Validate(action string) map[string]string

type UserRepository

type UserRepository interface {
	Add(record *User) (*User, map[string]string)
	Login(phone string) (*User, error)
	Edit(record *User) (*User, map[string]string)
	ResetPassword(phone string) (*User, error)
	ChangePassword(user User) (*User, error)
	CreatePassword(user User) (*User, error)
	Disable(id string) (*User, error)
	Enable(id string) (*User, error)
	Users() (*[]User, error)
	User(id string) (*User, error)
	Remove(id string) (string, error)
}

type UserWithPassword

type UserWithPassword struct {
	ID           string `json:"id"`
	BasePassword string `json:"basePassword"`
	Status       string `json:"status"`
}

Jump to

Keyboard shortcuts

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