models

package
v0.0.0-...-48f5382 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoMigrate

func AutoMigrate()

func DropTables

func DropTables()

func GenerateApiKey

func GenerateApiKey() (string, error)

func GetUserOIs

func GetUserOIs(cid uint, facility constants.FacilityID) (string, error)

func HasRole

func HasRole(user *User, role constants.RoleID) bool

func HasRoleAtFacility

func HasRoleAtFacility(user *User, role constants.RoleID, facility constants.FacilityID) bool

func HasRoleList

func HasRoleList(user *User, roles []constants.RoleID) bool

func IsValidFacility

func IsValidFacility(id constants.FacilityID) bool

func IsValidUser

func IsValidUser(cid uint) bool

Types

type ActionLogEntry

type ActionLogEntry struct {
	ID        uint      `json:"id" gorm:"primaryKey" example:"1"`
	CID       uint      `json:"cid" example:"1293257"`
	Entry     string    `json:"entry" example:"Changed Preferred OIs to RP"`
	CreatedAt time.Time `json:"created_at" example:"2021-01-01T00:00:00Z"`
	CreatedBy string    `json:"created_by" example:"'1234567' or 'System'"`
	UpdatedAt time.Time `json:"updated_at" example:"2021-01-01T00:00:00Z"`
	UpdatedBy string    `json:"updated_by" example:"'1234567' or 'System'"`
}

func GetAllActionLogEntries

func GetAllActionLogEntries() ([]ActionLogEntry, error)

func GetAllActionLogEntriesByCID

func GetAllActionLogEntriesByCID(cid uint) ([]ActionLogEntry, error)

func (*ActionLogEntry) Create

func (ale *ActionLogEntry) Create() error

func (*ActionLogEntry) Delete

func (ale *ActionLogEntry) Delete() error

func (*ActionLogEntry) Get

func (ale *ActionLogEntry) Get() error

func (*ActionLogEntry) Update

func (ale *ActionLogEntry) Update() error

type DisciplinaryLogEntry

type DisciplinaryLogEntry struct {
	ID         uint      `json:"id" gorm:"primaryKey" example:"1"`
	CID        uint      `json:"cid" example:"1293257"`
	Entry      string    `json:"entry" example:"Changed Preferred OIs to RP"`
	VATUSAOnly bool      `json:"vatusa_only" example:"true"`
	CreatedAt  time.Time `json:"created_at" example:"2021-01-01T00:00:00Z"`
	CreatedBy  string    `json:"created_by" example:"'1234567' or 'System'"`
	UpdatedAt  time.Time `json:"updated_at" example:"2021-01-01T00:00:00Z"`
	UpdatedBy  string    `json:"updated_by" example:"'1234567' or 'System'"`
}

func GetAllDisciplinaryLogEntries

func GetAllDisciplinaryLogEntries(VATUSAOnly bool) ([]DisciplinaryLogEntry, error)

func GetAllDisciplinaryLogEntriesByCID

func GetAllDisciplinaryLogEntriesByCID(cid uint, VATUSAOnly bool) ([]DisciplinaryLogEntry, error)

func (*DisciplinaryLogEntry) Create

func (dle *DisciplinaryLogEntry) Create() error

func (*DisciplinaryLogEntry) Delete

func (dle *DisciplinaryLogEntry) Delete() error

func (*DisciplinaryLogEntry) Get

func (dle *DisciplinaryLogEntry) Get() error

func (*DisciplinaryLogEntry) Update

func (dle *DisciplinaryLogEntry) Update() error

type Document

type Document struct {
	ID          uint                   `json:"id" gorm:"primaryKey" example:"1"`
	Facility    constants.FacilityID   `json:"facility" example:"ZDV"`
	Name        string                 `json:"name" example:"DP001"`
	Description string                 `json:"description" example:"General Division Policy"`
	Category    types.DocumentCategory `gorm:"type:enum('general', 'training', 'information_technology', 'sops', 'loas', 'misc');" json:"category" example:"general"`
	URL         string                 `json:"url" example:"https://zdvartcc.org"`
	CreatedAt   time.Time              `json:"created_at" example:"2021-01-01T00:00:00Z"`
	CreatedBy   uint                   `json:"created_by" example:"1293257"`
	UpdatedAt   time.Time              `json:"updated_at" example:"2021-01-01T00:00:00Z"`
	UpdatedBy   uint                   `json:"updated_by" example:"1293257"`
}

