viewmodel

package
Version: v0.0.0-...-99b79bc Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2019 License: MIT Imports: 4 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountDTO

type AccountDTO struct {
	FirstName       string    `json:"firstName"`
	LastName        string    `json:"lastName"`
	Email           string    `json:"email"`
	Phone           string    `json:"phone"`
	Roles           []int     `json:"roles"`
	DateTimeCreated time.Time `json:"createdOn"`
	DateTimeUpdated time.Time `json:"updatedOn"`
}

func (*AccountDTO) Extract

func (dto *AccountDTO) Extract(account businesslogic.Account)

type AccountRoleDTO

type AccountRoleDTO struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

func AccountRoleToAccountRoleDTO

func AccountRoleToAccountRoleDTO(role businesslogic.AccountRole) AccountRoleDTO

type AccountTypePublicView

type AccountTypePublicView struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

func NewAccountTypePublicView

func NewAccountTypePublicView(model businesslogic.AccountType) AccountTypePublicView

NewAccountTypePublicView creates the Public-view object of AccountType

type Age

type Age struct {
	ID       int    `json:"id"`
	Name     string `json:"name"`
	Division int    `json:"division"`
	Enforced bool   `json:"enforced"`
	Minimum  int    `json:"minimum"`
	Maximum  int    `json:"maximum"`
}

func AgeDataModelToViewModel

func AgeDataModelToViewModel(dm businesslogic.Age) Age

type AthleteCompetitionEntryViewModel

type AthleteCompetitionEntryViewModel struct {
	EntryID       int                  `json:"id"`
	CompetitionID int                  `json:"competitionId"`
	Athlete       AthleteTinyViewModel `json:"athlete"`
	IsLead        bool                 `json:"isLead"`
	LeadTag       int                  `json:"leadTag"`
}

AthleteCompetitionEntryViewModel

type AthleteCompetitionRegistrationForm

type AthleteCompetitionRegistrationForm struct {
	CompetitionID  int   `json:"competitionId" validate:"nonzero"`
	PartnershipID  int   `json:"partnershipId" validate:"min=1"`
	AddedEvents    []int `json:"addedEvents"`
	DroppedEvents  []int `json:"droppedEvents"`
	Representation struct {
		CountryId int `json:"countryId,omitempty"`
		StateId   int `json:"stateId,omitempty"`
		SchoolId  int `json:"schoolId,omitempty"`
		StudioId  int `json:"studioId,omitempty"`
	} `json:"representation,omitempty"`
}

AthleteCompetitionRegistrationForm is the payload that should be submitted by athlete to sign up for a competition This form should only contain events that the couple would compete. If an existing registration

type AthleteDetailedProfile

type AthleteDetailedProfile struct {
	UID       string
	FirstName string
	LastName  string
	Country   string
	State     string
	Ratings   []RatingProfile
}

type AthleteEventEntryViewModel

type AthleteEventEntryViewModel struct {
	EventID int                  `json:"eventId"`
	Athlete AthleteTinyViewModel `json:"athlete"`
}

type AthleteSummaryProfile

type AthleteSummaryProfile struct {
	UID       string
	FirstName string
	LastName  string
	State     string
	Country   string
}

type AthleteTinyViewModel

type AthleteTinyViewModel struct {
	UID       string `json:"uid"`
	FirstName string `json:"firstName"`
	LastName  string `json:"lastName"`
}

AthleteTinyViewModel is the minimum data of an athlete

func AthleteToTinyViewModel

func AthleteToTinyViewModel(athlete businesslogic.Account) AthleteTinyViewModel

type City

type City struct {
	CityID int    `json:"id"`
	Name   string `json:"name"`
	State  int    `json:"state"`
}

type CompetitionDate

type CompetitionDate struct {
	time.Time
}

func (*CompetitionDate) MarshalJSON

func (cd *CompetitionDate) MarshalJSON() ([]byte, error)

func (*CompetitionDate) UnmarshalJSON

func (cd *CompetitionDate) UnmarshalJSON(input []byte) error

