dto

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: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrInvalidOperatingInitials = "invalid operating initials"
	ErrInvalidControllerType    = "invalid controller type"
	ErrInvalidCertification     = "invalid certification"
	ErrInvalidRating            = "invalid rating"
	ErrInvalidStatus            = "invalid status"
)

Variables

This section is empty.

Functions

func PatchEventRequest

func PatchEventRequest(base *models.Event, patch EventRequest) *models.Event

func PatchUserFromUserResponse

func PatchUserFromUserResponse(user *models.User, userResponse UserResponseAdmin) []string

Types

type AirportWeatherDTO

type AirportWeatherDTO struct {
	ID    string `json:"id"`
	METAR string `json:"metar"`
	TAF   string `json:"taf"`
}

type ControllerStats

type ControllerStats struct {
	CID               uint    `json:"cid" example:"1"`
	FirstName         string  `json:"first_name" example:"Daniel"`
	LastName          string  `json:"last_name" example:"Hawton"`
	OperatingInitials string  `json:"operating_initials" example:"DAN"`
	ControllerType    string  `json:"controllerType" example:"home"`
	Rating            string  `json:"rating" example:"S1"`
	Cab               float32 `json:"cab" example:"0.5"`
	Terminal          float32 `json:"terminal" example:"0.5"`
	Enroute           float32 `json:"enroute" example:"0.5"`
}

func GetDTOForUserAndMonth

func GetDTOForUserAndMonth(user *models.User, month int, year int) (*ControllerStats, error)

type EmailTemplateRequest

type EmailTemplateRequest struct {
	Subject   string `json:"subject" binding:"required"`
	Body      string `json:"body" binding:"required"`
	EditGroup string `json:"edit_group" binding:"required"`
	CC        string `json:"cc"`
}

type EventPositionRequest

type EventPositionRequest struct {
	Position string `json:"position"`
	UserID   uint   `json:"cid"`
}

type EventPositionResponse

type EventPositionResponse struct {
	ID       uint          `json:"id"`
	Position string        `json:"position"`
	UserID   *uint         `json:"cid"`
	User     *UserResponse `json:"user"`
}

func ConvEventPositionToEventPositionResponse

func ConvEventPositionToEventPositionResponse(position *models.EventPosition) *EventPositionResponse

func ConvEventPositionsToEventPositionResponse

func ConvEventPositionsToEventPositionResponse(positions []*models.EventPosition) []*EventPositionResponse

type EventRequest

type EventRequest struct {
	Title       string     `json:"title"`
	Description string     `json:"description"`
	Banner      string     `json:"banner"`
	StartDate   *time.Time `json:"start_date"`
	EndDate     *time.Time `json:"end_date"`
}

type EventSignupRequest

type EventSignupRequest struct {
	Choice1 string `json:"choice1"`
	Choice2 string `json:"choice2"`
	Choice3 string `json:"choice3"`
	Notes   string `json:"notes"`
}

type EventSignupResponse

type EventSignupResponse struct {
	ID      uint          `json:"id"`
	Choice1 string        `json:"choice1"`
	Choice2 string        `json:"choice2"`
	Choice3 string        `json:"choice3"`
	Notes   string        `json:"notes"`
	UserID  *uint         `json:"cid"`
	User    *UserResponse `json:"user"`
}

func ConvEventSignupToEventSignupResponse

func ConvEventSignupToEventSignupResponse(signup *models.EventSignup) *EventSignupResponse

func ConvEventSignupsToEventSignupResponse

func ConvEventSignupsToEventSignupResponse(signups []*models.EventSignup) []*EventSignupResponse

type EventsResponse

type EventsResponse struct {
	ID          uint                     `json:"id"`
	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   []*EventPositionResponse `json:"positions"`
	Signups     []*EventSignupResponse   `json:"signups"`
	CreatedAt   time.Time                `json:"created_at"`
	UpdatedAt   time.Time                `json:"updated_at"`
}

func ConvEventToEventsResponse

func ConvEventToEventsResponse(event *models.Event) *EventsResponse

func ConvEventsToEventsResponse

func ConvEventsToEventsResponse(events []*models.Event) []*EventsResponse

type FacilityReportDTO

type FacilityReportDTO struct {
	Position  string
	Duration  int
	LogonTime *time.Time `json:"logon_time"`
}

func ConvertControllerStatsToFacilityReport

func ConvertControllerStatsToFacilityReport(stats []*models.ControllerStat) []*FacilityReportDTO

type FacilityStaffResponse