func GetAllDocuments

func GetAllDocuments() ([]Document, error)

func GetAllDocumentsByCategory

func GetAllDocumentsByCategory(category types.DocumentCategory) ([]Document, error)

func GetAllDocumentsByFacility

func GetAllDocumentsByFacility(facility constants.FacilityID) ([]Document, error)

func GetAllDocumentsByFacilityAndCategory

func GetAllDocumentsByFacilityAndCategory(facility constants.FacilityID, category types.DocumentCategory) ([]Document, error)

func (*Document) Create

func (d *Document) Create() error

func (*Document) Delete

func (d *Document) Delete() error

func (*Document) Get

func (d *Document) Get() error

func (*Document) Update

func (d *Document) Update() error

type Event

type Event struct {
	ID uint `json:"id" gorm:"primaryKey" example:"1"`

	Title       string    `json:"title" gorm:"not null" example:"ZDV FNO"`
	Description string    `json:"description" gorm:"not null" example:"Join us for a fun night of flying in and out of Denver!"`
	BannerURL   string    `json:"banner_url" example:"https://zdvartcc.org/banner.jpg"`
	StartDate   time.Time `json:"start_date" gorm:"not null" example:"2021-01-01T00:00:00Z"`
	EndDate     time.Time `json:"end_date" gorm:"not null" example:"2021-01-01T00:00:00Z"`

	Fields     []string               `json:"fields" gorm:"serializer:json" example:"[\"KDEN\", \"KBJC\", \"KAPA\"]"`
	Facilities []constants.FacilityID `json:"facilities" gorm:"serializer:json" example:"[\"ZDV\", \"ZAB\", \"ZLC\"]"`

	Positions []EventPosition `json:"positions" gorm:"foreignKey:EventID"`
	Routing   []EventRouting  `json:"routing" gorm:"foreignKey:EventID"`

	CreatedAt time.Time `json:"created_at" example:"2021-01-01T00:00:00Z"`
	UpdatedAt time.Time `json:"updated_at" example:"2021-01-01T00:00:00Z"`
}

func GetEventsFiltered

func GetEventsFiltered(page, pageSize int, facilityID constants.FacilityID, afterDate time.Time) ([]Event, error)

func GetPreviousEvents

func GetPreviousEvents(limit int, facilityID constants.FacilityID) ([]Event, error)

func (*Event) Create

func (e *Event) Create() error

func (*Event) Delete

func (e *Event) Delete() error

func (*Event) Get

func (e *Event) Get() error

func (*Event) Update

func (e *Event) Update() error

type EventPosition

type EventPosition struct {
	ID      uint `json:"id" gorm:"primaryKey" example:"1"`
	EventID uint `json:"event_id" gorm:"not null" example:"1"`

	Facility          constants.FacilityID `json:"facility" example:"ZDV"`
	Position          string               `json:"position" gorm:"not null" example:"ZDV_APP"`
	Assignee          uint                 `json:"assignee" example:"1293257"`
	Shifts            bool                 `json:"shifts" gorm:"not null;default:false" example:"true"`
	SecondaryAssignee uint                 `json:"secondary_assignee" example:"1293257"`

	Signups []EventSignup `json:"signups" gorm:"foreignKey:PositionID"`

	CreatedAt time.Time `json:"created_at" example:"2021-01-01T00:00:00Z"`
	UpdatedAt time.Time `json:"updated_at" example:"2021-01-01T00:00:00Z"`
}

func GetEventPositionsFiltered

func GetEventPositionsFiltered(eventId uint, facilityID constants.FacilityID) ([]EventPosition, error)

