models

package
v0.0.0-...-2dd0789 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSocialPrefix

func GetSocialPrefix(contactType SocialType) string

Types

type Application

type Application struct {
	Model

	Title string `json:"title"`
	Link  string `json:"link"`

	RecruitmentID *uuid.UUID `json:"-"`
}

type Category

type Category struct {
	Model

	Name string `json:"name"`
	Tag  []Tag  `json:"-"`
}

type Club

type Club struct {
	Model

	SoftDeletedAt gorm.DeletedAt `json:"-"`

	Name        string `json:"name"`
	Preview     string `json:"preview"`
	Description string `json:"description"`
	NumMembers  int    `json:"num_members"`

	WeeklyTimeCommitment int    `json:"weekly_time_commitment"`
	OneWordToDescribeUs  string `json:"one_word_to_describe_us"`

	Recruitment Recruitment `json:"-"`


	Parent            *uuid.UUID `gorm:"foreignKey:Parent;" json:"-"`
	Tag               []Tag      `gorm:"many2many:club_tags;" json:"-"`
	Member            []User     `gorm:"many2many:user_club_members;" json:"-"`
	Follower          []User     `gorm:"many2many:user_club_followers;" json:"-"`
	IntendedApplicant []User     `gorm:"many2many:user_club_intended_applicants;" json:"-"`
	Comment           []Comment  `json:"-"`
	Leadership        []Leader   `json:"-"`
	Social            []Social   `json:"-"`

	HostEvent    []Event        `gorm:"foreignKey:Host;" json:"-"`
	Event        []Event        `gorm:"many2many:club_events;" json:"-"`
	Notification []Notification `gorm:"polymorphic:Reference;" json:"-"`
}

func (Club) Preload

func (c Club) Preload(db *gorm.DB) *gorm.DB

func (*Club) ToSearchDocument

func (c *Club) ToSearchDocument() interface{}

type ClubSearchDocument

type ClubSearchDocument struct {
	Name        string   `json:"name"`
	Preview     string   `json:"preview"`
	Description string   `json:"description"`
	NumMembers  int      `json:"num_members"`
	Tags        []string `json:"tags"`
}

type College

type College string
const (
	CAMD College = "CAMD" // College of Arts, Media and Design
	DMSB College = "DMSB" // D'Amore-McKim School of Business
	KCCS College = "KCCS" // Khoury College of Computer Sciences
	CE   College = "CE"   // College of Engineering
	BCHS College = "BCHS" // Bouvé College of Health Sciences
	SL   College = "SL"   // School of Law
	CPS  College = "CPS"  // College of Professional Studies
	CS   College = "CS"   // College of Science
	CSSH College = "CSSH" // College of Social Sciences and Humanities
)

type Comment

type Comment struct {
	Model

	Question        string `json:"question"`
	Answer          string `json:"answer"`
	NumFoundHelpful uint   `json:"num_found_helpful"`

	AskedByID uuid.UUID `json:"-"`
	AskedBy   User      `json:"-"`

	ClubID uuid.UUID `json:"-"`
	Club   Club      `json:"-"`

	AnsweredByID *uuid.UUID `json:"-"`
	AnsweredBy   *User      `json:"-"`
}

type Event

type Event struct {
	Model

	// details
	Name        string     `json:"name"`
	Preview     string     `json:"preview"`
	Description string     `json:"description"`
	Host        *uuid.UUID `json:"host"`

	// geoshi
	EventType EventType `json:"event_type"`
	Location  string    `json:"location"`
	Link      string    `json:"link"`

	// internal housekeeping states
	IsPublic   bool `json:"is_public"`
	IsDraft    bool `json:"is_draft"`
	IsArchived bool `json:"is_archived"`

	// timing
	StartTime time.Time `json:"start_time"`
	EndTime   time.Time `json:"end_time"`

	// series
	SeriesID *uuid.UUID `json:"-"`

	// bridgerton
	RSVP         []User         `gorm:"many2many:user_event_rsvps;" json:"-"`
	Waitlist     []User         `gorm:"many2many:user_event_waitlists;" json:"-"`
	Clubs        []Club         `gorm:"many2many:club_events;" json:"-"`
	Tag          []Tag          `gorm:"many2many:event_tags;" json:"-"`
	Notification []Notification `gorm:"polymorphic:Reference;" json:"-"`
}

func (Event) Preload

func (c Event) Preload(db *gorm.DB) *gorm.DB

func (*Event) ToSearchDocument

func (c *Event) ToSearchDocument() interface{}

type EventSearchDocument

type EventSearchDocument struct {
	Name        string    `json:"name"`
	Preview     string    `json:"preview"`
	Description string    `json:"description"`
	EventType   EventType `json:"event_type"`
	StartTime   time.Time `json:"start_time"`
	EndTime     time.Time `json:"end_time"`
	Clubs       []string  `json:"clubs"`
	Tags        []string  `json:"tags"`
}

