models

package
v0.0.0-...-0ad4d90 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 6 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CertificationOptions = map[string]string{
	"none":      "none",
	"training":  "training",
	"solo":      "solo",
	"certified": "certified",
	"cantrain":  "cantrain",
}
View Source
var ControllerStatusOptions = map[string]string{
	"none":     "none",
	"active":   "active",
	"inactive": "inactive",
	"loa":      "loa",
}
View Source
var ControllerTypeOptions = map[string]string{
	"none":    "none",
	"visitor": "visitor",
	"home":    "home",
}
View Source
var TrainingNoteTypes = map[string]string{
	"classroom":      "classroom",
	"live":           "live",
	"simulation":     "simulation",
	"live-ots":       "live-ots",
	"simulation-ots": "simulation-ots",
	"no-show":        "no-show",
	"other":          "other",
}
View Source
var TrainingNoteTypesToVATUSA = map[string]string{
	"classroom":      "0",
	"live":           "1",
	"simulation":     "2",
	"live-ots":       "1",
	"simulation-ots": "2",
	"no-show":        "0",
	"other":          "0",
}

Functions

func IValidUserCertificationValue

func IValidUserCertificationValue(value string) bool

func IsValidFeedbackRating

func IsValidFeedbackRating(rating string) bool

func IsValidFeedbackStatus

func IsValidFeedbackStatus(status string) bool

func IsValidPosition

func IsValidPosition(pos string) bool

func IsValidTrainingStatus

func IsValidTrainingStatus(s string) bool

Types

type APIKeys

type APIKeys struct {
	ID        uint      `json:"id" example:"1"`
	Key       string    `json:"key" example:"1234567890"`
	Roles     string    `json:"role" example:"[\"atm\"]"`
	CreatedAt time.Time `json:"created_at" example:"2020-01-01T00:00:00Z"`
	UpdatedAt time.Time `json:"updated_at" example:"2020-01-01T00:00:00Z"`
}

type Airport

type Airport struct {
	ID          string      `json:"arpt_id" example:"FAI" gorm:"primary_key"`
	ICAO        string      `json:"icao_id" example:"PAFA" gorm:"index"`
	State       string      `json:"state_code" example:"AK"`
	City        string      `json:"city" example:"Fairbanks"`
	Name        string      `json:"arpt_name" example:"FAIRBANKS INTL AIRPORT"`
	ARTCC       string      `json:"resp_artcc_id" example:"ZNY" gorm:"index"`
	Status      string      `json:"arpt_status" example:"O"`
	TwrTypeCode string      `json:"twr_type_code" example:"T"`
	Elevation   float32     `json:"elevation" example:"13.0"`
	Latitude    float32     `json:"latitude" example:"40.639801"`
	Longitude   float32     `json:"longitude" example:"-73.778900"`
	ATC         *AirportATC `json:"atc,omitempty" gorm:"foreignKey:ID;references:ID"`
	HasMETAR    bool        `json:"-"`
	HasTAF      bool        `json:"-"`
	METAR       string      `json:"metar,omitempty"`
	TAF         string      `json:"taf,omitempty"`
	CreatedAt   time.Time   `json:"created_at" example:"2021-09-01T00:00:00Z"`
	UpdatedAt   time.Time   `json:"updated_at" example:"2021-09-01T00:00:00Z"`
}

type AirportATC

