Documentation
¶
Index ¶
- type Announcement
- type AnnouncementResponse
- type AnnouncementType
- type Audition
- type AuditionComment
- type AuditionUpdate
- type CastingConfResult
- type CastingConfVars
- type DBError
- type Database
- func (store *Database) ActivateUserByID(userID int) *DBError
- func (store *Database) AddUserToAudition(userID, audID, creatorID, numShows int, availability *WeekTimeBlock, ...) *DBError
- func (store *Database) AddUserToPiece(userID, pieceID int, markInvite bool, inviteStatus string) *DBError
- func (store *Database) AssignChoreographerToPiece(userID, pieceID int) *DBError
- func (store *Database) BootstrapInitialAdminUser(fName, lName, email, password string) error
- func (store *Database) ChangeUserRole(userID int, roleName string) *DBError
- func (store *Database) ContainsUser(newUser *NewUserRequest) (bool, *DBError)
- func (store *Database) DeactivateUserByID(userID int) *DBError
- func (store *Database) DeleteAnnouncementByID(id int) *DBError
- func (store *Database) DeleteAuditionByID(id int) error
- func (store *Database) DeleteManyRehearsalsByID(pieceID int, rehearsals []int) *DBError
- func (store *Database) DeleteMusicianByID(id int) *DBError
- func (store *Database) DeletePieceByID(id int) *DBError
- func (store *Database) DeletePieceInfoSheet(pieceID int) *DBError
- func (store *Database) DeletePieceRehearsals(pieceID int) *DBError
- func (store *Database) DeleteRoleByID(id int) *DBError
- func (store *Database) DeleteShowByID(id int) *DBError
- func (store *Database) ExpirePendingPieceInvites() (int64, *DBError)
- func (store *Database) GetAllAnnouncements(page int, includeDeleted bool, userID, typeName string) ([]*AnnouncementResponse, int, *DBError)
- func (store *Database) GetAllUsers(page int, includeInactive bool) ([]*User, int, *DBError)
- func (store *Database) GetAnnouncementTypes(includeDeleted bool) ([]*AnnouncementType, *DBError)
- func (store *Database) GetAuditionByID(id int, includeDeleted bool) (*Audition, *DBError)
- func (store *Database) GetAuditionByShowID(id int, includeDeleted bool) (*Audition, *DBError)
- func (store *Database) GetChoreographerShowPiece(showID, choreographerID int) (*Piece, *DBError)
- func (store *Database) GetPieceByID(id int, includeDeleted bool) (*Piece, *DBError)
- func (store *Database) GetPieceByMusicianID(id int) (*Piece, *DBError)
- func (store *Database) GetPieceInfoSheet(pieceID int) (*PieceInfoSheet, *DBError)
- func (store *Database) GetPieceMusicians(pieceID int) ([]*PieceMusician, *DBError)
- func (store *Database) GetPieceRehearsalByID(pieceID, rehearsalID int, includeDeleted bool) (*RehearsalTime, *DBError)
- func (store *Database) GetPieceRehearsals(pieceID int) (RehearsalTimes, *DBError)
- func (store *Database) GetPiecesByShowID(id, page int, includeDeleted bool) ([]*Piece, int, *DBError)
- func (store *Database) GetPiecesByUserID(id, page, showID int, includeDeleted bool) ([]*Piece, int, *DBError)
- func (store *Database) GetRoleByID(id int) (*Role, *DBError)
- func (store *Database) GetRoleByName(name string) (*Role, *DBError)
- func (store *Database) GetRoles() ([]*Role, *DBError)
- func (store *Database) GetShowByAuditionID(id int, includeDeleted bool) (*Show, *DBError)
- func (store *Database) GetShowByID(id int, includeDeleted bool) (*Show, error)
- func (store *Database) GetShowTypes(includeDeleted bool) ([]*ShowType, *DBError)
- func (store *Database) GetShows(page int, history string, includeDeleted bool, typeName string) ([]*Show, int, *DBError)
- func (store *Database) GetShowsByUserID(id, page int, includeDeleted bool, history string) ([]*Show, int, *DBError)
- func (store *Database) GetUserAuditionAvailability(userID, audID int) (*WeekTimeBlock, error)
- func (store *Database) GetUserAuditionComments(userID, audID, creatorID, page int, includeDeleted bool) ([]*UserAuditionComment, *DBError)
- func (store *Database) GetUserAuditionLink(userID, audID int) (*UserAuditionLinkResponse, *DBError)
- func (store *Database) GetUserAuditionLinksByAuditionID(audID int) ([]*UserAuditionLinkResponse, *DBError)
- func (store *Database) GetUserByEmail(email string, includeInactive bool) (*User, *DBError)
- func (store *Database) GetUserByID(id int, includeInactive bool) (*User, *DBError)
- func (store *Database) GetUserPieceInvites(id int) ([]*PieceInviteResponse, *DBError)
- func (store *Database) GetUsersByAuditionID(id, page int, includeDeleted bool) ([]*User, *DBError)
- func (store *Database) GetUsersByPieceID(id, page int, includeDeleted bool) ([]*User, *User, int, *DBError)
- func (store *Database) GetUsersByShowID(id, page int, includeDeleted bool) ([]*User, int, *DBError)
- func (store *Database) InsertAnnouncement(na *NewAnnouncement) (*Announcement, *DBError)
- func (store *Database) InsertAnnouncementType(at *AnnouncementType) *DBError
- func (store *Database) InsertMusicianToPiece(pieceID, creator int, musician *NewPieceMusician) *DBError
- func (store *Database) InsertNewAudition(newAud *NewAudition) (*Audition, *DBError)
- func (store *Database) InsertNewPiece(newPiece *NewPiece) (*Piece, *DBError)
- func (store *Database) InsertNewPieceInfoSheet(creator int, pieceID int, info *NewPieceInfoSheet) (*PieceInfoSheet, *DBError)
- func (store *Database) InsertNewRehearsalTimes(nrts NewRehearsalTimes) (RehearsalTimes, *DBError)
- func (store *Database) InsertNewShow(newShow *NewShow) (*Show, *DBError)
- func (store *Database) InsertNewShowType(showType *ShowType) *DBError
- func (store *Database) InsertNewUser(user *User) *DBError
- func (store *Database) InsertNewUserPieceInvite(userID, pieceID int, expiry time.Time) *DBError
- func (store *Database) InsertPieceRehearsals(userID int64, pieceID int, rehearsals NewRehearsalTimes) (RehearsalTimes, *DBError)
- func (store *Database) InsertRole(role *NewRole) (*Role, *DBError)
- func (store *Database) InsertUserAuditionComment(userID, audID, creatorID int, comment string) (*UserAuditionComment, *DBError)
- func (store *Database) LogError(err ErrorLog)
- func (store *Database) MarkInvite(userID, pieceID int, status string) *DBError
- func (store *Database) ModifyShowAuditionRelationship(showID, audID int, assigning bool) *DBError
- func (store *Database) RemoveUserFromAudition(userID, audID int) *DBError
- func (store *Database) RemoveUserFromPiece(userID, pieceID int) *DBError
- func (store *Database) SearchForUsers(email, firstName, lastName string, page int) ([]*User, int, *DBError)
- func (store *Database) UpdateAuditionByID(id int, updates *AuditionUpdate) *DBError
- func (store *Database) UpdateMusicianByID(id int, updates *MusicianUpdates) *DBError
- func (store *Database) UpdatePasswordByID(id int, passHash []byte) error
- func (store *Database) UpdatePieceInfoSheet(infoSheetID int64, info *PieceInfoSheetUpdates) *DBError
- func (store *Database) UpdatePieceRehearsalsByID(pieceID, rehearsalID int, updates *NewRehearsalTime) *DBError
- func (store *Database) UpdateUserAuditionAvailability(userID, audID int, availability *WeekTimeBlock) error
- func (store *Database) UpdateUserByID(userID int, updates *UserUpdates, includeInactive bool) *DBError
- func (store *Database) UserHasInviteForPiece(userID, pieceID int64) (bool, *DBError)
- func (store *Database) UserIsInAudition(userID, audID int) (bool, *DBError)
- func (store *Database) UserIsInPiece(userID, pieceID int) (bool, *DBError)
- type DayTimeBlock
- type ErrorLog
- type MusicianUpdates
- type NewAnnouncement
- type NewAudition
- type NewPiece
- type NewPieceInfoSheet
- type NewPieceMusician
- type NewRehearsalTime
- type NewRehearsalTimes
- type NewRole
- type NewShow
- type NewUserRequest
- type PaginatedAnnouncementResponses
- type PaginatedAuditions
- type PaginatedPieces
- type PaginatedShows
- type PaginatedUserAuditionComments
- type PaginatedUserResponses
- type PaginatedUsers
- type PasswordResetRequest
- type PasswordResetTPL
- type PermissionChecker
- func (pc *PermissionChecker) ConvertUserSliceToUserResponseSlice(users []*User) ([]*UserResponse, error)
- func (pc *PermissionChecker) ConvertUserToUserResponse(u *User) (*UserResponse, error)
- func (pc *PermissionChecker) FlushRoleCache() error
- func (pc *PermissionChecker) UserCan(u *User, action int) bool
- func (pc *PermissionChecker) UserCanAddToAudition(u *User, target int64) bool
- func (pc *PermissionChecker) UserCanAddToPiece(u *User, pieceID int64) bool
- func (pc *PermissionChecker) UserCanDeleteUser(u *User, target int64) bool
- func (pc *PermissionChecker) UserCanEnableUser(u *User, target int64) bool
- func (pc *PermissionChecker) UserCanModifyPieceInfo(u *User, pieceID int) bool
- func (pc *PermissionChecker) UserCanModifyUser(u *User, target int64) bool
- func (pc *PermissionChecker) UserCanRemoveUserFromAudition(u *User, target int64) bool
- func (pc *PermissionChecker) UserCanSeeAvailability(u *User, target int64) bool
- func (pc *PermissionChecker) UserCanSeePieceInfo(u *User, piece int) bool
- func (pc *PermissionChecker) UserCanSeeUser(u *User, target int64) bool
- func (pc *PermissionChecker) UserCanSeeUsersInAudition(u *User, audition int) bool
- func (pc *PermissionChecker) UserCanSeeUsersInPiece(u *User, piece int) bool
- func (pc *PermissionChecker) UserCanSeeUsersInShow(u *User, show int) bool
- func (pc *PermissionChecker) UserIsAtLeast(u *User, role int) bool
- type Piece
- type PieceInfoSheet
- type PieceInfoSheetUpdates
- type PieceInviteResponse
- type PieceMusician
- type PieceUsersResponse
- type PostCastingRequest
- type PostCastingResponse
- type RawAvailability
- type RehearsalTime
- type RehearsalTimes
- type Role
- type RoleChange
- type SQLStatement
- type Show
- type ShowType
- type SignInRequest
- type TimeBlock
- type User
- type UserAudition
- type UserAuditionComment
- type UserAuditionLink
- type UserAuditionLinkResponse
- type UserResponse
- type UserUpdates
- type Validator
- type WeekTimeBlock
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Announcement ¶
type Announcement struct {
ID int64 `json:"id"`
AnnouncementTypeID int64 `json:"typeID"`
Message string `json:"message"`
CreatedAt time.Time `json:"createdAt"`
CreatedBy int64 `json:"createdBy"`
IsDeleted bool `json:"isDeleted"`
}
Announcement defines the structure of how a system-wide announcement will be stored inside of the database.
func (*Announcement) AsAnnouncementResponse ¶
func (a *Announcement) AsAnnouncementResponse(u *User) *AnnouncementResponse
type AnnouncementResponse ¶
type AnnouncementResponse struct {
ID int64 `json:"id"`
AnnouncementTypeID int64 `json:"typeID"`
Message string `json:"message"`
CreatedAt time.Time `json:"createdAt"`
CreatedBy *User `json:"createdBy"`
IsDeleted bool `json:"isDeleted"`
}
AnnouncementResponse defines the structure of how a system-wide announcement will be written back to the client.
type AnnouncementType ¶
type AnnouncementType struct {
ID int64 `json:"id"`
Name string `json:"name"`
Desc string `json:"desc"`
CreatedAt time.Time `json:"createdAt"`
CreatedBy int `json:"createdBy"`
IsDeleted bool `json:"isDeleted"`
}
AnnouncementType defines how an announcement type is stored in the database.
func (*AnnouncementType) Validate ¶
func (at *AnnouncementType) Validate() error
Validate validates the new announcement type and returns an error if one occurred.
type Audition ¶
type Audition struct {
ID int `json:"id"`
Time time.Time `json:"time"`
Location string `json:"location"`
CreatedAt time.Time `json:"createdAt"`
CreatedBy int `json:"createdBy"`
IsDeleted bool `json:"isDeleted"`
}
Audition defines the information needed for an audition within the system
type AuditionComment ¶
type AuditionComment struct {
Comment string `json:"comment"`
}
AuditionComment defines how a request to create a new audition comment will look like. This comment is made with a stand alone request and is not tied to the initial UserAudition creation request.
func (*AuditionComment) Validate ¶
func (nac *AuditionComment) Validate() error
Validate validates the content of the new audition comment and returns an error if one occurred.
type AuditionUpdate ¶
AuditionUpdate represents the body of a request to update an audition
type CastingConfResult ¶
type CastingConfResult struct {
Dancer *User `json:"dancer"`
InviteCreated bool `json:"inviteCreated"`
EmailSent bool `json:"emailSent"`
IsError bool `json:"isError"`
Message string `json:"message,omitempty"`
}
CastingConfResult defines how a single user cast result will be sent to the client. Since there a lot of ways for the cast to fail, we will include the message and if the user failed to have an invite created for them and have an email sent, etc.
type CastingConfVars ¶
type CastingConfVars struct {
Name string
ChorFName string
ChorLName string
ExpiryTime string
Schedule string
URL string
}
CastingConfVars defines the variables that will be merged into the casting confirmation template.
type DBError ¶
DBError represents an error that is returned from a database function.
func NewDBError ¶
NewDBError returns a new DBError from the given message and status.
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
store defines a sql database struct
func NewDatabase ¶
NewDatabase returns a new store with an open sql db connection from the given connection information. Returns an error if it failed to open the connection, or if it fails to ping the db after three tries
func (*Database) ActivateUserByID ¶
ActivateUserByID marks the user with the given userID as active. Returns an error if one occurred.
func (*Database) AddUserToAudition ¶
func (store *Database) AddUserToAudition(userID, audID, creatorID, numShows int, availability *WeekTimeBlock, comment string) *DBError
AddUserToAudition adds the given user to the given audition. Returns an error if one occurred.
func (*Database) AddUserToPiece ¶
func (store *Database) AddUserToPiece(userID, pieceID int, markInvite bool, inviteStatus string) *DBError
AddUserToPiece adds the given user to the given piece.
func (*Database) AssignChoreographerToPiece ¶
AssignChoreographerToPiece assigns the given user id as a choreographer to the given piece. Assumes the user is a valid choreographer user. Returns an error if one occurred.
func (*Database) BootstrapInitialAdminUser ¶
BootstrapInitialAdminUser adds an initial admin user with the given information
func (*Database) ChangeUserRole ¶
ChangeUserRole sets the role of the given user ID to role. Returns an error if one occurred.
func (*Database) ContainsUser ¶
func (store *Database) ContainsUser(newUser *NewUserRequest) (bool, *DBError)
ContainsUser returns true if this database contains a user with the same email as the given newUser object. Returns an error if one occurred
func (*Database) DeactivateUserByID ¶
DeactivateUserByID marks the user with the given userID as inactive. Returns an error if one occurred.
func (*Database) DeleteAnnouncementByID ¶
DeleteAnnouncementByID deletes the announcement with the given id.
func (*Database) DeleteAuditionByID ¶
DeleteAuditionByID marks the audition with the given ID as deleted.
func (*Database) DeleteManyRehearsalsByID ¶
DeleteManyRehearsalsByID deletes all rehearsals that have IDs that are in the rehearsals slice. Does not delete any rehearsal ID that does not match the given piece ID. Returns a DBError if an error occurred.
func (*Database) DeleteMusicianByID ¶
DeleteMusicianByID deletes the musician with the given id. Returns a DBError if an error occurred.
func (*Database) DeletePieceByID ¶
DeletePieceByID marks the piece with the given ID as deleted.
func (*Database) DeletePieceInfoSheet ¶
DeletePieceInfoSheet deletes the given piece's info sheet, if it exists. Returns a DBError if one occurred.
func (*Database) DeletePieceRehearsals ¶
DeletePieceRehearsals deletes every rehearsal for the given piece. Returns a DBError if one occurred.
func (*Database) DeleteRoleByID ¶
DeleteRoleByID deletes the role at the given ID and sets every user who has that role to be a standard user. Admin, Choreographer, Dancer roles cannot be deleted.
func (*Database) DeleteShowByID ¶
DeleteShowByID marks the show with the given ID as deleted.
func (*Database) ExpirePendingPieceInvites ¶
ExpirePendingPieceInvites changes the status of any expired user piece addition to appvars.CastStatusExpired if the cast status is pending when this function is executed. This does not control the logic if a piece is expired or now. Returns the number of rows affected and an error if one occurred.
func (*Database) GetAllAnnouncements ¶
func (store *Database) GetAllAnnouncements(page int, includeDeleted bool, userID, typeName string) ([]*AnnouncementResponse, int, *DBError)
GetAllAnnouncements gets the given page of announcements, optionally including deleted ones. returns an error if one occurred.
func (*Database) GetAllUsers ¶
GetAllUsers returns a slice of users of every user in the database, active or not. Returns an error if one occurred
func (*Database) GetAnnouncementTypes ¶
func (store *Database) GetAnnouncementTypes(includeDeleted bool) ([]*AnnouncementType, *DBError)
GetAnnouncementTypes returns a slice of AnnouncementTypes based on the filters provided. Returns an error if one occurred.
func (*Database) GetAuditionByID ¶
GetAuditionByID returns the audition with the given ID.
func (*Database) GetAuditionByShowID ¶
GetAuditionByShowID gets the audition that is for the given show. Returns a DBError if an error occurred.
func (*Database) GetChoreographerShowPiece ¶
GetChoreographerShowPiece gets the current piece in the show that the given choreographer is running, if it exists. Returns an error if one occurred.
func (*Database) GetPieceByID ¶
GetPieceByID returns the show with the given ID.
func (*Database) GetPieceByMusicianID ¶
GetPieceByMusicianID returns the piece that the given musician is for. Returns a DBError if an error occurred.
func (*Database) GetPieceInfoSheet ¶
func (store *Database) GetPieceInfoSheet(pieceID int) (*PieceInfoSheet, *DBError)
GetPieceInfoSheet returns the piece's info sheet if it exists. Returns an error if one occurred.
func (*Database) GetPieceMusicians ¶
func (store *Database) GetPieceMusicians(pieceID int) ([]*PieceMusician, *DBError)
GetPieceMusicians gets the musicians of the given piece. Returns a DBError if an error occurred.
func (*Database) GetPieceRehearsalByID ¶
func (store *Database) GetPieceRehearsalByID(pieceID, rehearsalID int, includeDeleted bool) (*RehearsalTime, *DBError)
GetPieceRehearsalByID gets the rehearsal time of the given piece and rehearsal ID. If the rehearsal ID does not match the pieceID no rehearsal time will returned. Returns the a DBError if one occurred.
func (*Database) GetPieceRehearsals ¶
func (store *Database) GetPieceRehearsals(pieceID int) (RehearsalTimes, *DBError)
GetPieceRehearsals gets the rehearsals for the given piece. Returns a DBError if one occurred.
func (*Database) GetPiecesByShowID ¶
func (store *Database) GetPiecesByShowID(id, page int, includeDeleted bool) ([]*Piece, int, *DBError)
GetPiecesByShowID gets all pieces that are associated with the given show ID.
func (*Database) GetPiecesByUserID ¶
func (store *Database) GetPiecesByUserID(id, page, showID int, includeDeleted bool) ([]*Piece, int, *DBError)
GetPiecesByUserID gets all pieces the given user is in. If showID is specified, then only pieces the user is in in that show will be returned
func (*Database) GetRoleByID ¶
GetRoleByID gets the role associated with that id. Returns an error if one occurred.
func (*Database) GetRoleByName ¶
GetRoleByName gets the role associated with that name. Returns an error if one occurred.
func (*Database) GetRoles ¶
GetRoles returns a slice of pointers to roles that are in the database, or an error if one occurred. If there are no roles, an empty slice is returned but no error.
func (*Database) GetShowByAuditionID ¶
GetShowByAuditionID gets the show that the given audition is for. Returns the show or an error if one occurred.
func (*Database) GetShowByID ¶
GetShowByID returns the show with the given ID.
func (*Database) GetShowTypes ¶
GetShowTypes returns a slice of ShowTypes based on the filters provided. Returns an error if one occurred.
func (*Database) GetShows ¶
func (store *Database) GetShows(page int, history string, includeDeleted bool, typeName string) ([]*Show, int, *DBError)
GetShows gets the first 25 shows as well as the number of pages that match the given history and includeDeleted filters on the provided page, or an error if one occurred.
func (*Database) GetShowsByUserID ¶
func (store *Database) GetShowsByUserID(id, page int, includeDeleted bool, history string) ([]*Show, int, *DBError)
GetShowsByUserID returns a slice of shows that the given user is in, or an error if one occurred.
func (*Database) GetUserAuditionAvailability ¶
func (store *Database) GetUserAuditionAvailability(userID, audID int) (*WeekTimeBlock, error)
GetUserAuditionAvailability gets the availability associated with the given userID and audID and whether or not it should include deleted availabilities. Returns an error if one occurred.
func (*Database) GetUserAuditionComments ¶
func (store *Database) GetUserAuditionComments(userID, audID, creatorID, page int, includeDeleted bool) ([]*UserAuditionComment, *DBError)
GetUserAuditionComments returns a slice of UserAuditionComments that match the given filters, or an error if one occurred.
func (*Database) GetUserAuditionLink ¶
func (store *Database) GetUserAuditionLink(userID, audID int) (*UserAuditionLinkResponse, *DBError)
GetUserAuditionLink gets the UserAuditionLinkResponse that is affiliated with the given link between the given user and audition, if it exists. Returns an error if one occurred.
func (*Database) GetUserAuditionLinksByAuditionID ¶
func (store *Database) GetUserAuditionLinksByAuditionID(audID int) ([]*UserAuditionLinkResponse, *DBError)
GetUserAuditionLinksByAuditionID returns all user audition links of users who are in the the given audition and returns them. Returns an error if one occurred.
func (*Database) GetUserByEmail ¶
GetUserByEmail gets the user with the given email, if it exists. returns an error if the lookup failed TODO: Test this
func (*Database) GetUserByID ¶
GetUserByID gets the user with the given id, if it exists and it is active. returns an error if the lookup failed TODO: Test this
func (*Database) GetUserPieceInvites ¶
func (store *Database) GetUserPieceInvites(id int) ([]*PieceInviteResponse, *DBError)
GetUserPieceInvites returns a slice of pieces that the given user has pending invites for.
func (*Database) GetUsersByAuditionID ¶
GetUsersByAuditionID returns a slice of users that are in the given audition, if any. Returns an error if one occurred.
func (*Database) GetUsersByPieceID ¶
func (store *Database) GetUsersByPieceID(id, page int, includeDeleted bool) ([]*User, *User, int, *DBError)
GetUsersByPieceID returns a slice of users that are in the given piece, if any, as well as the current choreographer for that that piece if it exists. Returns an error if one occurred.
func (*Database) GetUsersByShowID ¶
GetUsersByShowID returns a slice of users that are in the given show, if any. Returns an error if one occurred.
func (*Database) InsertAnnouncement ¶
func (store *Database) InsertAnnouncement(na *NewAnnouncement) (*Announcement, *DBError)
InsertAnnouncement inserts the given new announcement into the database and returns an announcement. Returns an error if one occurred.
func (*Database) InsertAnnouncementType ¶
func (store *Database) InsertAnnouncementType(at *AnnouncementType) *DBError
InsertAnnouncementType inserts the given AnnouncementType into the database. Returns an error if one occurred.
func (*Database) InsertMusicianToPiece ¶
func (store *Database) InsertMusicianToPiece(pieceID, creator int, musician *NewPieceMusician) *DBError
InsertMusicianToPiece inserts a new musician to the given piece. Returns a DBError if an error occurred.
func (*Database) InsertNewAudition ¶
func (store *Database) InsertNewAudition(newAud *NewAudition) (*Audition, *DBError)
InsertNewAudition inserts a new audition and returns its id.
func (*Database) InsertNewPiece ¶
InsertNewPiece inserts the given NewPiece into the database and returns the created Piece, or an error if one occurred.
func (*Database) InsertNewPieceInfoSheet ¶
func (store *Database) InsertNewPieceInfoSheet(creator int, pieceID int, info *NewPieceInfoSheet) (*PieceInfoSheet, *DBError)
InsertNewPieceInfoSheet inserts the given pieceInfoSheet for the given PieceID. Returns the completed PieceInfoSheet if successful and a DBError if otherwise.
func (*Database) InsertNewRehearsalTimes ¶
func (store *Database) InsertNewRehearsalTimes(nrts NewRehearsalTimes) (RehearsalTimes, *DBError)
InsertNewRehearsalTimes inserts the given new rehearsal times and returns the resulting rehearsal times or and error if one occurred.
func (*Database) InsertNewShow ¶
InsertNewShow inserts the given newShow into the database and returns the created Show
func (*Database) InsertNewShowType ¶
InsertNewSHowType inserts the given show type into the database and returns an error if one occurred.
func (*Database) InsertNewUser ¶
InsertNewUser inserts the given new user into the store and populates the ID field of the user
func (*Database) InsertNewUserPieceInvite ¶
InsertNewUserPieceInvite inserts a new entry representing a pending acceptance
func (*Database) InsertPieceRehearsals ¶
func (store *Database) InsertPieceRehearsals(userID int64, pieceID int, rehearsals NewRehearsalTimes) (RehearsalTimes, *DBError)
InsertPieceRehearsals inserts the given rehearsals for the specified piece. Returns the completed rehearsal times or a DBError if one occurred.
func (*Database) InsertRole ¶
InsertRole inserts the given role into the database and returns the resulting role. Returns an error if one occurred.
func (*Database) InsertUserAuditionComment ¶
func (store *Database) InsertUserAuditionComment(userID, audID, creatorID int, comment string) (*UserAuditionComment, *DBError)
InsertUserAuditionComment inserts the given comment to the given user's given audition. Returns a populated UserAuditionComment, or an error if one occurred.
func (*Database) MarkInvite ¶
MakInvite marks the given invite between the user and piece as accepted or declined depending on the given accepted param
func (*Database) ModifyShowAuditionRelationship ¶
ModifyShowAuditionRelationship assigns the given audition to the given show if they both exist. Returns an error if one occurred.
func (*Database) RemoveUserFromAudition ¶
RemoveUserFromPiece removes the given user from the given audition.
func (*Database) RemoveUserFromPiece ¶
RemoveUserFromPiece removes the given user from the given piece.
func (*Database) SearchForUsers ¶
func (store *Database) SearchForUsers(email, firstName, lastName string, page int) ([]*User, int, *DBError)
SearchForUsers returns a slice of users that match any of the given filters. Returns a DBError if one occurred.
func (*Database) UpdateAuditionByID ¶
func (store *Database) UpdateAuditionByID(id int, updates *AuditionUpdate) *DBError
UpdateAuditionByID updates the given audition to have the new values in the updates parameter. If any value is unset, the value that is currently in the database will be used.
func (*Database) UpdateMusicianByID ¶
func (store *Database) UpdateMusicianByID(id int, updates *MusicianUpdates) *DBError
UpdateMusicianByID updates the musician with the given id to contain the values of the given updates. Returns a DBError if an error occurred.
func (*Database) UpdatePasswordByID ¶
UpdatePasswordByID changes the user with the given IDs passhash to the given byte slice representing the new passhash.
func (*Database) UpdatePieceInfoSheet ¶
func (store *Database) UpdatePieceInfoSheet(infoSheetID int64, info *PieceInfoSheetUpdates) *DBError
UpdatePieceInfoSheet updates an existing piece info sheet if it exists. Returns a DBError if an error occurred.
func (*Database) UpdatePieceRehearsalsByID ¶
func (store *Database) UpdatePieceRehearsalsByID(pieceID, rehearsalID int, updates *NewRehearsalTime) *DBError
UpdatePieceRehearsalsByID updates the rehearsal for the given piece and rehearsalID to have the values of the given updates.
func (*Database) UpdateUserAuditionAvailability ¶
func (store *Database) UpdateUserAuditionAvailability(userID, audID int, availability *WeekTimeBlock) error
UpdateUserAuditionAvailability updates the availability for the UserAudition that is related the given userID and audID to the given WeekTImeBlock.
func (*Database) UpdateUserByID ¶
func (store *Database) UpdateUserByID(userID int, updates *UserUpdates, includeInactive bool) *DBError
UpdateUserByID updates the user with the given ID to match the values of newValues. Returns an error if one occurred.
func (*Database) UserHasInviteForPiece ¶
UserHasInviteForPiece returns if the user has an invite for the given piece. Returns an error if one occurred.
func (*Database) UserIsInAudition ¶
UserIsInAudition returns true if the given user is in the given audition or an error if one occurred.
type DayTimeBlock ¶
type DayTimeBlock struct {
Day string `json:"day,omitempty"`
Times []*TimeBlock `json:"times,omitempty"`
}
DayTimeBlock defines a single day which has one or many time blocks.
func ParseDayTimeBlock ¶
func ParseDayTimeBlock(dtbString string) (*DayTimeBlock, error)
ParseDayTimeBlock parses the given string into a TimeBlock.
func (*DayTimeBlock) Serialize ¶
func (dtb *DayTimeBlock) Serialize() (string, error)
Serialize serializes the current day time block into a string where it is ready to be stored.
func (*DayTimeBlock) Validate ¶
func (dtb *DayTimeBlock) Validate() error
Validate validates the day time block is a valid day of the week with valid time blocks. Returns an error if one occurred.
type ErrorLog ¶
type ErrorLog struct {
Time time.Time
Code int
Message string
RemoteAddr string
RequestURI string
RequestMethod string
}
ErrorLog defines the information that will be logged with a given error
type MusicianUpdates ¶
type MusicianUpdates struct {
Name string `json:"name"`
Phone string `json:"phone"`
Email string `json:"email"`
}
MusicianUpdates defines how updates for a musician are sent to the server.
func (*MusicianUpdates) Validate ¶
func (mu *MusicianUpdates) Validate() error
Validate validates the current musician updates. Returns an error if one occurred.
type NewAnnouncement ¶
type NewAnnouncement struct {
AnnouncementType string `json:"type"`
Message string `json:"message"`
UserID int64 `json:"userID"`
}
NewAnnouncement defines the structure of how an announcement will be given to the system to post.
func (*NewAnnouncement) Validate ¶
func (na *NewAnnouncement) Validate() error
Validate validates the current new announcement and returns an error if one occurred.
type NewAudition ¶
type NewAudition struct {
Time time.Time `json:"time"`
Location string `json:"location"`
CreatedBy int `json:"-"` // will not be supplied by user but will be filled by handler
CreatedAt time.Time `json:"createdAt"`
}
NewAudition defines the information required for a new audition submitted to the server
func (*NewAudition) Validate ¶
func (na *NewAudition) Validate() error
Validate validates the new audition and returns an error if one occurred.
type NewPiece ¶
type NewPiece struct {
Name string `json:"name"`
ChoreographerID int `json:"choreographerID"`
ShowID int `json:"showID,omitempty"`
CreatedBy int `json:"-"` // this will never be supplied by user, but will be populated by the handler
}
NewPiece defines the information needed to create a new piece.
type NewPieceInfoSheet ¶
type NewPieceInfoSheet struct {
ChorPhone string `json:"choreographerPhone"`
Title string `json:"title"`
RunTime string `json:"runTime"`
Composers string `json:"composers"`
MusicTitle string `json:"musicTitle"`
PerformedBy string `json:"performedBy"`
MusicSource string `json:"musicSource"`
NumMusicians int `json:"numMusicians"`
RehearsalSchedule string `json:"rehearsalSchedule"`
ChorNotes string `json:"chorNotes"`
Musicians []*NewPieceMusician `json:"musicians"`
CostumeDesc string `json:"costumeDesc"`
ItemDesc string `json:"itemDesc"`
LightingDesc string `json:"lightingDesc"`
OtherNotes string `json:"otherNotes"`
}
NewPieceInfoSheet defines how a new piece info sheet is sent to the server.
func (*NewPieceInfoSheet) Validate ¶
func (npis *NewPieceInfoSheet) Validate() error
Validate validates the NewPieceInfoSheets and returns and error if one occurred. Also formats the various fields to be consistent across all submissions.
type NewPieceMusician ¶
type NewPieceMusician struct {
Name string `json:"name"`
Phone string `json:"phone"`
Email string `json:"email"`
}
NewPieceMusician defines how a piece musician is send to the server.
func (*NewPieceMusician) Validate ¶
func (npm *NewPieceMusician) Validate() error
Validate validates the NewPieceMusician and returns and error if one occurred. Also formats the various fields to be consistent across all submissions.
type NewRehearsalTime ¶
type NewRehearsalTime struct {
Title string `json:"title"`
Start time.Time `json:"start"`
End time.Time `json:"end"`
}
NewRehearsalTime defines the structure of a new rehearsal time sent to the server.
func (*NewRehearsalTime) Validate ¶
func (nrt *NewRehearsalTime) Validate() error
Validate validates the current new rehearsal time and normalizes values as applicable. Returns an error if one occurred.
type NewRehearsalTimes ¶
type NewRehearsalTimes []*NewRehearsalTime
NewRehearsalTimes defines a slice of NewRehearsalTimes
func (NewRehearsalTimes) Validate ¶
func (nrt NewRehearsalTimes) Validate() error
Validate validates the NewRehearsalTimes and returns an error if one occurred.
type NewRole ¶
type NewRole struct {
Name string `json:"name"`
DisplayName string `json:"displayName"`
Level int64 `json:"level"`
}
NewRole defines the format of a request which creates a new user role.
type NewShow ¶
type NewShow struct {
AuditionID int `json:"auditionID"`
TypeName string `json:"typeName"`
EndDate time.Time `json:"endDate"`
CreatedBy int `json:"-"`
}
NewShow defines the information needed to create a new show.
type NewUserRequest ¶
type NewUserRequest struct {
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Email string `json:"email"`
Bio string `json:"bio"`
Password string `json:"password"`
PasswordConf string `json:"passwordConf"`
}
NewUserRequest defines the structure of a request for a new user sign up
func (*NewUserRequest) ToUser ¶
func (u *NewUserRequest) ToUser() (*User, error)
ToUser takes this *NewUserRequest and returns a *User from it
type PaginatedAnnouncementResponses ¶
type PaginatedAnnouncementResponses struct {
Page int `json:"page"`
NumPages int `json:"numPages,omitempty"`
Announcements []*AnnouncementResponse `json:"announcements"`
}
PaginatedAnnouncementResponses defines the object that is written back to the client for requests that can contain multiple pages of announcements.
func PaginateAnnouncementResponses ¶
func PaginateAnnouncementResponses(announcements []*AnnouncementResponse, page int) *PaginatedAnnouncementResponses
PaginateAnnouncementResponses returns the given slice of pieces and the page as a PaginatedAnnouncements struct.
func PaginateNumAnnouncementResponses ¶
func PaginateNumAnnouncementResponses(announcements []*AnnouncementResponse, page, numPages int) *PaginatedAnnouncementResponses
PaginateAnnouncementResponses returns the given slice of pieces and the page as well as the number of pages as a PaginatedAnnouncements struct.
type PaginatedAuditions ¶
PaginatedAuditions defines the object that is written back to the client for requests that can contain multiple pages of auditions.
func PaginateAuditions ¶
func PaginateAuditions(auditions []*Audition, page int) *PaginatedAuditions
PaginateAuditions returns the given slice of auditions and the page as a PaginatedAuditions struct.
type PaginatedPieces ¶
type PaginatedPieces struct {
Page int `json:"page"`
NumPages int `json:"numPages"`
Pieces []*Piece `json:"pieces"`
}
PaginatedPieces defines the object that is written back to the client for requests that can contain multiple pages of pieces.
func PaginatePieces ¶
func PaginatePieces(pieces []*Piece, page, numPages int) *PaginatedPieces
PaginatePieces returns the given slice of pieces and the page as a PaginatedPieces struct.
type PaginatedShows ¶
type PaginatedShows struct {
Page int `json:"page"`
NumPages int `json:"numPages,omitempty"`
Shows []*Show `json:"shows"`
}
PaginatedShows defines the object that is written back to the client for requests that can contain multiple pages of shows.
func PaginateNumShows ¶
func PaginateNumShows(shows []*Show, page, numPages int) *PaginatedShows
PaginateNumShows returns the given slice of shows and the page as a PaginatedShows struct.
type PaginatedUserAuditionComments ¶
type PaginatedUserAuditionComments struct {
Page int `json:"page"`
Comments []*UserAuditionComment `json:"comments"`
}
PaginatedUserAuditionComments defines the object that is written back to the client for requests that can contain multiple pages of UserAuditionComments
func PaginateUserAuditionComments ¶
func PaginateUserAuditionComments(comments []*UserAuditionComment, page int) *PaginatedUserAuditionComments
PaginateAnnouncementResponses returns the given slice of pieces and the page as a PaginatedAnnouncements struct.
type PaginatedUserResponses ¶
type PaginatedUserResponses struct {
Page int `json:"page"`
NumPages int `json:"numPages,omitempty"`
Users []*UserResponse `json:"users"`
}
PaginatedUserResponses defines the object that is written back to the client for requests that can contain multiple pages of UserResponse.
func PaginateNumUserResponses ¶
func PaginateNumUserResponses(users []*UserResponse, page, numPages int) *PaginatedUserResponses
PaginateNumUsers returns the given slice of users and the page as a PaginatedUsers struct.
func PaginateUserResponses ¶
func PaginateUserResponses(users []*UserResponse, page int) *PaginatedUserResponses
PaginateUsers returns the given slice of users and the page as a PaginatedUsers struct.
type PaginatedUsers ¶
PaginatedUsers defines the object that is written back to the client for requests that can contain multiple pages of users.
func PaginateUsers ¶
func PaginateUsers(users []*User, page int) *PaginatedUsers
PaginateUsers returns the given slice of users and the page as a PaginatedUsers struct.
type PasswordResetRequest ¶
type PasswordResetRequest struct {
Token string `json:"token"`
Password string `json:"password"`
PasswordConf string `json:"passwordConf"`
}
PasswordResetRequest represents how a password reset confirmation request is sent tio the server.
type PasswordResetTPL ¶
PasswordResetTPL defines the variables that will be inserted into a password reset email HTML template.
type PermissionChecker ¶
type PermissionChecker struct {
// contains filtered or unexported fields
}
PermissionChecker represents a checker for checking specific permissions
func NewPermissionChecker ¶
func NewPermissionChecker(db *Database) (*PermissionChecker, error)
NewPermissionChecker returns a new permission checker hooked up to the given database.
func (*PermissionChecker) ConvertUserSliceToUserResponseSlice ¶
func (pc *PermissionChecker) ConvertUserSliceToUserResponseSlice(users []*User) ([]*UserResponse, error)
ConvertUserSliceToUserResponseSlice converts the given slice of users to a slice of UserResponses. Returns an error if one occurred. TODO: THIS FUNCTION SHOULD NOT BE IN THE PERMISSION CHECKER
func (*PermissionChecker) ConvertUserToUserResponse ¶
func (pc *PermissionChecker) ConvertUserToUserResponse(u *User) (*UserResponse, error)
ConvertUserToUserResponse converts the given User to a UserResponse. Returns an error if the given User contains an a RoleID that doesn't correspond to a Role. TODO: THIS FUNCTION SHOULD NOT BE IN THE PERMISSION CHECKER
func (*PermissionChecker) FlushRoleCache ¶
func (pc *PermissionChecker) FlushRoleCache() error
FlushRoleCache flushes the role cache inside of the permission checker and forces it to rebuild
func (*PermissionChecker) UserCan ¶
func (pc *PermissionChecker) UserCan(u *User, action int) bool
UserCan returns true if the user can do the given basic action.
func (*PermissionChecker) UserCanAddToAudition ¶
func (pc *PermissionChecker) UserCanAddToAudition(u *User, target int64) bool
UserCanAddToAudition returns true if the given user can add users to the given audition
func (*PermissionChecker) UserCanAddToPiece ¶
func (pc *PermissionChecker) UserCanAddToPiece(u *User, pieceID int64) bool
UserCanAddToPiece returns true if the given user can add to the given piece ID
func (*PermissionChecker) UserCanDeleteUser ¶
func (pc *PermissionChecker) UserCanDeleteUser(u *User, target int64) bool
UserCanDeleteUser returns true if the given user can delete the target user, false if otherwise.
func (*PermissionChecker) UserCanEnableUser ¶
func (pc *PermissionChecker) UserCanEnableUser(u *User, target int64) bool
UserCanDeleteUser returns true if the given user can delete the target user, false if otherwise.
func (*PermissionChecker) UserCanModifyPieceInfo ¶
func (pc *PermissionChecker) UserCanModifyPieceInfo(u *User, pieceID int) bool
UserCanSeePieceInfo returns true if the given user can see the given piece's info sheet.
func (*PermissionChecker) UserCanModifyUser ¶
func (pc *PermissionChecker) UserCanModifyUser(u *User, target int64) bool
UserCanModifyUser returns true if the given user can modify the target user, false if otherwise.
func (*PermissionChecker) UserCanRemoveUserFromAudition ¶
func (pc *PermissionChecker) UserCanRemoveUserFromAudition(u *User, target int64) bool
UserCanRemoveUserFromAudition returns true if the given user can remove users or themselves from the given audition.
func (*PermissionChecker) UserCanSeeAvailability ¶
func (pc *PermissionChecker) UserCanSeeAvailability(u *User, target int64) bool
UserCanSeeAvailability returns true if the given user can see the target user's availability.
func (*PermissionChecker) UserCanSeePieceInfo ¶
func (pc *PermissionChecker) UserCanSeePieceInfo(u *User, piece int) bool
UserCanSeePieceInfo returns true if the given user can see the given piece's info sheet.
func (*PermissionChecker) UserCanSeeUser ¶
func (pc *PermissionChecker) UserCanSeeUser(u *User, target int64) bool
UserCanSeeUser returns true if the given user can see the given target user, false if otherwise.
func (*PermissionChecker) UserCanSeeUsersInAudition ¶
func (pc *PermissionChecker) UserCanSeeUsersInAudition(u *User, audition int) bool
UserCanSeeUsersInShow returns true if the given user can see users inside of the given show.
func (*PermissionChecker) UserCanSeeUsersInPiece ¶
func (pc *PermissionChecker) UserCanSeeUsersInPiece(u *User, piece int) bool
UserCanSeeUsersInPiece returns true if the given user can see users inside of the given piece.
func (*PermissionChecker) UserCanSeeUsersInShow ¶
func (pc *PermissionChecker) UserCanSeeUsersInShow(u *User, show int) bool
UserCanSeeUsersInShow returns true if the given user can see users inside of the given show.
func (*PermissionChecker) UserIsAtLeast ¶
func (pc *PermissionChecker) UserIsAtLeast(u *User, role int) bool
UserIsAtLeast returns true if the given user is the given role or higher. False if otherwise, or if there was an error determining this.
type Piece ¶
type Piece struct {
ID int `json:"id"`
InfoSheetID int `json:"infoSheetID"`
ChoreographerID int `json:"choreographerID,omitempty"`
Name string `json:"name"`
ShowID int `json:"showID,omitempty"`
CreatedAt time.Time `json:"createdAt"`
CreatedBy int `json:"createdBy"`
IsDeleted bool `json:"isDeleted"`
}
Piece defines a piece within a show.
type PieceInfoSheet ¶
type PieceInfoSheet struct {
ID int64 `json:"pieceInfoID"`
ChorPhone string `json:"choreographerPhone"`
Title string `json:"title"`
RunTime string `json:"runTime"`
Composers string `json:"composers"`
MusicTitle string `json:"musicTitle"`
PerformedBy string `json:"performedBy"`
MusicSource string `json:"MusicSource"`
NumMusicians int `json:"numMusicians,omitempty"`
RehearsalSchedule string `json:"rehearsalSchedule"`
ChorNotes string `json:"chorNotes"`
Musicians []*PieceMusician `json:"musicians"`
CostumeDesc string `json:"costumeDesc"`
ItemDesc string `json:"itemDesc"`
LightingDesc string `json:"lightingDesc"`
OtherNotes string `json:"otherNotes"`
CreatedAt time.Time `json:"createdAt"`
CreatedBy int `json:"createdBy"`
IsDeleted bool `json:"isDeleted"`
}
PieceInfoSheet defines how a piece info sheet is stored.
type PieceInfoSheetUpdates ¶
type PieceInfoSheetUpdates struct {
ChorPhone string `json:"choreographerPhone"`
Title string `json:"title"`
RunTime string `json:"runTime"`
Composers string `json:"composers"`
MusicTitle string `json:"musicTitle"`
PerformedBy string `json:"performedBy"`
MusicSource string `json:"musicSource"`
RehearsalSchedule string `json:"rehearsalSchedule"`
ChorNotes string `json:"chorNotes"`
CostumeDesc string `json:"costumeDesc"`
ItemDesc string `json:"itemDesc"`
LightingDesc string `json:"lightingDesc"`
OtherNotes string `json:"otherNotes"`
}
PieceInfoSheetUpdates defines how updates to a piece info sheet are made.
func (*PieceInfoSheetUpdates) Validate ¶
func (pisu *PieceInfoSheetUpdates) Validate() error
Validate validates the PieceInfoSheetUpdates and returns and error if one occurred. Also formats the various fields to be consistent across all submissions.
type PieceInviteResponse ¶
type PieceInviteResponse struct {
Choreographer *UserResponse `json:"choreographer"`
Piece *Piece `json:"piece"`
RehearsalSchedule string `json:"rehearsalSchedule"`
ExpiryTime time.Time `json:"expiresAt"`
}
PieceInviteResponse defines how an invite for a given piece is reported to the client.
type PieceMusician ¶
type PieceMusician struct {
ID int64 `json:"id"`
Name string `json:"name"`
Phone string `json:"phone"`
Email string `json:"email"`
CreatedAt time.Time `json:"createdAt"`
CreatedBy int `json:"createdBy"`
IsDeleted bool `json:"isDeleted"`
}
PieceMusician defines how a musician for a piece is stored.
type PieceUsersResponse ¶
type PieceUsersResponse struct {
Page int `json:"page"`
NumPages int `json:"numPages,omitempty"`
Choreographer *UserResponse `json:"choreographer"`
Dancers []*UserResponse `json:"dancers"`
}
PieceUsersResponse represents how the server will report all users in a piece.
func NewPieceUsersResponse ¶
func NewPieceUsersResponse(page, numPages int, chor *UserResponse, dancers []*UserResponse) *PieceUsersResponse
NewPieceUsersResponse returns a new pointer to a PieceUsersResponse from the given information.
type PostCastingRequest ¶
type PostCastingRequest struct {
Rehearsals NewRehearsalTimes `json:"rehearsals,omitempty"`
RehearsalSchedule string `json:"rehearsalSchedule,omitempty"`
}
PostCastingRequest defines how the body of a request to post casting is formatted.
func (*PostCastingRequest) Validate ¶
func (pcr *PostCastingRequest) Validate() error
Validate validates the given PostCastingRequest. Returns an error if one occurred.
type PostCastingResponse ¶
type PostCastingResponse struct {
Message string `json:"message,omitempty"`
Rehearsals RehearsalTimes `json:"rehearsals,omitempty"`
RehearsalSchedule string `json:"rehearsalSchedule,omitempty"`
CastingResults []*CastingConfResult `json:"castingResults"`
}
PostCastingResponse defines the structure of a post casting request response
type RawAvailability ¶
type RawAvailability struct {
ID int
Sunday string
Monday string
Tuesday string
Wednesday string
Thursday string
Friday string
Saturday string
CreatedAt time.Time
IsDeleted bool
}
RawAvailability represents how the availability is stored in an unparsed format inside the database.
type RehearsalTime ¶
type RehearsalTime struct {
ID int64 `json:"id"`
PieceID int `json:"pieceID"`
Title string `json:"title"`
Start time.Time `json:"start"`
End time.Time `json:"end"`
CreatedAt time.Time `json:"createdAt"`
CreatedBy int64 `json:"createdBy"`
IsDeleted bool `json:"isDeleted"`
}
RehearsalTime defines how a rehearsal time for a piece is defined
type RehearsalTimes ¶
type RehearsalTimes []*RehearsalTime
RehearsalTimes defines a slice of rehearsal times
type Role ¶
type Role struct {
ID int64 `json:"id"`
Name string `json:"name"`
DisplayName string `json:"displayName"`
Level int64 `json:"level"`
IsDeleted bool `json:"isDeleted"`
}
RoleID represents how a role is stored in the system,
type RoleChange ¶
type RoleChange struct {
RoleName string `json:"roleName"`
}
RoleChange defines how a role is sent to the server
func (*RoleChange) Validate ¶
func (r *RoleChange) Validate() error
Validate validates the current role and returns an error if one occurred.
type SQLStatement ¶
SQLStatement represents a very basic sql statement builder
func (*SQLStatement) BuildCountQuery ¶
func (ss *SQLStatement) BuildCountQuery() string
func (*SQLStatement) BuildQuery ¶
func (ss *SQLStatement) BuildQuery() string
type Show ¶
type Show struct {
ID int `json:"id"`
TypeID int `json:"typeID"`
AuditionID int `json:"auditionID,omitempty"`
EndDate time.Time `json:"endDate"`
CreatedAt time.Time `json:"createdAt"`
CreatedBy int `json:"createdBy"`
IsDeleted bool `json:"isDeleted"`
}
Show defines the information needed to store a show.
type ShowType ¶
type ShowType struct {
ID int `json:"id"`
Name string `json:"name"`
Desc string `json:"desc"`
CreatedAt time.Time `json:"createdAt"`
CreatedBy int `json:"createdBy"`
IsDeleted bool `json:"isDeleted"`
}
ShowType defines how a ShowType will be stored in the database.
type SignInRequest ¶
SignInRequest defines the data that the server will expect for a sign in request
type TimeBlock ¶
TimeBlock defines a single block of time in a day between start and end. Should be stored in military time.
func ParseTimeBlock ¶
ParseTimeBlock parses the given string into a TimeBlock.
type User ¶
type User struct {
ID int64 `json:"id"`
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Email string `json:"email"`
Bio string `json:"bio"`
PassHash []byte `json:"-"`
RoleID int `json:"roleID"`
Active bool `json:"active"`
CreatedAt time.Time `json:"createdAt"`
}
User defines the properties of a specific user in the system
func (*User) Authenticate ¶
Authenticate (s) the given user with the given password. Returns an error if the authentication failed.
func (*User) SetPassword ¶
SetPassword hashes the given password and sets it as this users passHash
type UserAudition ¶
type UserAudition struct {
ID int `json:"id"`
AuditionID int `json:"auditionID"`
UserID int `json:"userID"`
AvailabilityID int `json:"availabilityID"`
RegNum int `json:"regNum"`
NumShows int `json:"numShows"`
CreatedAt time.Time `json:"createdAt"`
CreatedBy int `json:"createdBy"`
IsDeleted bool `json:"isDeleted"`
}
UserAudition represents how a link between a user and an audition is stored.
type UserAuditionComment ¶
type UserAuditionComment struct {
ID int `json:"id"`
UserAuditionID int `json:"uaID"`
Comment string `json:"comment"`
CreatedAt time.Time `json:"createdAt"`
CreatedBy int `json:"createdBy"`
IsDeleted bool `json:"isDeleted"`
}
UserAuditionComment defines how a comment about a user's audition is stored.
type UserAuditionLink ¶
type UserAuditionLink struct {
Comment string `json:"comment,omitempty"`
Availability *WeekTimeBlock `json:"availability,omitempty"`
}
UserAuditionLink defines the body of a request to add a user to an audition. UserID and AuditionID will come from request URI
func (*UserAuditionLink) Validate ¶
func (ual *UserAuditionLink) Validate() error
Validate validates the current UserAuditionLink and returns an error if one occurred.
type UserAuditionLinkResponse ¶
type UserAuditionLinkResponse struct {
User *User `json:"user"`
Audition *Audition `json:"audition,omitempty"`
AddedAt time.Time `json:"addedAt"`
AddedBy int `json:"addedBy"`
RegNum int `json:"regNum"`
NumShows int `json:"numShows"`
Comments []*UserAuditionComment `json:"comments"`
Availability *WeekTimeBlock `json:"availability"`
}
UserAuditionLinkResponse defines how a link between a user and an audition is reported to the client
type UserResponse ¶
type UserResponse struct {
ID int64 `json:"id"`
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Email string `json:"email"`
Bio string `json:"bio"`
Role *Role `json:"role"`
Active bool `json:"active"`
CreatedAt time.Time `json:"createdAt"`
}
UserResponse defines how a user is encoded back the the client.
type UserUpdates ¶
type UserUpdates struct {
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Bio string `json:"bio"`
}
UserUpdates defines the information that users can change about their profile.
func (*UserUpdates) CheckBioLength ¶
func (u *UserUpdates) CheckBioLength() error
CheckBioLength returns an error if the bio is too long either by word count or character count.
type WeekTimeBlock ¶
type WeekTimeBlock struct {
Days []*DayTimeBlock `json:"days,omitempty"`
CreatedAt time.Time `json:"createdAt,omitempty"`
IsDeleted bool `json:"isDeleted,omitempty"`
}
WeekTimeBlock defines a block of times over the course of the week in which each day has one or many blocks of time.
func (*WeekTimeBlock) ToSerializedDayMap ¶
func (wtb *WeekTimeBlock) ToSerializedDayMap() (map[string]string, error)
ToSerializedDayMap returns a parsed map of the WeekTimeBlock where the keys are the days and the values are serialized arrays of times for those days.
func (*WeekTimeBlock) Validate ¶
func (wtb *WeekTimeBlock) Validate() error
Validate validates that the week time block contains valid day time blocks. Returns an error if one occurred.
Source Files
¶
- announcement_models.go
- announcement_queries.go
- audition_models.go
- audition_queries.go
- auth_models.go
- availability_models.go
- casting_models.go
- casting_queries.go
- comment_models.go
- common.go
- database_error.go
- errorLog.go
- pagination.go
- passwordreset_models.go
- permchecker.go
- piece_models.go
- piece_queries.go
- rehearsal_models.go
- rehearsal_queries.go
- role_models.go
- role_queries.go
- show_audition_queries.go
- show_models.go
- show_queries.go
- sqlstore.go
- tx_helpers.go
- user_audition_models.go
- user_audition_queries.go
- user_models.go
- user_queries.go
- validator.go