How Events are represented in the OpenSearch index.

type EventType

type EventType string
const (
	Hybrid   EventType = "hybrid"
	InPerson EventType = "in_person"
	Virtual  EventType = "virtual"
)

type File

type File struct {
	Model

	OwnerID   uuid.UUID `json:"-"`
	OwnerType string    `json:"-"`

	FileName  string `json:"file_name"`
	FileType  string `json:"file_type"`
	FileSize  int    `json:"file_size"`
	FileURL   string `json:"file_url"`
	ObjectKey string `json:"object_key"`
}

type FileInfo

type FileInfo struct {
	FileName  string
	FileType  string
	FileSize  int
	FileURL   string
	ObjectKey string
}

type Follower

type Follower struct {
	UserID uuid.UUID `gorm:"primaryKey;" json:"user_id"`
	ClubID uuid.UUID `gorm:"primaryKey" json:"club_id"`

	Club *Club `json:"-"`
	User *User `json:"-"`
}

func (Follower) TableName

func (Follower) TableName() string

type GraduationCycle

type GraduationCycle string
const (
	December GraduationCycle = "december"
	May      GraduationCycle = "may"
)

type Leader

type Leader struct {
	Model

	Name     string `json:"name"`
	Email    string `json:"email"`
	Position string `json:"position"`

	ClubID uuid.UUID `json:"-"`

	PhotoFile File `gorm:"polymorphic:Owner;" json:"photo_file"`
}

func (Leader) TableName

func (l Leader) TableName() string

type Major

