models

package
v0.0.0-...-a50b575 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APaymentTokenTransaction

type APaymentTokenTransaction struct {
	Timestamp string   `json:"timestamp"`
	From      *User    `json:"from"`
	To        *User    `json:"to"`
	Amount    *big.Int `json:"amount"`
	Message   string   `json:"message"`
	Request   *Request `json:"request"`
}

type APaymentTokenTransfer

type APaymentTokenTransfer struct {
	From    string   `json:"from"`
	To      string   `json:"to"`
	Amount  *big.Int `json:"amount"`
	Message string   `json:"message"`
}

type Category

type Category struct {
	CategoryCode uint8  `json:"-"`
	Name         string `json:"category"`
	Added        string `json:"added,omitempty"`
	IsDefault    bool   `json:"isDefault"`
	Cows         []*Cow `json:"cows,omitempty"`
}

type CategoryStats

type CategoryStats struct {
	NumberOfDaysRequired int         `json:"number_of_days_required"`
	NumberOfAnimals      int         `json:"number_of_animals"`
	LowestDays           int16       `json:"lowest_days"`
	MaximumDays          int16       `json:"maximum_days"`
	CategoryName         string      `json:"category_name"`
	CategoryDescription  string      `json:"category_description"`
	CategoryCode         uint8       `json:"-"`
	CowsStats            []*CowStats `json:"cows"`
}

type Claim

type Claim struct {
	Username []string `json:"roles"`
	// recommended having
	jwt.StandardClaims
}

type Contribution

type Contribution struct {
	Id                int64              `json:"id"`
	Code              uint16             `json:"code"`
	Name              string             `json:"name"`
	ControlCategories []*ControlCategory `json:"controlCategories" orm:"reverse(many)"`
}

type ControlCategory

type ControlCategory struct {
	Id                int64         `json:"id"`
	ControlCategoryId string        `json:"controlCategoryId"`
	Abbreviation      string        `json:"abbreviation"`
	ControlCategory   string        `json:"controlCategory"`
	PointGroups       []*PointGroup `orm:"reverse(many)" json:"pointGroups"`
	Contribution      *Contribution `orm:"rel(fk);null" json:"-"`
}

type ControlPoint

type ControlPoint struct {
	Id             int64       `json:"id"`
	ControlPointId string      `json:"controlPointId"`
	Abbreviation   string      `json:"abbreviation"`
	ControlPoint   string      `json:"controlPoint"`
	Lacks          []*Lack     `orm:"reverse(many)" json:"lacks"`
	PointGroup     *PointGroup `orm:"rel(fk);null" json:"-"`
}

type Cow

type Cow struct {
	Id                 int64                      `json:"id"`
	Name               string                     `json:"name"`
	TVD                string                     ` json:"tvd"`
	Details            *tvd.CattleLivestockDataV2 `orm:"-" json:"details"`
	Journal            []*JournalEntry            `orm:"-;reverse(many)" json:"journal"` // WHY IS THIS NEEDED?
	Farm_id            string                     `orm:"-" json:"farm_id,omitempty"`
	Categories         []*Category                `orm:"-" json:"categories,omitempty"`
	Added              string                     `orm:"-" json:"added,omitempty"`
	MoreDetails        *tvd.CattleDetailData      `orm:"-" json:"moreDetails,omitempty"`
	LatestJournalEntry *JournalEntry              `orm:"-" json:"latest_journal_entry,omitempty"` // WHY IS THIS NEEDED?
}

func (*Cow) GetJournal

func (cow *Cow) GetJournal()

type CowStats

type CowStats struct {
	EarTagNumber        string `json:"ear_tag_number"`
	NumberOfDaysOutside int16  `json:"number_of_days_outside"`
	TotalMinutesOutside int    `json:"total_minutes_outside"`
	Name                string `json:"name"`
}

func (*CowStats) SetDayOutside

func (cowStats *CowStats) SetDayOutside(month uint8, year uint16)

type EarTagNumbers

type EarTagNumbers struct {
	EarTagNumbers []string
}

type EtherScanTransaction

type EtherScanTransaction struct {
	BlockNumber     string `json:"blockNumber"`
	Timestamp       string `json:"timeStamp"`
	From            string `json:"from"`
	To              string `json:"to"`
	Value           string `json:"value"`
	Input           string `json:"input"`
	ContractAddress string `json:"contractAddress"`
	IsError         string `json:"isError"`
}

type EtherScanTransactionResult

type EtherScanTransactionResult struct {
	Status  string                  `json:"status"`
	Message string                  `json:"message"`
	Result  []*EtherScanTransaction `json:"result"`
}

type GVE

type GVE struct {
	Amount     float32     `json:"amount"`
	PointGroup *PointGroup `json:"pointGroup"`
}

type Inspection

type Inspection struct {
	RequestId   int64             `json:"requestId"`
	InspectorId int64             `json:"inspectorId"`
	Lacks       []*InspectionLack `json:"lacks"`
}

type InspectionLack

type InspectionLack struct {
	ContributionCode  uint16 `json:"contributionCode"`
	ControlCategoryId int64  `json:"controlCategoryId"`
	PointGroupCode    uint16 `json:"pointGroupCode"`
	ControlPointId    int64  `json:"controlPointId"`
	LackId            int64  `json:"lackId"`
	Points            uint8  `json:"points"`
}

type Journal

type Journal struct {
	JournalEntries []*JournalEntry
}

type JournalEntry