type CompetitionEntryListViewModel

type CompetitionEntryListViewModel struct {
	Competition    CompetitionViewModel               `json:"competition"`
	AthleteEntries []AthleteCompetitionEntryViewModel `json:"athleteEntries"`
	CoupleEntries  []CoupleCompetitionEntryViewModel  `json:"partnershipEntries"`
}

type CompetitionOfficialProfileDTO

type CompetitionOfficialProfileDTO struct {
	ID            string `json:"id"`
	Name          string `json:"name"`
	IsAdjudicator bool   `json:"isAdjudicator"`
	IsScrutineer  bool   `json:"isScrutineer"`
	IsDeckCaptain bool   `json:"isDeckCaptain"`
	IsEmcee       bool   `json:"isEmcee"`
}

func (*CompetitionOfficialProfileDTO) Populate

func (dto *CompetitionOfficialProfileDTO) Populate(account businesslogic.Account)

type CompetitionStatus

type CompetitionStatus struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

func CompetitionStatusDataModelToViewModel

func CompetitionStatusDataModelToViewModel(status businesslogic.CompetitionStatus) CompetitionStatus

type CompetitionViewModel

type CompetitionViewModel struct {
	ID           int       `json:"id"`
	Federation   int       `json:"federationId"`
	Name         string    `json:"name"`
	Website      string    `json:"website"`
	Status       int       `json:"statusId"`
	CountryID    int       `json:"countryId"`
	StateID      int       `json:"stateId"`
	CityID       int       `json:"cityId"`
	Address      string    `json:"address"`
	StartDate    time.Time `json:"start"`
	EndDate      time.Time `json:"end"`
	Attendance   int       `json:"attendance"`
	ContactName  string    `json:"contact"`
	ContactPhone string    `json:"phone"`
	ContactEmail string    `json:"email"`
}

func CompetitionDataModelToViewModel

func CompetitionDataModelToViewModel(competition businesslogic.Competition, accountType int) CompetitionViewModel

type Country

type Country struct {
	ID           int    `json:"id"`
	Name         string `json:"name"`
	Abbreviation string `json:"abbreviation"`
}

Country is the view model of a Country object

func CountriesToViewModel

func CountriesToViewModel(countries []businesslogic.Country) []Country

type CoupleCompetitionEntryViewModel

type CoupleCompetitionEntryViewModel struct {
	EntryID       int                      `json:"id"`
	CompetitionID int                      `json:"competitionId"`
	Couple        PartnershipTinyViewModel `json:"partnership"`
}

type CoupleEventEntryViewModel

type CoupleEventEntryViewModel struct {
	EntryID  int                  `json:"entryId"`
	EventID  int                  `json:"eventId"`
	CoupleID int                  `json:"partnershipId"`
	Lead     AthleteTinyViewModel `json:"lead"`
	Follow   AthleteTinyViewModel `json:"follow"`
}

type CreateAccountDTO

type CreateAccountDTO struct {
	Email       string `json:"email" validate:"regexp=^[0-9a-z]+@[0-9a-z]+(\\.[0-9a-z]+)+$"`
	Phone       string `json:"phone"`
	FirstName   string `json:"firstName" validate:"nonzero"`
	LastName    string `json:"lastName" validate:"nonzero"`
	ToSAccepted bool   `json:"tosAccepted" validate:"true"`
	PPAccepted  bool   `json:"ppaAccepted" validate:"true"`
}

CreateAccountDTO is the JSON payload for request POST /api/v1.0/account/register

func (CreateAccountDTO) ToAccountModel

func (dto CreateAccountDTO) ToAccountModel() businesslogic.Account

type CreateCity

type CreateCity struct {
	Name    string `schema:"name"`
	StateID int    `schema:"state"`
}

func (CreateCity) ToCityDataModel

func (create CreateCity) ToCityDataModel() businesslogic.City

type CreateCompetition