type Major string
const (
	AfricanaStudies                                           Major = "africanaStudies"
	AmericanSignLanguage                                      Major = "americanSignLanguage"
	AmericanSignLanguageEnglishInterpreting                   Major = "americanSignLanguage-EnglishInterpreting"
	AppliedPhysics                                            Major = "appliedPhysics"
	ArchitecturalStudies                                      Major = "architecturalStudies"
	Architecture                                              Major = "architecture"
	ArtArtVisualStudies                                       Major = "art:ArtVisualStudies"
	BehavioralNeuroscience                                    Major = "behavioralNeuroscience"
	Biochemistry                                              Major = "biochemistry"
	Bioengineering                                            Major = "bioengineering"
	Biology                                                   Major = "biology"
	BiomedicalPhysics                                         Major = "biomedicalPhysics"
	BusinessAdministration                                    Major = "businessAdministration"
	BusinessAdministrationAccounting                          Major = "businessAdministration:Accounting"
	BusinessAdministrationAccountingAndAdvisoryServices       Major = "businessAdministration:AccountingAndAdvisoryServices"
	BusinessAdministrationBrandManagement                     Major = "businessAdministration:BrandManagement"
	BusinessAdministrationBusinessAnalytics                   Major = "businessAdministration:BusinessAnalytics"
	BusinessAdministrationCorporateInnovation                 Major = "businessAdministration:CorporateInnovation"
	BusinessAdministrationEntrepreneurialStartups             Major = "businessAdministration:EntrepreneurialStartups"
	BusinessAdministrationFamilyBusiness                      Major = "businessAdministration:FamilyBusiness"
	BusinessAdministrationFinance                             Major = "businessAdministration:Finance"
	BusinessAdministrationFintech                             Major = "businessAdministration:Fintech"
	BusinessAdministrationHealthcareManagementAndConsulting   Major = "businessAdministration:HealthcareManagementAndConsulting"
	BusinessAdministrationManagement                          Major = "businessAdministration:Management"
	BusinessAdministrationManagementInformationSystems        Major = "businessAdministration:ManagementInformationSystems"
	BusinessAdministrationMarketing                           Major = "businessAdministration:Marketing"
	BusinessAdministrationMarketingAnalytics                  Major = "businessAdministration:MarketingAnalytics"
	BusinessAdministrationSocialInnovationAndEntrepreneurship Major = "businessAdministration:SocialInnovationAndEntrepreneurship"
	BusinessAdministrationSupplyChainManagement               Major = "businessAdministration:SupplyChainManagement"
	CellAndMolecularBiology                                   Major = "cellAndMolecularBiology"
	ChemicalEngineering                                       Major = "chemicalEngineering"
	Chemistry                                                 Major = "chemistry"
	CivilEngineering                                          Major = "civilEngineering"
	CommunicationStudies                                      Major = "communicationStudies"
	ComputerEngineering                                       Major = "computerEngineering"
	ComputerScience                                           Major = "computerScience"
	ComputingAndLaw                                           Major = "computingAndLaw"
	CriminologyAndCriminalJustice                             Major = "criminologyAndCriminalJustice"
	CulturalAnthropology                                      Major = "culturalAnthropology"
	Cybersecurity                                             Major = "cybersecurity"
	DataScience                                               Major = "dataScience"
	Design                                                    Major = "design"
	Economics                                                 Major = "economics"
	ElectricalEngineering                                     Major = "electricalEngineering"
	English                                                   Major = "english"
	EnvironmentalAndSustainabilityStudies                     Major = "environmentalAndSustainabilityStudies"
	EnvironmentalEngineering                                  Major = "environmentalEngineering"
	EnvironmentalScience                                      Major = "environmentalScience"
	EnvironmentalStudies                                      Major = "environmentalStudies"
	GameArtAndAnimation                                       Major = "gameArtAndAnimation"
	GameDesign                                                Major = "gameDesign"
	GlobalAsianStudies                                        Major = "globalAsianStudies"
	HealthScience                                             Major = "healthScience"
	History                                                   Major = "history"
	HistoryCultureAndLaw                                      Major = "historyCultureAndLaw"
	HumanServices                                             Major = "humanServices"
	IndustrialEngineering                                     Major = "industrialEngineering"
	InternationalAffairs                                      Major = "internationalAffairs"
	InternationalBusiness                                     Major = "internationalBusiness"
	InternationalBusinessAccounting                           Major = "internationalBusiness:Accounting"
	InternationalBusinessAccountingAndAdvisoryServices        Major = "internationalBusiness:AccountingAndAdvisoryServices"
	InternationalBusinessBrandManagement                      Major = "internationalBusiness:BrandManagement"
	InternationalBusinessBusinessAnalytics                    Major = "internationalBusiness:BusinessAnalytics"
	InternationalBusinessCorporateInnovation                  Major = "internationalBusiness:CorporateInnovation"
	InternationalBusinessEntrepreneurialStartups              Major = "internationalBusiness:EntrepreneurialStartups"
	InternationalBusinessFamilyBusiness                       Major = "internationalBusiness:FamilyBusiness"
	InternationalBusinessFinance                              Major = "internationalBusiness:Finance"
	InternationalBusinessFintech                              Major = "internationalBusiness:Fintech"
	InternationalBusinessHealthcareManagementAndConsulting    Major = "internationalBusiness:HealthcareManagementAndConsulting"
	InternationalBusinessManagement                           Major = "internationalBusiness:Management"
	InternationalBusinessManagementInformationSystems         Major = "internationalBusiness:ManagementInformationSystems"
	InternationalBusinessMarketing                            Major = "internationalBusiness:Marketing"
	InternationalBusinessMarketingAnalytics                   Major = "internationalBusiness:MarketingAnalytics"
	InternationalBusinessSocialInnovationAndEntrepreneurship  Major = "internationalBusiness:SocialInnovationAndEntrepreneurship"
	InternationalBusinessSupplyChainManagement                Major = "internationalBusiness:SupplyChainManagement"
	Journalism                                                Major = "journalism"
	LandscapeArchitecture                                     Major = "landscapeArchitecture"
	Linguistics                                               Major = "linguistics"
	MarineBiology                                             Major = "marineBiology"
	Mathematics                                               Major = "mathematics"
	MechanicalEngineering                                     Major = "mechanicalEngineering"
	MediaAndScreenStudies                                     Major = "mediaAndScreenStudies"
	MediaArts                                                 Major = "mediaArts"
	Music                                                     Major = "music"
	MusicTechnology                                           Major = "musicTechnology"
	Nursing                                                   Major = "nursing"
	PharmaceuticalSciences                                    Major = "pharmaceuticalSciences"
	PharmacyPharmD                                            Major = "pharmacy(PharmD)"
	Philosophy                                                Major = "philosophy"
	Physics                                                   Major = "physics"
	PoliticalScience                                          Major = "politicalScience"
	PoliticsPhilosophyEconomics                               Major = "politicsPhilosophyEconomics"
	Psychology                                                Major = "psychology"
	PublicHealth                                              Major = "publicHealth"
	PublicRelations                                           Major = "publicRelations"
	ReligiousStudies                                          Major = "religiousStudies"
	Sociology                                                 Major = "sociology"
	Spanish                                                   Major = "spanish"
	SpeechLanguagePathologyAndAudiology                       Major = "speechLanguagePathologyAndAudiology"
	Theatre                                                   Major = "theatre"
)

see https://admissions.northeastern.edu/academics/areas-of-study/

type Membership

type Membership struct {
	UserID uuid.UUID `gorm:"primaryKey;" json:"user_id"`
	ClubID uuid.UUID `gorm:"primaryKey;" json:"club_id"`

	Club *Club `json:"-"`
	User *User `json:"-"`

	MembershipType MembershipType `json:"membership_type"`
}

func (Membership) TableName

func (Membership) TableName() string

type MembershipType