func (*EventPosition) Create

func (ep *EventPosition) Create() error

func (*EventPosition) Delete

func (ep *EventPosition) Delete() error

func (*EventPosition) Get

func (ep *EventPosition) Get() error

func (*EventPosition) Update

func (ep *EventPosition) Update() error

type EventRouting

type EventRouting struct {
	ID      uint `json:"id" gorm:"primaryKey" example:"1"`
	EventID uint `json:"event_id" gorm:"not null" example:"1"`

	Origin      string `json:"origin" example:"KLAX"`
	Destination string `json:"destination" example:"KDEN"`
	Routing     string `json:"routing" example:"DCT"`
	Notes       string `json:"notes" example:"JETS ONLY"`

	CreatedAt time.Time `json:"created_at" example:"2021-01-01T00:00:00Z"`
	UpdatedAt time.Time `json:"updated_at" example:"2021-01-01T00:00:00Z"`
}

func GetEventRoutingFiltered

func GetEventRoutingFiltered(eventID uint) ([]EventRouting, error)

func (*EventRouting) Create

func (er *EventRouting) Create() error

func (*EventRouting) Delete

func (er *EventRouting) Delete() error

func (*EventRouting) Get

func (er *EventRouting) Get() error

func (*EventRouting) Update

func (er *EventRouting) Update() error

type EventSignup

type EventSignup struct {
	ID      uint `json:"id" gorm:"primaryKey" example:"1"`
	EventID uint `json:"event_id" gorm:"not null" example:"1"`

	PositionID uint   `json:"position_id" gorm:"not null" example:"1"`
	CID        uint   `json:"cid" gorm:"not null" example:"1293257"`
	Name       string `json:"name" gorm:"-"`
	Shift      uint   `json:"shift" gorm:"not null;default:1" example:"1"` // 1 = Primary, 2 = Secondary

	CreatedAt time.Time `json:"created_at" example:"2021-01-01T00:00:00Z"`
	UpdatedAt time.Time `json:"updated_at" example:"2021-01-01T00:00:00Z"`
}

func GetEventSignupFiltered

func GetEventSignupFiltered(eventID uint) ([]EventSignup, error)

func (*EventSignup) Create

func (es *EventSignup) Create() error

func (*EventSignup) Delete

func (es *EventSignup) Delete() error

func (*EventSignup) Get

func (es *EventSignup) Get() error

func (*EventSignup) Update

func (es *EventSignup) Update() error

type EventTemplate

type EventTemplate struct {
	ID uint `json:"id" gorm:"primaryKey" example:"1"`

	Title      string                 `json:"title" gorm:"not null" example:"KDEN FNO Template"`
	Positions  []string               `json:"positions" gorm:"serializer:json" example:"[\"ZDV_APP\", \"ZDV_TWR\"]"`
	Facilities []constants.FacilityID `json:"facilities" gorm:"serializer:json" example:"[\"ZDV\", \"ZAB\", \"ZLC\"]"`
	Fields     []string               `json:"fields" gorm:"serializer:json" example:"[\"KDEN\", \"KBJC\", \"KAPA\"]"`
	Shifts     bool                   `json:"shifts" gorm:"not null;default:false" example:"true"`

	CreatedAt time.Time `json:"created_at" example:"2021-01-01T00:00:00Z"`
	UpdatedAt time.Time `json:"updated_at" example:"2021-01-01T00:00:00Z"`
}

func GetEventTemplatesFiltered

func GetEventTemplatesFiltered(facility constants.FacilityID) ([]EventTemplate, error)

func (*EventTemplate) Create

func (et *EventTemplate) Create() error

func (*EventTemplate) Delete

func (et *EventTemplate) Delete() error

func (*EventTemplate) Get

func (et *EventTemplate) Get() error

func (*EventTemplate) Update

func (et *EventTemplate) Update() error

type FAQ