type AirportATC struct {
	ID                     string    `json:"arpt_id" example:"JFK" gorm:"index"`
	FacilityType           string    `json:"facility_type" example:"ATCT-A/C"`
	TwrOperatorCode        string    `json:"twr_operator_code" example:"A"`
	TwrCall                string    `json:"twr_call" example:"Fairbanks"`
	TwrHrs                 string    `json:"twr_hrs" example:"1200-0100 local time"`
	PrimaryApchRadioCall   string    `json:"primary_apch_radio_call" example:"Fairbanks"`
	ApchPProvider          string    `json:"apch_p_provider" example:"FAI"`
	ApchPProvTypeCD        string    `json:"apch_p_prov_type_cd" example:"A"`
	SecondaryApchRadioCall string    `json:"secondary_apch_radio_call" example:"Anchorage"`
	ApchSProvider          string    `json:"apch_s_provider" example:"ANC"`
	ApchSProvTypeCD        string    `json:"apch_s_prov_type_cd" example:"A"`
	PrimaryDepRadioCall    string    `json:"primary_dep_radio_call" example:"Fairbanks"`
	DepPProvider           string    `json:"dep_p_provider" example:"FAI"`
	DepPProvTypeCD         string    `json:"dep_p_prov_type_cd" example:"A"`
	SecondaryDepRadioCall  string    `json:"secondary_dep_radio_call" example:"Anchorage"`
	DepSProvider           string    `json:"dep_s_provider" example:"ANC"`
	DepSProvTypeCD         string    `json:"dep_s_prov_type_cd" example:"A"`
	CreatedAt              time.Time `json:"created_at" example:"2021-09-01T00:00:00Z"`
	UpdatedAt              time.Time `json:"updated_at" example:"2021-09-01T00:00:00Z"`
}

type AirportChart

type AirportChart struct {
	ID        string    `json:"-" gorm:"primary_key"`
	AirportID string    `json:"arpt_id" example:"FAI" gorm:"index"`
	Cycle     int       `json:"cycle" example:"2213" gorm:"index"`
	FromDate  time.Time `json:"from_date" example:"2021-09-01T00:00:00Z"`
	ToDate    time.Time `json:"to_date" example:"2021-09-30T00:00:00Z"`
	ChartCode string    `json:"chart_code" example:"DP"`
	ChartName string    `json:"chart_name" example:"RDFLG FOUR (RNAV)"`
	ChartURL  string    `json:"chart_url" example:"https://aeronav.faa.gov/d-tpp/2212/01234RDFLG.PDF"`
	CreatedAt time.Time `json:"created_at" example:"2021-09-01T00:00:00Z"`
	UpdatedAt time.Time `json:"updated_at" example:"2021-09-01T00:00:00Z"`
}

type Certification

type Certification struct {
	ID          uint   `json:"id"`
	Name        string `json:"name"`
	DisplayName string `json:"display_name"`
	Order       uint   `json:"order"`
	Hidden      bool   `json:"hidden"`
}

type ControllerStat

type ControllerStat struct {
	ID        uint      `json:"id" example:"1"`
	UserID    uint      `json:"cid" example:"1" gorm:"index"`
	User      *User     `json:"user"`
	Position  string    `json:"position" example:"ANC_TWR" gorm:"index"`
	LogonTime time.Time `json:"logon_time" example:"2020-01-01T00:00:00Z" gorm:"index"`
	Duration  int       `json:"duration" example:"3600"`
	CreatedAt time.Time `json:"created_at" example:"2020-01-01T00:00:00Z"`
	UpdatedAt time.Time `json:"updated_at" example:"2020-01-01T00:00:00Z"`
}

type DelayedJob

type DelayedJob struct {
	ID        int       `json:"id" example:"1"`
	Queue     string    `json:"queue" gorm:"type:varchar(128)" example:"email"`
	Body      string    `json:"body" gorm:"type:text"`
	NotBefore time.Time `json:"not_before" example:"2020-01-01T00:00:00Z"`
	CreatedAt time.Time `json:"created_at" example:"2020-01-01T00:00:00Z"`
	UpdatedAt time.Time `json:"updated_at" example:"2020-01-01T00:00:00Z"`
}

type Document

type Document struct {
	ID          int       `json:"id" example:"1"`
	Name        string    `json:"name" gorm:"type:varchar(100)" example:"document name"`
	Description string    `json:"description" gorm:"type:varchar(255)" example:"Description of document"`
	Category    string    `json:"category" gorm:"type:varchar(100)" example:"sops"`
	URL         string    `json:"url" gorm:"type:varchar(255)" example:"https://www.example.com/document.pdf"`
	CreatedAt   time.Time `json:"created_at" example:"2020-01-01T00:00:00Z"`
	CreatedByID uint      `json:"created_by_id" example:"1"`
	CreatedBy   User      `json:"created_by"`
	UpdatedAt   time.Time `json:"updated_at" example:"2020-01-01T00:00:00Z"`
	UpdatedByID uint      `json:"updated_by_id" example:"1"`
	UpdatedBy   User      `json:"updated_by"`
}

