Documentation ¶
Index ¶
Constants ¶
const ( FeeColumn = "fee" DescriptionColumn = "description" LocationColumn = "location" LogoColumn = "logo" ManagedClubColumn = "Managed" ClubIDVar = "cid" AllClubInfo = "all" AllClubEventsHost = "events" ClubTagTable = "club_tag" SetsColumn = "Sets" HostsColumn = "Hosts" SizeColumn = "size" BioColumn = "bio" ClubTable = "club" NameColumn = "name" ActiveColumn = "active" )
Club variables for db columns/route variables
const ( UsernameVar = "username" UsernameColumn = "username" EmailColumn = "email" PasswordColumn = "password" )
Credential variables for db columns/route variables
const ( DateTimeColumn = "date_time" EventIDVar = "eid" EventTable = "event" )
Event variables for db columns/route variables
const ( OpAdd = "ADD" OpRemove = "REMOVE" )
Operation variables for adding/removing models
const ( TagNameVar = "tagName" TagTable = "tag" IsActiveColumn = "IsActive" )
Tag variables for db columns/route variables
const ( RefreshTokenVar = "RefreshToken" TokenVar = "token" )
Token variable constants
const ( AllUserInfo = "all" AllUserClubsManage = "clubs" AllUserEventsAttend = "events" ChoosesColumn = "Chooses" AttendsColumn = "Attends" SwipedColumn = "Swiped" UserClubTable = "user_club" UserTable = "user" ManagesColumn = "Manages" IsApprovedColumn = "is_approved" IDColumn = "id" )
User variables for db columns/route variables
Variables ¶
var IsOwnerColumn = "is_owner"
IsOwnerColumn represents the is_owner column in the UserClub joint table
Functions ¶
This section is empty.
Types ¶
type Base ¶
type Base struct { ID uint `gorm:"primarykey" json:"id"` CreatedAt time.Time `json:"-" json:"createdAt"` UpdatedAt time.Time `json:"-" json:"updatedAt"` DeletedAt gorm.DeletedAt `json:"-" gorm:"index" json:"deletedAt"` }
Base - Revamped the current default base GORM model to provide more flexibility when encoding to JSON This reduces extra DisplayWrappers in order to obtain the ID
type Club ¶
type Club struct { Base Name string `validate:"required,min=3,max=50" json:"name"` Email string `validate:"required,email" json:"email"` Bio string `validate:"required,min=1,max=300" json:"bio"` Size int `validate:"required,gt=0" json:"size"` Active bool `json:"-"` Logo string `json:"logo"` Sets []Tag `gorm:"many2many:club_tag;foreignKey:id;References:Name;" json:"tags"` Hosts []Event `gorm:"many2many:club_event;" json:"hosts"` Managed []User `gorm:"many2many:user_club;" json:"-"` }
Club - Base Club struct
func (*Club) DisplayBaseClubInfo ¶
func (c *Club) DisplayBaseClubInfo() ClubBaseInfo
DisplayBaseClubInfo displays base club data
type ClubBaseInfo ¶
ClubBaseInfo - Displaying basic club data
type ClubUpdateInfo ¶
type ClubUpdateInfo struct { Size int `validate:"required,gt=0"` Bio string `validate:"required,max=300"` }
ClubUpdateInfo - Payload for updating a club's info
func NewClubUpdate ¶
func NewClubUpdate() *ClubUpdateInfo
NewClubUpdate returns a struct to update club info
type Credentials ¶
type Credentials struct { Username string `gorm:"UNIQUE" validate:"alpha,min=2,max=15,required" json:"username"` Email string `gorm:"UNIQUE" validate:"required,email" json:"email"` // Max 45 due to 50 length limitation of bcrypt Password string `validate:"required,min=3,max=45" json:"password"` }
Credentials struct for user login/signup
func NewCredentials ¶
func NewCredentials() *Credentials
NewCredentials - Create new default Credentials
type Event ¶
type Event struct { Base Name string `validate:"required,min=1,max=50" json:"name"` DateTime time.Time `validate:"required" json:"datetime"` Description string `validate:"required,max=300" json:"description"` Location string `validate:"required,max=300" json:"location"` Fee float64 `validate:"gte=0" json:"fee"` }
Event - Basic Event Struct
type EventRequirement ¶
type EventRequirement struct { Admin string `json:"admin"` Name string `json:"name"` DateTime string `json:"datetime"` Description string `json:"description"` Location string `json:"location"` Fee string `json:"fee"` }
EventRequirement - Listing out requirements for an event to be successfully created
func NewEventRequirement ¶
func NewEventRequirement() *EventRequirement
NewEventRequirement returns the requirements when creating an event See model.event or docs for event constraints
type ManagesDisplay ¶
ManagesDisplay is used as a display wrapper for the ClubDisplay For a users managed club, whether they're an owner or not is also displayed
type PasswordChange ¶
type PasswordChange struct { OldPassword string `validate:"required"` NewPassword string `validate:"required"` }
PasswordChange - Resetting a user password given the old and new passwords
func NewPasswordChange ¶
func NewPasswordChange() *PasswordChange
NewPasswordChange - Create new default PasswordChange
type Tag ¶
type Tag struct { ID uint `gorm:"autoIncrement" json:"id"` CreatedAt time.Time `json:"-"` UpdatedAt time.Time `json:"-"` DeletedAt gorm.DeletedAt `json:"-" gorm:"index"` Name string `gorm:"primarykey" validate:"required,min=1,max=25" json:"name"` IsActive bool `json:"isActive"` }
Tag - Basic Tag Struct
type TokenInfo ¶
type TokenInfo struct { // Life span of 5 minutes AccessToken string // Life span of 1 hour RefreshToken string }
TokenInfo struct containing the Access and Refresh token
type User ¶
type User struct { Base *Credentials `json:"-"` Manages []Club `gorm:"many2many:user_club;" json:"-"` Chooses []Tag `gorm:"many2many:user_tag;foreignKey:id;References:Name" json:"-"` Attends []Event `gorm:"many2many:user_event;" json:"-"` IsAdmin bool `json:"-"` IsApproved bool `json:"-"` Swiped []Club `gorm:"many2many:user_swipe_club;" json:"-"` }
User base struct
func (*User) DisplayAllInfo ¶
func (u *User) DisplayAllInfo() *UserDisplay
DisplayAllInfo public user data
func (*User) DisplayBaseUserInfo ¶
func (u *User) DisplayBaseUserInfo() UserBaseInfo
DisplayBaseUserInfo displays base user data
type UserBaseInfo ¶
UserBaseInfo - Displaying basic user data
type UserClub ¶
UserClub - Database format for many to many relation with User and Club Keeping a record of users to clubs and whether they're an associated owner of the club or not
type UserDisplay ¶
type UserDisplay struct { Email string `json:"email"` Manages []*ManagesDisplay `json:"manages"` Tags []Tag `json:"tags"` Attends []Event `json:"attends"` Swiped []Club `json:"swiped"` }
UserDisplay - Displaying public user data