type FAQ struct {
	ID        uint                 `json:"id" gorm:"primaryKey" example:"1"`
	Facility  constants.FacilityID `json:"facility" example:"ZDV"`
	Question  string               `json:"question" example:"Why shouldn't I join ZDV?'"`
	Answer    string               `json:"answer" example:"There are no reasons not to join ZDV!"`
	Category  string               `gorm:"type:enum('membership', 'training', 'technology', 'misc');" json:"category" example:"membership"`
	CreatedAt time.Time            `json:"created_at" example:"2021-01-01T00:00:00Z"`
	CreatedBy uint                 `json:"created_by" example:"1293257"`
	UpdatedAt time.Time            `json:"updated_at" example:"2021-01-01T00:00:00Z"`
	UpdatedBy uint                 `json:"updated_by" example:"1293257"`
}

func GetAllFAQ

func GetAllFAQ() ([]FAQ, error)

func GetAllFAQByCategory

func GetAllFAQByCategory(category string) ([]FAQ, error)

func GetAllFAQByFacility

func GetAllFAQByFacility(facility constants.FacilityID) ([]FAQ, error)

func (*FAQ) Create

func (f *FAQ) Create() error

func (*FAQ) Delete

func (f *FAQ) Delete() error

func (*FAQ) Get

func (f *FAQ) Get() error

func (*FAQ) Update

func (f *FAQ) Update() error

type Facility

type Facility struct {
	ID               constants.FacilityID `json:"id" gorm:"size:3;primaryKey" example:"ZDV"`
	Name             string               `json:"name" example:"Denver ARTCC"`
	About            string               `json:"about" example:"Denver ARTCC contains ZDV... etc. etc. etc."`
	URL              string               `json:"url" example:"https://zdvartcc.org"`
	APIKey           string               `json:"api_key" example:"1234567890"`
	WebhookURL       string               `json:"webhook_url" example:""`
	FacilityLogEntry []FacilityLogEntry   `json:"-" gorm:"foreignKey:Facility"`
	FAQ              []FAQ                `json:"-" gorm:"foreignKey:Facility"`
	Document         []Document           `json:"-" gorm:"foreignKey:Facility"`
	CreatedAt        time.Time            `json:"created_at" example:"2021-01-01T00:00:00Z"`
	UpdatedAt        time.Time            `json:"updated_at" example:"2021-01-01T00:00:00Z"`
}

func GetAllFacilities

func GetAllFacilities() ([]Facility, error)

func GetFacilityByAPIKey

func GetFacilityByAPIKey(key string) (*Facility, error)

func (*Facility) Create

func (f *Facility) Create() error

func (*Facility) Delete

func (f *Facility) Delete() error

func (*Facility) Get

func (f *Facility) Get() error

func (*Facility) StripSensitive

func (f *Facility) StripSensitive()

func (*Facility) Update

func (f *Facility) Update() error

type FacilityLogEntry

type FacilityLogEntry struct {
	ID        uint                 `json:"id" gorm:"primaryKey" example:"1"`
	Facility  constants.FacilityID `json:"facility" example:"ZDV"`
	Entry     string               `json:"entry" example:"Change URL from 'denartcc.org' to 'zdvartcc.org'"`
	CreatedAt time.Time            `json:"created_at" example:"2021-01-01T00:00:00Z"`
	CreatedBy string               `json:"created_by" example:"'1234567' or 'System'"`
	UpdatedAt time.Time            `json:"updated_at" example:"2021-01-01T00:00:00Z"`
	UpdatedBy string               `json:"updated_by" example:"'1234567' or 'System'"`
}

func GetAllFacilityLogEntries

func GetAllFacilityLogEntries() ([]FacilityLogEntry, error)

func GetAllFacilityLogEntriesByFacility

func GetAllFacilityLogEntriesByFacility(facility constants.FacilityID) ([]FacilityLogEntry, error)

func (*FacilityLogEntry) Create

func (fle *FacilityLogEntry) Create() error

func (*FacilityLogEntry) Delete

func (fle *FacilityLogEntry) Delete() error

func (*FacilityLogEntry) Get