type CreateCompetition struct {
	FederationID   int       `json:"federationId" validate:"min=1"`
	Name           string    `json:"name" validate:"min=3"`
	Start          time.Time `json:"start"`
	End            time.Time `json:"end"`
	Status         int       `json:"statusId"`
	Website        string    `json:"website" validate:"min=10"` // TODO: still requires regex check
	VenueStreet    string    `json:"address" validate:"min=4"`
	VenueCityID    int       `json:"cityId" validate:"min=1"`
	VenueStateID   int       `json:"stateId" validate:"min=1"`
	VenueCountryID int       `json:"countryId" validate:"min=1"`
	ContactName    string    `json:"contact" validate:"min=3"`
	ContactPhone   string    `json:"phone" validate:"min=5"`
	ContactEmail   string    `json:"email" validate:"min=9"`
	CreateUserID   string    `json:"createdby,omitempty"`
}

CreateCompetition defines the JSON payload for creating a competition

func (CreateCompetition) ToCompetitionDataModel

func (createDTO CreateCompetition) ToCompetitionDataModel(user businesslogic.Account) businesslogic.Competition

type CreateCompetitionOfficialInvitationDTO

type CreateCompetitionOfficialInvitationDTO struct {
	RecipientEmail string `json:"recipientEmail"`
}

type CreateCountry

type CreateCountry struct {
	Name         string `json:"name" validate:"min=3"`
	Abbreviation string `json:"abbreviation" validate:"min=3,max=3"` // Abbreviation is the Olympic country code
}

CreateCountry defines the form data for creating a country record

func (*CreateCountry) ToDataModel

func (cc *CreateCountry) ToDataModel() businesslogic.Country

type CreateEventForm

type CreateEventForm struct {
	CompetitionID   int   `json:"competition" validate:"min=1"`
	EventCategoryID int   `json:"category" validate:"min=1"`
	FederationID    int   `json:"federation" validate:"min=1"`
	DivisionID      int   `json:"division" validate:"min=1"`
	AgeID           int   `json:"age" validate:"min=1"`
	ProficiencyID   int   `json:"proficiency" validate:"min=1"`
	StyleID         int   `json:"style" validate:"min=1"`
	Dances          []int `json:"dances"`
	Template        int   `json:"template,omitempty"`
}

CreateEventForm defines the payload for creating an Event

func (CreateEventForm) ToDomainModel

func (dto CreateEventForm) ToDomainModel(user businesslogic.Account) *businesslogic.Event

ToDomainModel converts the caller CreateEventForm to the Event domain model

type CreatePartnershipRequest

type CreatePartnershipRequest struct {
	SenderID       int    `json:"sender" validate:"min=1"`
	RecipientEmail string `json:"recipient" validate:"min=5"`
	RecipientRole  int    `json:"roleId" validate:"min=1,max=2"`
	Message        string `json:"message"`
}

CreatePartnershipRequest defines the JSON payload structure for creating a partnership request.

type Dance

type Dance struct {
	ID           int    `json:"id"`
	Name         string `json:"name"`
	StyleID      int    `json:"style"`
	Abbreviation string `json:"abbreviation"`
}

type DeleteCity

type DeleteCity struct {
	ID int `json:"id"`
}

type DeleteCountry

type DeleteCountry struct {
	CountryID int    `schema:"id"`
	Name      string `schema:"name"`
}

type DeleteEventForm

type DeleteEventForm struct {
	ID int `json:"eventId";validate:"min=1"`
}

type DivisionViewModel

type DivisionViewModel struct {
	ID         int    `json:"id"`
	Name       string `json:"name"`
	Federation int    `json:"federation"`
}

type EventDanceViewModel

type EventDanceViewModel struct {
	ID      int `json:"eventDanceId"`
	EventId int `json:"eventId"`
	DanceId int `json:"danceId"`
}

EventDanceViewModel defines the JSON structure of EventDance

func (*EventDanceViewModel) PopulateViewModel

func (view *EventDanceViewModel) PopulateViewModel(model businesslogic.EventDance)

type EventEntryListViewModel

