models

package
v0.0.0-...-c1eda01 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const RFPStatusCreated = "Created"
View Source
const RFPStatusFinished = "Finished"
View Source
const RFPStatusFinishedWithError = "Finished With Error"
View Source
const RFPtatusProcessing = "Processing"

Variables

This section is empty.

Functions

func DeleteManyFiles

func DeleteManyFiles(paths []string)

func DownloadManyFile

func DownloadManyFile(list []Equipment) ([]string, error)

func GenerateQuestionJSON

func GenerateQuestionJSON(requirements []Requirement) ([]string, error)

Types

type Equipment

type Equipment struct {
	Id           uint   `json:"id"`
	Name         string `json:"name" validate:"required"`
	DownloadLink string `json:"download_link" validate:"required"`
	UserId       uint   `json:"user_id"`
}

func NewEquipment

func NewEquipment(name string, downloadLink string, userId uint) (*Equipment, error)

func (*Equipment) DownLoadFile

func (e *Equipment) DownLoadFile(test bool) error
func (e *Equipment) TestDownloadLink() (bool, error)

type Question

type Question struct {
	Question    string `json:"question"`
	Answer      string `json:"answer"`
	Source      string `json:"source"`
	Description string `json:"description"`
}

type QuestionMap

type QuestionMap struct {
	Map map[string]Question
}

func ConcatResults

func ConcatResults(results []*Result) *QuestionMap

type RFP

type RFP struct {
	Id           uint          `json:"id" gorm:"primaryKey"`
	UserId       uint          `json:"-"`
	Name         string        `json:"name" gorm:"unique" validate:"required"`
	CreationDate *time.Time    `json:"creation_date"`
	EndDate      *time.Time    `json:"end_date"`
	Status       string        `json:"status"`
	Requirements []Requirement `json:"requirements" gorm:"foreignKey:RFPId;references:Id"`
	Equipments   []Equipment   `json:"equipments" gorm:"foreignKey:id;many2many:rfp_equipment;"`
}

func NewRFP

func NewRFP(name string, requirements []string, equipments []Equipment, userId uint) (*RFP, error)

type Requirement

type Requirement struct {
	Id          uint   `json:"id" gorm:"primaryKey"`
	Requirement string `json:"requirement"`
	RFPId       uint   `json:"rfp_id"`
}

type Result

type Result struct {
	Id          uint       `json:"id" gorm:"primaryKey"`
	RFPId       uint       `json:"rfp_id"`
	EquipmentId uint       `json:"equipment_id"`
	Text        string     `json:"text"`
	EndDate     *time.Time `json:"end_date"`
}

type User

type User struct {
	Id        uint   `json:"id"`
	Name      string `json:"name" gorm:"unique"`
	Password  []byte `json:"-"`
	ApiKey    string `json:"-"`
	HasApiKey bool   `gorm:"-"`
}

func (*User) GetAPIKey

func (u *User) GetAPIKey() (string, error)

Function to get the decrypted API Key for a User

func (*User) SetAPIKey

func (u *User) SetAPIKey(apiKey string) error

Function to set an encrypted API Key for a User

Jump to

Keyboard shortcuts

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