type MembershipType string
const (
	MembershipTypeMember MembershipType = "member"
	MembershipTypeAdmin  MembershipType = "admin"
)

type Model

type Model struct {
	ID        uuid.UUID `gorm:"default:uuid_generate_v4();" json:"id" example:"123e4567-e89b-12d3-a456-426614174000"`
	CreatedAt time.Time `json:"created_at" example:"2023-09-20T16:34:50Z"`
	UpdatedAt time.Time `json:"updated_at" example:"2023-09-20T16:34:50Z"`
}

type Notification

type Notification struct {
	Model

	SendAt   time.Time `json:"send_at"`
	Title    string    `json:"title"`
	Content  string    `json:"content"`
	DeepLink string    `json:"deep_link"`
	Icon     string    `json:"icon"`

	ReferenceID   uuid.UUID        `json:"-"`
	ReferenceType NotificationType `json:"-"`
}

type NotificationType

type NotificationType string
const (
	EventNotification NotificationType = "event"
	ClubNotification  NotificationType = "club"
)

type Recruitment

type Recruitment struct {
	Model

	Cycle RecruitmentCycle `json:"cycle"`
	Type  RecruitmentType  `gorm:"column:_type" json:"type"`

	ClubID uuid.UUID `json:"-"`

	Application []Application `json:"-"`
}

func (Recruitment) TableName

func (r Recruitment) TableName() string

type RecruitmentCycle

type RecruitmentCycle string
const (
	Fall       RecruitmentCycle = "fall"
	Spring     RecruitmentCycle = "spring"
	FallSpring RecruitmentCycle = "fallSpring"
	Always     RecruitmentCycle = "always"
)

type RecruitmentType

type RecruitmentType string
const (
	RecruitmentTypeUnrestricted RecruitmentType = "unrestricted"
	RecruitmentTypeTryout       RecruitmentType = "tryout"
	RecruitmentTypeApplication  RecruitmentType = "application"
)

type Social

type Social struct {
	Model

	Type    SocialType `json:"type"`
	Content string     `json:"content"`

	ClubID uuid.UUID `json:"-"`
}

type SocialType

type SocialType string
const (
	Facebook   SocialType = "facebook"
	Instagram  SocialType = "instagram"
	X          SocialType = "x"
	LinkedIn   SocialType = "linkedin"
	YouTube    SocialType = "youtube"
	GitHub     SocialType = "github"
	Slack      SocialType = "slack"
	Discord    SocialType = "discord"
	Email      SocialType = "email"
	CustomSite SocialType = "customSite"
)

type Tag

type Tag struct {
	Model

	Name string `json:"name"`

	CategoryID uuid.UUID `json:"category_id"`

	User  []User  `gorm:"many2many:user_tags;" json:"-"`
	Club  []Club  `gorm:"many2many:club_tags;" json:"-"`
	Event []Event `gorm:"many2many:event_tags;" json:"-"`
}

type User

type User struct {
	Model

	Role            UserRole        `json:"role"`
	Name            string          `json:"name"`
	Email           string          `json:"email"`
	Major0          Major           `json:"major0"`
	Major1          Major           `json:"major1"`
	Major2          Major           `json:"major2"`
	College         College         `json:"college"`
	GraduationCycle GraduationCycle `json:"graduation_cycle"`
	GraduationYear  int16           `json:"graduation_year"`
	AvatarURL       string          `json:"avatar_url"`

	Tag               []Tag     `gorm:"many2many:user_tags;" json:"-"`
	Admin             []Club    `gorm:"many2many:user_club_admins;" json:"-"`
	Member            []Club    `gorm:"many2many:user_club_members;" json:"-"`
	Follower          []Club    `gorm:"many2many:user_club_followers;" json:"-"`
	IntendedApplicant []Club    `gorm:"many2many:user_club_intended_applicants;" json:"-"`
	Asked             []Comment `gorm:"foreignKey:AskedByID;" json:"-"`
	Answered          []Comment `gorm:"foreignKey:AnsweredByID;" json:"-"`
	RSVP              []Event   `gorm:"many2many:user_event_rsvps;" json:"-"`
	Waitlist          []Event   `gorm:"many2many:user_event_waitlists;" json:"-"`
}

func UnmarshalUser

func UnmarshalUser(user string) *User

func (*User) AfterCreate

func (u *User) AfterCreate(tx *gorm.DB) (err error)

func (*User) AfterDelete

func (u *User) AfterDelete(tx *gorm.DB) (err error)

func (*User) Marshal

func (u *User) Marshal() (*string, error)

type UserRole

type UserRole string
var (
	Super   UserRole = "super"
	Student UserRole = "student"
)

type WelcomeTask

type WelcomeTask struct {
	Email    string `gorm:"primaryKey"`
	Name     string
	Attempts int
}

Jump to

Keyboard shortcuts

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