type FacilityStaffResponse struct {
	ATM        []*UserResponse `json:"atm" yaml:"atm" xml:"atm"`
	DATM       []*UserResponse `json:"datm" yaml:"datm" xml:"datm"`
	TA         []*UserResponse `json:"ta" yaml:"ta" xml:"ta"`
	EC         []*UserResponse `json:"ec" yaml:"ec" xml:"ec"`
	FE         []*UserResponse `json:"fe" yaml:"fe" xml:"fe"`
	WM         []*UserResponse `json:"wm" yaml:"wm" xml:"wm"`
	Events     []*UserResponse `json:"events" yaml:"events" xml:"events"`
	Facilities []*UserResponse `json:"facilities" yaml:"facilities" xml:"facilities"`
	Web        []*UserResponse `json:"web" yaml:"web" xml:"web"`
	Instructor []*UserResponse `json:"instructor" yaml:"instructor" xml:"instructor"`
	Mentor     []*UserResponse `json:"mentor" yaml:"mentor" xml:"mentor"`
}

func GetStaffResponse

func GetStaffResponse() (*FacilityStaffResponse, error)

type FeedbackPatchRequest

type FeedbackPatchRequest struct {
	Comments string `json:"comments"`
	Status   string `json:"status"`
}

type FeedbackRequest

type FeedbackRequest struct {
	Controller string `json:"controller" binding:"required"`
	Callsign   string `json:"callsign" binding:"required"`
	Position   string `json:"position" binding:"required"`
	Rating     string `json:"rating" binding:"required"`
	Comments   string `json:"comments" binding:"required"`
}

type FeedbackResponse

type FeedbackResponse struct {
	ID           int           `json:"id"`
	Submitter    *UserResponse `json:"submitter"`
	Controller   *UserResponse `json:"controller"`
	Rating       string        `json:"rating"`
	Status       string        `json:"status"`
	Position     string        `json:"position"`
	Callsign     string        `json:"callsign"`
	Comments     string        `json:"comments"`
	ContactEmail string        `json:"contact_email"`
	CreatedAt    *time.Time    `json:"created_at"`
}

func ConvertFeedbacktoResponse

func ConvertFeedbacktoResponse(feedback []*models.Feedback, includeEmail bool) []FeedbackResponse

func ConvertSingleFeedbacktoResponse

func ConvertSingleFeedbacktoResponse(feedback *models.Feedback, includeEmail bool) *FeedbackResponse

type OnlineController

type OnlineController struct {
	CID         uint          `json:"cid" example:"1"`
	Controller  *UserResponse `json:"controller"`
	Position    string        `json:"position" example:"ANC_00_CTR"`
	Frequency   string        `json:"frequency" example:"118.000"`
	OnlineSince string        `json:"online_since" example:"2020-01-01T00:00:00Z"`
}

func ConvertOnlineToDTO

func ConvertOnlineToDTO(online *models.OnlineController) *OnlineController

func ConvertOnlineToDTOs

func ConvertOnlineToDTOs(online []models.OnlineController) []OnlineController

type StaffingRequest

type StaffingRequest struct {
	DepartureAirport string `json:"departureAirport" binding:"required"`
	ArrivalAirport   string `json:"arrivalAirport" binding:"required"`
	StartDate        string `json:"startDate" binding:"required"`
	EndDate          string `json:"endDate" binding:"required"`
	Pilots           int    `json:"pilots" binding:"required"`
	ContactInfo      string `json:"contactInfo" binding:"required"`
	Organization     string `json:"organization"`
	BannerURL        string `json:"bannerUrl"`
	Comments         string `json:"comments"`
}

type StorageRequest