func (fle *FacilityLogEntry) Get() error

func (*FacilityLogEntry) Update

func (fle *FacilityLogEntry) Update() error

type Feedback

type Feedback struct {
	ID            uint                 `json:"id" gorm:"primaryKey" example:"1"`
	PilotCID      uint                 `json:"pilot_cid" gorm:"column:pilot_cid" example:"1293257"`
	Pilot         User                 `json:"pilot" gorm:"foreignKey:PilotCID;references:CID"`
	Callsign      string               `json:"callsign" example:"DAL123"`
	ControllerCID uint                 `json:"controller_cid" gorm:"column:controller_cid" example:"1293257"`
	Controller    User                 `json:"controller" gorm:"foreignKey:ControllerCID;references:CID"`
	Position      string               `json:"position" example:"DEN_I_APP"`
	Facility      constants.FacilityID `json:"facility" example:"ZDV"`
	Rating        types.FeedbackRating `json:"rating" gorm:"type:enum('unsatisfactory', 'poor', 'fair', 'good', 'excellent');" example:"good"`
	Feedback      string               `json:"feedback" example:"Raaj was the best controller I've ever flown under."`
	Status        types.StatusType     `json:"status" gorm:"type:enum('pending', 'accepted', 'rejected');" example:"pending"`
	Comment       string               `json:"comment" example:"Great work Raaj!"`
	CreatedAt     time.Time            `json:"created_at" example:"2021-01-01T00:00:00Z"`
	UpdatedAt     time.Time            `json:"updated_at" example:"2021-01-01T00:00:00Z"`
}

func GetAllFeedback

func GetAllFeedback(status types.StatusType) ([]Feedback, error)

func GetFeedbackByCID

func GetFeedbackByCID(cid uint, status types.StatusType) ([]Feedback, error)

func GetFeedbackByFacility

func GetFeedbackByFacility(facility constants.FacilityID, status types.StatusType) ([]Feedback, error)

func GetFeedbackByFacilityAndCID

func GetFeedbackByFacilityAndCID(facility constants.FacilityID, controllerCID uint, status types.StatusType) ([]Feedback, error)

func (*Feedback) Create

func (f *Feedback) Create() error

func (*Feedback) Delete

func (f *Feedback) Delete() error

func (*Feedback) Get

func (f *Feedback) Get() error

func (*Feedback) Update

func (f *Feedback) Update() error

type News

type News struct {
	ID          uint                 `json:"id" gorm:"primaryKey" example:"1"`
	Facility    constants.FacilityID `json:"facility" example:"ZDV"`
	Title       string               `json:"news" example:"DP001 Revision 3 Released"`
	Description string               `json:"answer" example:"DP001 has been revised to include new information regarding the new VATSIM Code of Conduct"`
	CreatedAt   time.Time            `json:"created_at" example:"2021-01-01T00:00:00Z"`
	CreatedBy   string               `json:"created_by" example:"'1293257' or 'System'"`
	UpdatedAt   time.Time            `json:"updated_at" example:"2021-01-01T00:00:00Z"`
	UpdatedBy   string               `json:"updated_by" example:"1293257"`
}

func GetAllNews

func GetAllNews() ([]News, error)

func GetNewsByFacility

func GetNewsByFacility(facility constants.FacilityID) ([]News, error)

func (*News) Create

func (n *News) Create() error

func (*News) Delete

func (n *News) Delete() error

func (*News) Get

func (n *News) Get() error

func (*News) Update

func (n *News) Update() error

type Notification

type Notification struct {
	ID        uint      `json:"id" gorm:"primaryKey" example:"1"`
	CID       uint      `json:"cid" example:"1293257"`
	Category  string    `json:"category" example:"Training"`
	Title     string    `json:"title" example:"Upcoming Training Session"`
	Body      string    `json:"body" example:"You have a training session coming up."`
	ExpireAt  time.Time `json:"expire_at" example:"2021-01-01T00:00:00Z"`
	CreatedAt time.Time `json:"created_at" example:"2021-01-01T00:00:00Z"`
	UpdatedAt time.Time `json:"updated_at" example:"2021-01-01T00:00:00Z"`
}