type EventEntryListViewModel struct {
	Event          EventViewModel               `json:"event"`
	AthleteEntries []AthleteEventEntryViewModel `json:"athleteEntries"`
	CoupleEntries  []CoupleEventEntryViewModel  `json:"partnershipEntries"`
}

type EventViewModel

type EventViewModel struct {
	ID            int                   `json:"eventId"`
	CompetitionID int                   `json:"competitionId"`
	FederationID  int                   `json:"federationId"`
	DivisionID    int                   `json:"divisionId"`
	AgeID         int                   `json:"ageId"`
	ProficiencyID int                   `json:"proficiencyId"`
	StyleID       int                   `json:"styleId"`
	Dances        []int                 `json:"dances"`
	EventDances   []EventDanceViewModel `json:"eventDances"`
}

EventViewModel defines the JSON structure of Event which is used in outbound API

func (*EventViewModel) PopulateViewModel

func (view *EventViewModel) PopulateViewModel(model businesslogic.Event)

PopulateViewModel populates the caller EventViewModel data fields with data from business logic Event

type Federation

type Federation struct {
	ID           int    `json:"id"`
	Name         string `json:"name"`
	Abbreviation string `json:"abbreviation"`
}

type Gender

type Gender struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

func GenderDataModelToViewModel

func GenderDataModelToViewModel(gender businesslogic.Gender) Gender

type OrganizerProvisionSummary

type OrganizerProvisionSummary struct {
	OrganizerID string `json:"uuid"`
	Name        string `json:"name"`
	Available   int    `json:"available"`
	Hosted      int    `json:"hosted"`
}

OrganizerProvisionSummary specifies payload for Organizer Provision

func (*OrganizerProvisionSummary) Summarize

func (summary *OrganizerProvisionSummary) Summarize(provision businesslogic.OrganizerProvision)

type OrganizerSearchEventCriteria

type OrganizerSearchEventCriteria struct {
	FederationID  int `schema:"federationId"`
	CompetitionID int `schema:"competitionId"`
	EventID       int `schema:"eventId"`
	DivisionID    int `schema:"divisionId"`
	AgeID         int `schema:"ageId"`
	ProficiencyID int `schema:"proficiencyId"`
	StyleID       int `schema:"styleId"`
	OrganizerID   int `schema:"organizerId,omitempty"`
}

OrganizerSearchEventCriteria defines the query string that Organizer can submit to search events that the organizer created

func (OrganizerSearchEventCriteria) ToBusinessModel

type Partnership

type Partnership struct {
	ID         int       `json:"id"`
	LeadName   string    `json:"lead"`
	FollowName string    `json:"follow"`
	Since      time.Time `json:"since"`
	SameSexIND bool      `json:"samesex"`
	Favorite   bool      `json:"favorite"`
}

func PartnershipDataModelToViewModel

func PartnershipDataModelToViewModel(currentUser businesslogic.Account, partnership businesslogic.Partnership) Partnership

type PartnershipRequest

type PartnershipRequest struct {
	ID              int       `json:"id"`
	Sender          string    `json:"sender"`
	Recipient       string    `json:"recipient"`
	Message         string    `json:"message"`
	Status          int       `json:"statusId"`
	Role            string    `json:"role"`
	DateTimeCreated time.Time `json:"sent"`
}

PartnershipRequest view model

type PartnershipRequestBlacklistReasonViewModel

type PartnershipRequestBlacklistReasonViewModel struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

type PartnershipRequestResponse

type PartnershipRequestResponse struct {
	RequestID int `json:"request"`
	Response  int `json:"response"`
}

type PartnershipRequestStatus

type PartnershipRequestStatus struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

PartnershipRequestStatus defines the JSON structure of reference data PartnershipRequestStatus.

type PartnershipRole

type PartnershipRole struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

PartnershipRole defines the JSON structure reference data PartnershipRole

func PartnershipRoleDataModelToViewModel

func PartnershipRoleDataModelToViewModel(dataModel businesslogic.PartnershipRole) PartnershipRole

type PartnershipTinyViewModel

