Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attendance ¶
type Attendance struct { ID uint `gorm:"primaryKey" json:"id"` UserID uint `gorm:"not null" json:"user_id"` EventID uint `gorm:"not null" json:"event_id"` ScannedTime time.Time `gorm:"not null" json:"scanned_time"` // Relationships User User `gorm:"foreignKey:UserID" json:"user"` Event Event `gorm:"foreignKey:EventID" json:"event"` }
type Award ¶
type Award struct { ID uint `gorm:"primaryKey" json:"id"` Name string `gorm:"size:255;not null" json:"name"` Description string `gorm:"type:text" json:"description"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Points int `gorm:"default:0" json:"points"` IconURL string `gorm:"size:512" json:"icon_url"` // Relationships Events []Event `gorm:"many2many:event_awards" json:"events"` // Many-to-many relationship with events }
type Event ¶
type Event struct { ID uint `gorm:"primaryKey" json:"id"` Name string `gorm:"size:255;not null" json:"name"` Description string `gorm:"type:text" json:"description"` Location string `gorm:"size:255" json:"location"` StartTime *time.Time `gorm:"type:timestamptz" json:"start_time"` // Pointer to time.Time, allows NULL EndTime *time.Time `gorm:"type:timestamptz" json:"end_time"` // Pointer to time.Time, allows NULL OrganizerID uint `gorm:"not null" json:"organizer_id"` // ID of the user who organized the event PointsAllocation int `gorm:"default:0" json:"points_allocation"` ImageURL string `gorm:"size:512" json:"icon_url"` // Relationships Organizer User `gorm:"foreignKey:OrganizerID" json:"organizer"` Awards []Award `gorm:"many2many:event_awards" json:"awards"` // Many-to-many relationship with awards }
type User ¶
type User struct { ID uint `gorm:"primaryKey" json:"id"` Name string `gorm:"size:255;not null" json:"name"` Email string `gorm:"size:255;unique;not null" json:"email"` Password string `gorm:"size:255" json:"-"` // Exclude password from JSON PhotoURL string `gorm:"size:512" json:"photo_url"` GoogleID string `gorm:"size:255" json:"-"` // Exclude Google ID from JSON RefreshToken string `gorm:"size:512" json:"-"` // Refresh token RefreshTokenExp time.Time `json:"-"` // Refresh token expiration time GradYear int `gorm:"not null" json:"grad_year"` CurrentPoints int `gorm:"default:0" json:"current_points"` AwardsEarned []Award `gorm:"many2many:user_badges" json:"badges"` // Many-to-many relationship RegistrationDate time.Time `gorm:"not null" json:"registration_date"` Status string `gorm:"size:50;check:status IN ('active', 'inactive', 'banned');default:'active'" json:"status"` Role string `gorm:"size:50;check:role IN ('admin', 'staff', 'student');default:'student'" json:"role"` Department string `gorm:"size:255" json:"department"` Title string `gorm:"size:255" json:"title"` Biography string `gorm:"type:text" json:"biography"` OTP string `gorm:"size:6" json:"-"` // OTP for email verification OTPExpiresAt time.Time `json:"-"` // OTP expiration time CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` }
func (*User) CheckPassword ¶
CheckPassword checks if the provided password matches the hash
func (*User) HashPassword ¶
HashPassword hashes the user's password
type UserStatus ¶
type UserStatus string
const ( StatusActive UserStatus = "active" StatusInactive UserStatus = "inactive" StatusBanned UserStatus = "banned" )
Click to show internal directories.
Click to hide internal directories.