func GetAllActiveNotificationsByCID

func GetAllActiveNotificationsByCID(cid uint) ([]Notification, error)

func GetAllNotifications

func GetAllNotifications() ([]Notification, error)

func (*Notification) Create

func (n *Notification) Create() error

func (*Notification) Delete

func (n *Notification) Delete() error

func (*Notification) Get

func (n *Notification) Get() error

func (*Notification) Update

func (n *Notification) Update() error

type RatingChange

type RatingChange struct {
	ID           uint                `json:"id" gorm:"primaryKey" example:"1"`
	CID          uint                `json:"cid" example:"1293257"`
	OldRating    constants.ATCRating `json:"old_rating" example:"1"`
	NewRating    constants.ATCRating `json:"new_rating" example:"2"`
	CreatedAt    time.Time           `json:"created_at" example:"2021-01-01T00:00:00Z"`
	CreatedByCID uint                `json:"created_by_cid" example:"1293257"`
	UpdatedAt    time.Time           `json:"updated_at" example:"2021-01-01T00:00:00Z"`
}

func GetAllRatingChanges

func GetAllRatingChanges() ([]RatingChange, error)

func GetAllRatingChangesByCID

func GetAllRatingChangesByCID(cid uint) ([]RatingChange, error)

func (*RatingChange) Create

func (rc *RatingChange) Create() error

func (*RatingChange) Delete

func (rc *RatingChange) Delete() error

func (*RatingChange) Get

func (rc *RatingChange) Get() error

func (*RatingChange) Update

func (rc *RatingChange) Update() error

type Roster

type Roster struct {
	ID        uint                 `json:"id" gorm:"primaryKey" example:"1"`
	CID       uint                 `json:"cid" example:"1293257"`
	Facility  constants.FacilityID `json:"facility" example:"ZDV"`
	OIs       string               `json:"operating_initials" gorm:"column:ois" example:"RP"`
	Home      bool                 `json:"home" example:"true"`
	Visiting  bool                 `json:"visiting" example:"false"`
	Status    string               `json:"status" example:"Active"` // Active, LOA
	Roles     []UserRole           `json:"roles" gorm:"foreignKey:RosterID"`
	CreatedAt time.Time            `json:"created_at" example:"2021-01-01T00:00:00Z"`
	UpdatedAt time.Time            `json:"updated_at" example:"2021-01-01T00:00:00Z"`
	DeletedAt gorm.DeletedAt       `json:"deleted_at" example:"2021-01-01T00:00:00Z"` // Soft Deletes for logging
}

func GetRosterByFacilityAndCID

func GetRosterByFacilityAndCID(facility constants.FacilityID, cid uint) (Roster, error)

func GetRosters

func GetRosters() ([]Roster, error)

func GetRostersByCID

func GetRostersByCID(cid uint) ([]Roster, error)

func GetRostersByFacility

func GetRostersByFacility(facility constants.FacilityID) ([]Roster, error)

func GetRostersByFacilityAndType

func GetRostersByFacilityAndType(facility constants.FacilityID, rosterType string) ([]Roster, error)

func (*Roster) BeforeCreate

func (r *Roster) BeforeCreate(tx *gorm.DB) error

func (*Roster) Create

func (r *Roster) Create() error

func (*Roster) Delete

func (r *Roster) Delete() error

func (*Roster) Get

func (r *Roster) Get() error

func (*Roster) Update

func (r *Roster) Update() error

type RosterRequest

type RosterRequest struct {
	ID          uint                 `json:"id" gorm:"primaryKey" example:"1"`
	CID         uint                 `json:"cid" example:"1293257"`
	Facility    constants.FacilityID `json:"-" example:"ZDV"`
	RequestType types.RequestType    `json:"request_type" gorm:"type:enum('visiting', 'transferring');"`
	Status      types.StatusType     `json:"status" gorm:"type:enum('pending', 'accepted', 'rejected');"`
	Reason      string               `json:"reason" example:"I want to transfer to ZDV"`
	CreatedAt   time.Time            `json:"created_at" example:"2021-01-01T00:00:00Z"`
	UpdatedAt   time.Time            `json:"updated_at" example:"2021-01-01T00:00:00Z"`
}