type PartnershipTinyViewModel struct {
	ID     int    `json:"id"`
	Lead   string `json:"lead"`
	Follow string `json:"follow"`
}

func PartnershipToTinyViewModel

func PartnershipToTinyViewModel(partnership businesslogic.Partnership) PartnershipTinyViewModel

type Proficiency

type Proficiency struct {
	ProficiencyID int    `json:"id"`
	Name          string `json:"name"`
	Division      int    `json:"division"`
}

func ProficiencyDataModelToViewModel

func ProficiencyDataModelToViewModel(dm businesslogic.Proficiency) Proficiency

type RESTAPIResult

type RESTAPIResult struct {
	Status  int         `json:"status"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

type RatingProfile

type RatingProfile struct {
	Category    string // Style of dances: Standard, Latin, Smooth, Rhythm
	Rating      float32
	Rank        int
	LastUpdated time.Time
	History     []struct {
		Rating    float32
		Rank      int
		UpdatedOn time.Time
	}
}

type RespondRoleApplication

type RespondRoleApplication struct {
	ApplicationID int `json:"applicationId" validate:"min=1"`
	Response      int `json:"responseId" validate:"min=1,max=2"`
}

RespondRoleApplication specifies the payload for responding a role application

type RoleApplicationAdminView

type RoleApplicationAdminView struct {
	ID                int       `json:"id"`
	ApplicantName     string    `json:"applicant"`
	RoleApplied       int       `json:"role"`
	Description       string    `json:"description"`
	Status            int       `json:"status"`
	DateTimeSubmitted time.Time `json:"created"`
	DateTimeResponded time.Time `json:"responded"`
}

type RoleApplicationStatusViewModel

type RoleApplicationStatusViewModel struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

func (*RoleApplicationStatusViewModel) PopulateFromModel

func (model *RoleApplicationStatusViewModel) PopulateFromModel(status businesslogic.RoleApplicationStatus)

type School

type School struct {
	SchoolID int    `json:"id"`
	Name     string `json:"name"`
	CityID   int    `json:"city"`
}

func SchoolDataModelToViewModel

func SchoolDataModelToViewModel(school businesslogic.School) School

type SearchAccountDTO

type SearchAccountDTO struct {
	FirstName string `schema:"firstName"`
	LastName  string `schema:"lastName"`
	RoleID    int    `schema:"roleId"`
	Email     string `schema:"email"`
	Phone     string `schema:"phone"`
}

SearchAccountDTO defines the HTTP search parameters for account search

func (SearchAccountDTO) Populate

func (dto SearchAccountDTO) Populate(criteria *businesslogic.SearchAccountCriteria)

type SearchAge

type SearchAge struct {
	DivisionID int `schema:"division"`
	AgeID      int `schema:"id"`
}

type SearchAthleteProfileForm

type SearchAthleteProfileForm struct {
	CountryId int    `schema:"countryId" validate:"min=0"`
	StateId   int    `schema:"stateId" validate:"min=0"`
	FirstName string `schema:"firstName" validate:""`
}

SearchAthleteProfileForm

type SearchCompetitionEventTemplateForm

type SearchCompetitionEventTemplateForm struct {
	ID         int    `schema:"templateId"`
	Name       string `schema:"name"`
	Federation string `schema:"federation"`
	OwnerID    int
}

type SearchDivisionViewModel

type SearchDivisionViewModel struct {
	DivisionID   int    `schema:"id"`
	Name         string `schema:"name"`
	FederationID int    `schema:"federation"`
}

type SearchEligibleCompetitionOfficialDTO

type SearchEligibleCompetitionOfficialDTO struct {
	AccountTypeID int `schema:"accountTypeId"`
}

type SearchEntryForm

type SearchEntryForm struct {
	CompetitionID int `schema:"competitionId"`
	EventID       int `schema:"eventId"`
	FederationID  int `schema:"federationId"`
	DivisionID    int `schema:"divisionId"`
	AgeID         int `schema:"ageId"`
	ProficiencyID int `schema:"proficiencyId"`
	StyleID       int `schema:"styleId"`
	PartnershipID int `schema:"partnershipId,omitempty"`
	AthleteID     int `schema:"athleteId,omitempty"`
}

SearchEntryForm defines the acceptable parameters that can be used to query competition and event entries

type SearchPartnershipProfileForm

type SearchPartnershipProfileForm struct {
	CountryId       int    `schema:"countryId" validate:"min=0"`
	StateId         int    `schema:"stateId" validate:"min=0"`
	LeadFirstName   string `schema:"leadFirstName"`
	LeadLastName    string `schema:"leadLastName"`
	FollowFirstName string `schema:"followFirstName"`
	FollowLastName  string `schema:"followLastName"`
}

SearchPartnershipProfileForm

type SearchPartnershipRequestViewModel

type SearchPartnershipRequestViewModel struct {
	RequestID       int    `schema:"id"`
	Type            int    `schema:"type"`
	Sender          string `schema:"sender"`
	Recipient       string `schema:"recipient"`
	RequestStatusID int    `schema:"status"`
}

type SearchRoleApplicationCriteriaViewModel

type SearchRoleApplicationCriteriaViewModel struct {
	ID             int  `schema:"id"`
	AccountID      int  `schema:"applicant"`
	AppliedRoleID  int  `schema:"appliedRole"`
	StatusID       int  `schema:"statusId"`
	ApprovalUserID int  `schema:"approvedBy"`
	Responded      bool `schema:"responded"`
}

SearchRoleApplicationCriteria specifies the search criteria for role application

type State

type State struct {
	ID           int    `json:"id"`
	Name         string `json:"name"`
	Abbreviation string `json:"abbreviation"`
	CountryID    int    `json:"country"`
}

func StateDataModelToViewModel

func StateDataModelToViewModel(dm businesslogic.State) State

type Studio

type Studio struct {
	ID      int    `json:"id"`
	Name    string `json:"name"`
	Address string `json:"address"`
	CityID  int    `json:"city"`
	Website string `json:"website"`
}

func StudioDataModelToViewModel

func StudioDataModelToViewModel(dm businesslogic.Studio) Studio

type Style

type Style struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

type SubmitRoleApplication

type SubmitRoleApplication struct {
	RoleID      int    `json:"roleId" validate:"min=2,max=6"` // CAUTION! hard coded role ID here!
	Description string `json:"description" validate:"min=20"`
}

SubmitRoleApplication is the payload for role application submission

type UpdateCity

type UpdateCity struct {
	ID      int    `json:"id"`
	Name    string `json:"name"`
	StateID int    `json:"state"`
}

type UpdateCompetitionDTO

type UpdateCompetitionDTO struct {
	CompetitionID int       `json:"competition"`
	Name          string    `json:"name"`
	Website       string    `json:"website"`
	Status        int       `json:"status"`
	Address       string    `json:"street"`
	ContactName   string    `json:"contact"`
	ContactEmail  string    `json:"email"`
	ContactPhone  string    `json:"phone"`
	StartDate     time.Time `json:"start"`
	EndDate       time.Time `json:"end"`
	UpdateUserID  int
}

type UpdateCountry

type UpdateCountry struct {
	CountryID    int    `schema:"CountryID"`
	Name         string `schema:"Name"`
	Abbreviation string `schema:"Abbreviation"`
	UpdateUserID int    `schema:"UpdateUserID"`
}

type UpdateProvision

type UpdateProvision struct {
	OrganizerID     string `json:"organizer"`
	AmountAllocated int    `json:"allocate"`
	Note            string `json:"note"`
}

UpdateProvision specifies the payload that admin user need to submit to update organizer's provision

type UserPreferenceViewModel

type UserPreferenceViewModel struct {
	DefaultRole int `json:"defaultRole"`
}

func UserPreferenceDataModelToViewModel

func UserPreferenceDataModelToViewModel(model businesslogic.UserPreference) UserPreferenceViewModel

Jump to

Keyboard shortcuts

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