type JournalEntry struct {
	Id             int64     `json:"-"`
	TVDS           []*Cow    `orm:"rel(m2m)" json:"tvds"`
	Year           uint16    `orm:"-" json:"year"`
	Month          uint8     `orm:"-" json:"month"`
	Day            uint8     `orm:"-" json:"day"`
	Date           time.Time `orm:"auto_now_add;type(date)" json:"date"`
	MinutesOutside int       `json:"minutes_outside"`
	TypeOfLairage  string    `json:"type_of_field_lairage"`
	Created        time.Time `orm:"auto_now_add;type(datetime)" json:"created"`
	Updated        time.Time `orm:"auto_now;type(datetime)"`
}

func (*JournalEntry) SetDate

func (journalEntry *JournalEntry) SetDate()

func (*JournalEntry) TableName

func (je *JournalEntry) TableName() string

type Lack

type Lack struct {
	Id           int64         `json:"id"`
	Name         string        `json:"name"`
	Points       int8          `json:"points"`
	Francs       int16         `json:"francs"`
	ControlPoint *ControlPoint `orm:"rel(fk);null" json:"-"`
	Computed     bool          `orm:"default(false)" json:"computed"`
}

type LegalForm

type LegalForm struct {
	Id   int64  `json:"id"`
	Code uint8  `json:"code"`
	Name string `json:"name"`
}

type MonthlyStats

type MonthlyStats struct {
	Month         uint8            `json:"month"`
	Year          uint16           `json:"year"`
	CategoryStats []*CategoryStats `json:"category_stats"`
}

func (*MonthlyStats) SetCategoryMinMaxDays

func (monthlyStats *MonthlyStats) SetCategoryMinMaxDays()

type Plant

type Plant struct {
	Id                int64      `json:"id"`
	CantonalPlantNr   string     `json:"cantonalPlantNr"` // e.g. 1234/70/123
	Community         string     `json:"community"`       // Deutsch: Gemeinde
	CommunityNr       uint16     `json:"communityNr"`
	Name              string     `json:"name"`
	XCoordinate       uint32     `json:"xCoordinate"`
	YCoordinate       uint32     `json:"xCoordinate"`
	PlantType         *PlantType `orm:"rel(fk);null" json:"plantType"`
	MetersAboveTheSea int16      `json:"metersAboveTheSea"`
}

type PlantType

type PlantType struct {
	Id   int64  `json:"id"`
	Code uint8  `json:"code"`
	Name string `json:"name"`
}

type PointGroup

type PointGroup struct {
	Id             int64  `json:"id"`
	PointGroupId   string `json:"pointGroupId"`
	Abbreviation   string `json:"abbreviation"`
	PointGroup     string `json:"pointGroup"`
	PointGroupCode uint16 `json:"pointGroupCode"`
	//Condition
	//Type
	ControlCategory *ControlCategory `orm:"rel(fk);null" json:"-"`
	ControlPoints   []*ControlPoint  `orm:"reverse(many)" json:"controlPoints"`
}

type RausJournalRequest

type RausJournalRequest struct {
	TVDs []string `json:"tvds"`
	Year int16    `json:"year"`
}

type RausJournalResponse

type RausJournalResponse struct {
	Valid               bool  `json:"valid"`
	MissedDays          int8  `json:"missed_days"`
	NumberOfInvalidCows int16 `json:"num_of_invalid_cows"`
	// contains filtered or unexported fields
}

type Request

type Request struct {
	Id   int64 `json:"id"`
	User *User `orm:"rel(fk)" json:"user"`

	Address       string          `json:"address"`
	Contributions []*Contribution `orm:"-" json:"contributions"`
	Remark        string          `orm:"-" json:"remark"`
	Created       *big.Int        `orm:"-" json:"created"`
	Modified      *big.Int        `orm:"-" json:"modified"`

	Inspector              *User           `orm:"rel(fk);null" json:"inspector"`
	ContributionsWithLacks []*Contribution `orm:"-" json:"contributionsWithLacks"`

	GVE      []*GVE                      `orm:"-" json:"gve"`
	Payments []*APaymentTokenTransaction `orm:"-" json:"payments"`
}

type Role

type Role struct {
	Id    int64 `json:"id"`
	Name  string
	Users []*User `orm:"reverse(many)" json:"-"`
}

type User

type User struct {
	Id                          int64                               `json:"id"`
	Username                    string                              `orm:"unique" json:"username"`
	Password                    string                              `json:"password"`
	Email                       string                              `orm:"unique" json:"email"`
	Roles                       []*Role                             `orm:"rel(m2m)" json:"roles"`
	JwtToken                    string                              `orm:"-" json:"token"`
	EtherumAddress              string                              `json:"etherumAddress"`
	EthereumBalance             *big.Int                            `orm:"-" json:"ethereumBalance"`
	APaymentTokenBalance        *big.Int                            `orm:"-" json:"apaymentTokenBalance"`
	Firstname                   string                              `json:"firstname"`
	Lastname                    string                              `json:"lastname"`
	PersonAddressResult         *tvd.PersonAddressResult            `orm:"-" json:"agateDetails"`
	AnimalHusbandryDetailResult *tvd.GetAnimalHusbandryDetailResult `orm:"-" json:"AnimalHusbandryDetailResult"`
	TVD                         int32                               `json:"tvd"`
}

func (*User) HasRole

func (user *User) HasRole(roleName string) bool

Jump to

Keyboard shortcuts

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