type StorageRequest struct {
	Category    string `json:"category"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

type TrainingNoteRequest

type TrainingNoteRequest struct {
	Position    string    `json:"position"`
	Type        string    `json:"type"`
	Comments    string    `json:"comments"`
	Duration    string    `json:"duration"`
	SessionDate time.Time `json:"session_date"`
}

type TrainingRequest

type TrainingRequest struct {
	ID              string                 `json:"id"`
	Student         *UserResponse          `json:"student"`
	Instructor      *UserResponse          `json:"instructor"`
	Position        string                 `json:"position"`
	Status          string                 `json:"status"`
	Notes           string                 `json:"notes"`
	InstructorNotes string                 `json:"instructor_notes"`
	Start           *time.Time             `json:"start"`
	End             *time.Time             `json:"end"`
	Slots           []*TrainingRequestSlot `json:"slots"`
	CreatedAt       *time.Time             `json:"created_at"`
	UpdatedAt       *time.Time             `json:"updated_at"`
}

func ConvertTrainingRequestToDTO

func ConvertTrainingRequestToDTO(t *models.TrainingRequest) *TrainingRequest

func ConvertTrainingRequestsToDTO

func ConvertTrainingRequestsToDTO(t []*models.TrainingRequest) []*TrainingRequest

type TrainingRequestCreateRequest

type TrainingRequestCreateRequest struct {
	Position string                 `json:"position"`
	Notes    string                 `json:"notes"`
	Slots    []*TrainingRequestSlot `json:"slots"`
}

type TrainingRequestEditRequest

type TrainingRequestEditRequest struct {
	Position        string `json:"position"`
	Notes           string `json:"notes"`
	Status          string `json:"status"`
	InstructorNotes string `json:"instructor_notes"`
	Instructor      uint   `json:"instructor"`
	Start           string `json:"start"`
	End             string `json:"end"`
}

type TrainingRequestSlot

type TrainingRequestSlot struct {
	ID    string     `json:"id"`
	Start *time.Time `json:"start"`
	End   *time.Time `json:"end"`
}

type UserResponse

type UserResponse struct {
	CID                  uint                                   `json:"cid" yaml:"cid" xml:"cid"`
	FirstName            string                                 `json:"first_name" yaml:"first_name" xml:"first_name"`
	LastName             string                                 `json:"last_name" yaml:"last_name" xml:"last_name"`
	OperatingInitials    string                                 `json:"operating_initials" yaml:"operating_initials" xml:"operating_initials"`
	ControllerType       string                                 `json:"controller_type" yaml:"controller_type" xml:"controller_type"`
	Certifications       map[string]*UserResponseCertifications `json:"certifications" yaml:"certifications" xml:"certifications"`
	Rating               string                                 `json:"rating" yaml:"rating" xml:"rating"`
	Status               string                                 `json:"status" yaml:"status" xml:"status"`
	Roles                []string                               `json:"roles" yaml:"roles" xml:"roles"`
	Region               string                                 `json:"region" yaml:"region" xml:"region"`
	Division             string                                 `json:"division" yaml:"division" xml:"division"`
	Subdivision          string                                 `json:"subdivision" yaml:"subdivision" xml:"subdivision"`
	DiscordID            string                                 `json:"discord_id" yaml:"discord_id" xml:"discord_id"`
	RosterJoinDate       string                                 `json:"roster_join_date" yaml:"roster_join_date" xml:"roster_join_date"`
	ExemptedFromActivity *bool                                  `json:"exempted_from_activity" yaml:"exempted_from_activity" xml:"exempted_from_activity"`
	CreatedAt            string                                 `json:"created_at" yaml:"created_at" xml:"created_at"`
	UpdatedAt            string                                 `json:"updated_at" yaml:"updated_at" xml:"updated_at"`
}

func ConvUserToUserResponse

func ConvUserToUserResponse(user *models.User) *UserResponse

func GetUsersByRole

func GetUsersByRole(role string) ([]*UserResponse, error)

type UserResponseAdmin

type UserResponseAdmin struct {
	CID                  uint                                   `json:"cid" yaml:"cid" xml:"cid"`
	FirstName            string                                 `json:"first_name" yaml:"first_name" xml:"first_name"`
	LastName             string                                 `json:"last_name" yaml:"last_name" xml:"last_name"`
	OperatingInitials    string                                 `json:"operating_initials" yaml:"operating_initials" xml:"operating_initials"`
	ControllerType       string                                 `json:"controller_type" yaml:"controller_type" xml:"controller_type"`
	Certifications       map[string]*UserResponseCertifications `json:"certifications" yaml:"certifications" xml:"certifications"`
	RemovalReason        string                                 `json:"removal_reason" yaml:"removal_reason" xml:"removal_reason"`
	Rating               string                                 `json:"rating" yaml:"rating" xml:"rating"`
	Status               string                                 `json:"status" yaml:"status" xml:"status"`
	Roles                []string                               `json:"roles" yaml:"roles" xml:"roles"`
	Region               string                                 `json:"region" yaml:"region" xml:"region"`
	Division             string                                 `json:"division" yaml:"division" xml:"division"`
	Subdivision          string                                 `json:"subdivision" yaml:"subdivision" xml:"subdivision"`
	DiscordID            string                                 `json:"discord_id" yaml:"discord_id" xml:"discord_id"`
	ExemptedFromActivity *bool                                  `json:"exempted_from_activity" yaml:"exempted_from_activity" xml:"exempted_from_activity"`
	RosterJoinDate       string                                 `json:"roster_join_date" yaml:"roster_join_date" xml:"roster_join_date"`
	CreatedAt            string                                 `json:"created_at" yaml:"created_at" xml:"created_at"`
	UpdatedAt            string                                 `json:"updated_at" yaml:"updated_at" xml:"updated_at"`
}

type UserResponseCertifications

type UserResponseCertifications struct {
	DisplayName string `json:"display_name" yaml:"display_name" xml:"display_name"`
	Value       string `json:"value" yaml:"value" xml:"value"`
	Order       uint   `json:"order" yaml:"order" xml:"order"`
	Hidden      bool   `json:"hidden" yaml:"hidden" xml:"hidden"`
}

type VisitorResponse

type VisitorResponse struct {
	ID        uint          `json:"id" yaml:"id" xml:"id"`
	User      *UserResponse `json:"user" yaml:"user" xml:"user"`
	CreatedAt string        `json:"created_at" yaml:"created_at" xml:"created_at"`
	UpdatedAt string        `json:"updated_at" yaml:"updated_at" xml:"updated_at"`
}

func ConvVisitorApplicationsToResponse

func ConvVisitorApplicationsToResponse(applications []models.VisitorApplication) []*VisitorResponse

Jump to

Keyboard shortcuts

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