func GetAllRosterRequests

func GetAllRosterRequests() ([]RosterRequest, error)

func GetAllRosterRequestsByCID

func GetAllRosterRequestsByCID(cid uint) ([]RosterRequest, error)

func GetAllRosterRequestsByFacility

func GetAllRosterRequestsByFacility(facility constants.FacilityID) ([]RosterRequest, error)

func GetRosterRequestsByStatus

func GetRosterRequestsByStatus(facility constants.FacilityID, status types.StatusType) ([]RosterRequest, error)

func GetRosterRequestsByType

func GetRosterRequestsByType(facility constants.FacilityID, reqType types.RequestType) ([]RosterRequest, error)

func GetRosterRequestsByTypeAndStatus

func GetRosterRequestsByTypeAndStatus(facility constants.FacilityID, reqType types.RequestType, status types.StatusType) ([]RosterRequest, error)

func (*RosterRequest) Create

func (rr *RosterRequest) Create() error

func (*RosterRequest) Delete

func (rr *RosterRequest) Delete() error

func (*RosterRequest) Get

func (rr *RosterRequest) Get() error

func (*RosterRequest) Update

func (rr *RosterRequest) Update() error

type User

type User struct {
	CID                  uint                   `gorm:"primaryKey" json:"cid" example:"1293257"`
	FirstName            string                 `json:"first_name" example:"Raaj" gorm:"index:idx_first_name"`
	LastName             string                 `json:"last_name" example:"Patel" gorm:"index:idx_last_name"`
	PreferredName        string                 `json:"preferred_name" example:"Raaj" gorm:"index:idx_pref_name"`
	PrefNameEnabled      bool                   `json:"pref_name_enabled" example:"true"`
	Email                string                 `json:"email" example:"vatusa6@vatusa.net"`
	PreferredOIs         string                 `json:"preferred_ois" gorm:"column:preferred_ois" example:"RP"`
	PilotRating          constants.PilotRating  `json:"pilot_rating" example:"1"`
	ControllerRating     constants.ATCRating    `json:"controller_rating" example:"1"`
	DiscordID            string                 `json:"discord_id" example:"1234567890"`
	LastLogin            time.Time              `json:"last_login" example:"2021-01-01T00:00:00Z"`
	LastCertSync         time.Time              `json:"last_cert_sync" example:"2021-01-01T00:00:00Z"`
	Flags                UserFlag               `json:"flags" gorm:"foreignKey:CID"`
	RatingChanges        []RatingChange         `json:"-" gorm:"foreignKey:CID"`
	RosterRequest        []RosterRequest        `json:"-" gorm:"foreignKey:CID"`
	Roster               []Roster               `json:"-" gorm:"foreignKey:CID"`
	Notifications        []Notification         `json:"-" gorm:"foreignKey:CID"`
	Feedback             []Feedback             `json:"-" gorm:"foreignKey:ControllerCID"`
	ActionLogEntry       []ActionLogEntry       `json:"-" gorm:"foreignKey:CID"`
	DisciplinaryLogEntry []DisciplinaryLogEntry `json:"-" gorm:"foreignKey:CID"`
	CreatedAt            time.Time              `json:"created_at" example:"2021-01-01T00:00:00Z"`
	UpdatedAt            time.Time              `json:"updated_at" example:"2021-01-01T00:00:00Z"`
}

func GetAllUsers

func GetAllUsers() ([]User, error)

func SearchUsersByName

func SearchUsersByName(query string) ([]User, error)

func (*User) Create

func (un *User) Create() error

func (*User) Delete

func (un *User) Delete() error

func (*User) Get