type Event

type Event struct {
	ID          uint             `json:"id" gorm:"primaryKey"`
	Title       string           `json:"title"`
	Description string           `json:"description"`
	Banner      string           `json:"banner"`
	StartDate   time.Time        `json:"start_date"`
	EndDate     time.Time        `json:"end_date"`
	Positions   []*EventPosition `json:"positions"`
	Signups     []*EventSignup   `json:"signups"`
	CreatedAt   time.Time        `json:"created_at"`
	UpdatedAt   time.Time        `json:"updated_at"`
}

type EventPosition

type EventPosition struct {
	ID        uint      `json:"id"`
	EventID   uint      `json:"-" gorm:"index:event_position"`
	Event     Event     `json:"-" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	Position  string    `json:"position" gorm:"index:event_position"`
	UserID    *uint     `json:"-"`
	User      *User     `json:"user"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type EventSignup

type EventSignup struct {
	ID        uint      `json:"id" gorm:"primaryKey"`
	EventID   uint      `json:"-"`
	Event     Event     `json:"-" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	UserID    *uint     `json:"-"`
	User      *User     `json:"user"`
	Choice1   string    `json:"choice1" gorm:"type:varchar(25)"`
	Choice2   string    `json:"choice2" gorm:"type:varchar(25)"`
	Choice3   string    `json:"choice3" gorm:"type:varchar(25)"`
	Notes     string    `json:"notes" gorm:"type:text"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type Feedback

type Feedback struct {
	ID           int        `json:"id" gorm:"primaryKey"`
	SubmitterID  uint       `json:"-"`
	Submitter    *User      `json:"submitter"`
	ControllerID uint       `json:"-"`
	Controller   *User      `json:"controller"`
	Rating       string     `json:"rating" gorm:"type:varchar(20);not null"`
	Status       string     `json:"status" gorm:"type:varchar(20);not null"`
	Position     string     `json:"position" gorm:"type:varchar(20);not null"`
	Callsign     string     `json:"callsign" gorm:"type:varchar(20);not null"`
	Comments     string     `json:"comments" gorm:"type:text"`
	ContactEmail string     `json:"contact_email" gorm:"type:varchar(255)"`
	CreatedAt    *time.Time `json:"created_at"`
	UpdatedAt    *time.Time `json:"updated_at"`
}

type Flights

type Flights struct {
	ID          int       `json:"id" gorm:"primaryKey"`
	Callsign    string    `json:"callsign" gorm:"index;type:varchar(10)"`
	CID         int       `json:"cid" gorm:"index"`
	Facility    string    `json:"facility" gorm:"type:varchar(4)"`
	Latitude    float32   `json:"latitude" gorm:"type:float(10,8)"`
	Longitude   float32   `json:"longitude" gorm:"type:float(11,8)"`
	Groundspeed int       `json:"groundspeed"`
	Heading     int       `json:"heading"`
	Altitude    int       `json:"altitude"`
	Aircraft    string    `json:"aircraft" gorm:"type:varchar(10)"`
	Departure   string    `json:"departure" gorm:"type:varchar(4)"`
	Arrival     string    `json:"arrival" gorm:"type:varchar(4)"`
	Route       string    `json:"route" gorm:"type:text"`
	UpdateID    string    `json:"update_id" gorm:"type:varchar(36)"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

type OAuthClient

type OAuthClient struct {
	ID           uint   `json:"id" gorm:"primaryKey"`
	Name         string `json:"name" gorm:"primaryKey"`
	ClientID     string `json:"client_id" gorm:"type:varchar(128)"`
	ClientSecret string `json:"-" gorm:"type:varchar(255)"`   // Will only be presented on creation, should not be otherwise exposed and must be regenerated
	RedirectURIs string `json:"return_uris" gorm:"type:text"` // Stringified JSON array of redirect URIs, no wildcards permitted
	TTL          int    `json:"ttl" gorm:"type:int"`          // How long can a token live in seconds
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

func (*OAuthClient) ValidURI

func (c *OAuthClient) ValidURI(uri string) (bool, error)

type OAuthLogin

type OAuthLogin struct {
	ID                  uint        `json:"id" gorm:"primaryKey"`
	Token               string      `json:"token" gorm:"type:varchar(128)"`
	Code                string      `json:"code" gorm:"varchar(48)"`
	UserAgent           string      `json:"ua" gorm:"type:varchar(255)"`
	IP                  string      `json:"ip" gorm:"type:varchar(128)"`
	RedirectURI         string      `json:"url" gorm:"type:varchar(255)"`
	ClientID            uint        `json:"-"`
	Client              OAuthClient `json:"-"`
	State               string      `json:"state"`
	CodeChallenge       string      `json:"-"`
	CodeChallengeMethod string      `json:"-"`
	Scope               string      `json:"-"`
	Nonce               string      `json:"type:varchar(255)"`
	CID                 uint        `json:"cid"`
	ExpiresAt           time.Time
	CreatedAt           time.Time
	UpdatedAt           time.Time
}

type OAuthRefresh

type OAuthRefresh struct {
	ID        uint      `json:"id" gorm:"primaryKey"`
	Token     string    `json:"token" gorm:"type:varchar(128);index"`
	CID       uint      `json:"cid" gorm:"type:int;index"`
	ClientID  string    `json:"client_id" gorm:"type:varchar(128);index"`
	ExpiresAt time.Time `json:"expires_at" gorm:"type:datetime"`
	CreatedAt time.Time `json:"created_at" gorm:"type:datetime"`
	UpdatedAt time.Time `json:"updated_at" gorm:"type:datetime"`
}

type OnlineController

type OnlineController struct {
	ID        int       `json:"id" example:"1"`
	UserID    uint      `json:"cid" example:"1"`
	User      *User     `json:"user"`
	Position  string    `json:"position" example:"ANC_TWR" gorm:"index"`
	Frequency string    `json:"frequency" example:"118.000"`
	LogonTime time.Time `json:"logon_time" example:"2020-01-01T00:00:00Z"`
	UpdateID  string    `json:"update_id" example:"1"`
	CreatedAt time.Time `json:"created_at" example:"2020-01-01T00:00:00Z"`
	UpdatedAt time.Time `json:"updated_at" example:"2020-01-01T00:00:00Z"`
}

type Rating

type Rating struct {
	ID    int    `json:"id" example:"1"`
	Long  string `json:"long" gorm:"type:varchar(25)" example:"Observer"`
	Short string `json:"short" gorm:"type:varchar(3)" example:"OBS"`
}

type Role

type Role struct {
	ID        uint      `json:"id" gorm:"primaryKey" example:"1"`
	Name      string    `json:"name" gorm:"type:varchar(128);index" example:"wm"`
	Users     []*User   `json:"users" gorm:"many2many:user_roles"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type TrainingNote

type TrainingNote struct {
	ID           uint       `json:"id" gorm:"primaryKey"`
	ControllerID uint       `json:"controller_id"`
	Controller   *User      `json:"controller"`
	InstructorID uint       `json:"instructor_id"`
	Instructor   *User      `json:"instructor"`
	Position     string     `json:"position"`
	Type         string     `json:"type"`
	Comments     string     `json:"comments"`
	SessionDate  *time.Time `json:"session_date"`
	Duration     string     `json:"duration"`
	VATUSAID     uint       `json:"vatusa_id"`
	CreatedAt    time.Time  `json:"created_at"`
	UpdatedAt    time.Time  `json:"updated_at"`
}

type TrainingRequest

type TrainingRequest struct {
	ID              uuid.UUID              `json:"id" gorm:"primary_key;type:char(36);not null;unique_index"`
	Student         *User                  `json:"student" gorm:"foreignKey:StudentID"`
	StudentID       uint                   `json:"-" gorm:"not null"`
	Position        string                 `json:"position" gorm:"not null"`
	Status          string                 `json:"status" gorm:"not null"`
	Notes           string                 `json:"notes"`
	Instructor      *User                  `json:"instructor" gorm:"foreignKey:InstructorID"`
	InstructorID    *uint                  `json:"-" gorm:"default:null"`
	InstructorNotes string                 `json:"instructor_notes"`
	Slots           []*TrainingRequestSlot `json:"slots" gorm:"foreignKey:TrainingRequestID"`
	Start           *time.Time             `json:"start" gorm:"default:null"`
	End             *time.Time             `json:"end" gorm:"default:null"`
	CreatedAt       *time.Time             `json:"created_at"`
	UpdatedAt       *time.Time             `json:"updated_at"`
}

func (*TrainingRequest) BeforeCreate

func (t *TrainingRequest) BeforeCreate(tx *gorm.DB) (err error)

type TrainingRequestSlot

type TrainingRequestSlot struct {
	ID                uuid.UUID        `json:"id" gorm:"primary_key;type:char(36);not null;unique_index"`
	TrainingRequest   *TrainingRequest `json:"training_request" gorm:"foreignKey:TrainingRequestID;references:ID"`
	TrainingRequestID uuid.UUID        `json:"-" gorm:"not null"`
	Start             *time.Time       `json:"start" gorm:"not null"`
	End               *time.Time       `json:"end" gorm:"not null"`
	CreatedAt         *time.Time       `json:"created_at"`
	UpdatedAt         *time.Time       `json:"updated_at"`
}

func (*TrainingRequestSlot) BeforeCreate

func (t *TrainingRequestSlot) BeforeCreate(tx *gorm.DB) (err error)

type User

type User struct {
	CID               uint   `json:"cid" gorm:"primaryKey" example:"876594"`
	FirstName         string `json:"first_name" gorm:"type:varchar(128)" example:"Daniel"`
	LastName          string `json:"last_name" gorm:"type:varchar(128)" example:"Hawton"`
	Email             string `json:"email" gorm:"type:varchar(128)" example:"wm@denartcc.org"`
	OperatingInitials string `json:"operating_initials" gorm:"type:varchar(2)" example:"DH"`
	// Must be one of: none, active, inactive, loa
	ControllerType       string `json:"controllerType" gorm:"type:varchar(10)" example:"home"`
	ExemptedFromActivity bool   `json:"exemptedFromActivity" gorm:"default:false" example:"false"`
	RatingID             int    `json:"-"`
	Rating               Rating `json:"rating"`
	// Must be one of: none, active, inactive, loa
	Status    string  `json:"status" gorm:"type:varchar(10)" example:"active"`
	Roles     []*Role `json:"roles" gorm:"many2many:user_roles"`
	DiscordID string  `json:"discord_id" gorm:"type:varchar(128)" example:"123456789012345678"`
	Region    string  `json:"region" gorm:"type:varchar(10)" example:"AMAS"`
	Division  string  `json:"division" gorm:"type:varchar(10)" example:"USA"`
	// This may be blank
	Subdivision string `json:"subdivision" gorm:"type:varchar(10)" example:"ZDV"`
	// Internally used identifier during scheduled updates for removals
	UpdateID       string     `json:"updateid" gorm:"type:varchar(32)"`
	RosterJoinDate *time.Time `json:"roster_join_date" example:"2020-01-01T00:00:00Z"`
	CreatedAt      time.Time  `json:"created_at" example:"2020-01-01T00:00:00Z"`
	UpdatedAt      time.Time  `json:"updated_at" example:"2020-01-01T00:00:00Z"`
}

type UserCertification

type UserCertification struct {
	ID        uint      `json:"id"`
	CID       uint      `json:"cid" gorm:"index:idx_cid,index:idx_cid_certification"`
	Name      string    `json:"name" gorm:"index:idx_cid_certification"`
	Value     string    `json:"value"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type VisitorApplication

type VisitorApplication struct {
	ID        uint      `json:"id" example:"1"`
	UserID    uint      `json:"-" example:"1" gorm:"index"`
	User      *User     `json:"user"`
	CreatedAt time.Time `json:"created_at" example:"2020-01-01T00:00:00Z"`
	UpdatedAt time.Time `json:"updated_at" example:"2020-01-01T00:00:00Z"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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