func (un *User) Get() error

func (*User) Update

func (un *User) Update() error

type UserFlag

type UserFlag struct {
	CID                      uint      `json:"cid" gorm:"primaryKey" example:"1293257"`
	NoStaffRole              bool      `json:"no_staff_role" gorm:"not null,default:false" example:"false"`
	NoStaffLogEntryID        uint      `json:"no_staff_log_entry_id" example:"1"`
	NoVisiting               bool      `json:"no_visiting" gorm:"not null,default:false" example:"false"`
	NoVisitingLogEntryID     uint      `json:"no_visiting_log_entry_id" example:"1"`
	NoTransferring           bool      `json:"no_transferring" gorm:"not null,default:false" example:"false"`
	NoTransferringLogEntryID uint      `json:"no_transferring_log_entry_id" example:"1"`
	NoTraining               bool      `json:"no_training" gorm:"not null,default:false" example:"false"`
	NoTrainingLogEntryID     uint      `json:"no_training_log_entry_id" example:"1"`
	UsedTransferOverride     bool      `json:"used_transfer_override" gorm:"not null,default:false" example:"false"`
	CreatedAt                time.Time `json:"created_at" example:"2021-01-01T00:00:00Z"`
	UpdatedAt                time.Time `json:"updated_at" example:"2021-01-01T00:00:00Z"`
}

func GetAllFlags

func GetAllFlags() ([]UserFlag, error)

func (*UserFlag) Create

func (f *UserFlag) Create() error

func (*UserFlag) Delete

func (f *UserFlag) Delete() error

func (*UserFlag) Get

func (f *UserFlag) Get() error

func (*UserFlag) Update

func (f *UserFlag) Update() error

type UserNotification

type UserNotification struct {
	CID            uint      `gorm:"primaryKey" json:"cid" example:"1293257"`
	DiscordEnabled bool      `json:"discord" example:"true"`
	EmailEnabled   bool      `json:"email" example:"true"`
	Events         bool      `json:"events" example:"true"`
	Training       bool      `json:"training" example:"true"`
	Feedback       bool      `json:"feedback" example:"true"`
	CreatedAt      time.Time `json:"created_at" example:"2021-01-01T00:00:00Z"`
	UpdatedAt      time.Time `json:"updated_at" example:"2021-01-01T00:00:00Z"`
}

func (*UserNotification) Create

func (un *UserNotification) Create() error

func (*UserNotification) Delete

func (un *UserNotification) Delete() error

func (*UserNotification) Get

func (un *UserNotification) Get() error

func (*UserNotification) Update

func (un *UserNotification) Update() error

type UserRole

type UserRole struct {
	ID         uint                 `json:"id" gorm:"primaryKey" example:"1"`
	CID        uint                 `json:"cid" example:"1293257"`
	RoleID     constants.RoleID     `json:"role" gorm:"type:varchar(10)" example:"ATM"`
	FacilityID constants.FacilityID `json:"facility_id" example:"ZDV"`
	RosterID   uint                 `json:"roster_id" example:"1"`
	CreatedAt  time.Time            `json:"created_at" example:"2021-01-01T00:00:00Z"`
	UpdatedAt  time.Time            `json:"updated_at" example:"2021-01-01T00:00:00Z"`
}

func GetAllUserRoles

func GetAllUserRoles() ([]UserRole, error)

func GetAllUserRolesByCID

func GetAllUserRolesByCID(cid uint) ([]UserRole, error)

func GetAllUserRolesByFacilityID

func GetAllUserRolesByFacilityID(facilityID string) ([]UserRole, error)

func GetAllUserRolesByRoleID

func GetAllUserRolesByRoleID(roleID string) ([]UserRole, error)

func (*UserRole) Create

func (ur *UserRole) Create() error

func (*UserRole) Delete

func (ur *UserRole) Delete() error

func (*UserRole) Get

func (ur *UserRole) Get() error

func (*UserRole) Update

func (ur *UserRole) Update() error

Jump to

Keyboard shortcuts

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