models

package
v0.0.0-...-79968f4 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: MIT Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Activities

type Activities struct {
	gorm.Model
	ID          string         `json:"id" gorm:"primaryKey"`
	Title       string         `json:"title"`
	Description string         `json:"description"`
	Types       []ActivityType `gorm:"foreignKey:ActivityID"`
	ImageURL    string         `json:"imageUrl"`   // Cover Image
	ColourCode  string         `json:"colourCode"` // Sport Colour code
}

func (Activities) TableName

func (Activities) TableName() string

type ActivityAndActivityTypeMapping

type ActivityAndActivityTypeMapping struct {
	gorm.Model
	ID                string            `json:"id" gorm:"primaryKey"`
	UserActivityMapID string            `json:"user_activity_map_id"`
	ActivityType      string            `json:"activity_type"`
	DrillMappings     []DrillCompletion `json:"drill_mappings" gorm:"foreignKey:ActivityMapID"`
}

type ActivityType

type ActivityType struct {
	gorm.Model
	ID          string  `json:"id" gorm:"primaryKey"`
	Title       string  `json:"title"`
	Description string  `json:"description"`
	Headline    string  `json:"headline"` // Headlines like GET READY FOR etc.
	ImageURL    string  `json:"imageUrl"` // Cover Image
	ActivityID  string  `json:"activityID"`
	Drills      []Drill `gorm:"foreignKey:ActivityTypeID"`
}

type Drill

type Drill struct {
	gorm.Model
	ID             string `json:"id" gorm:"primaryKey"`
	ActivityTypeID string `json:"activityTypeID"`
	Title          string `json:"title"`
	Details        string `json:"description"` // Reps, extra info etc.
	VideoURL       string `json:"videoUrl"`
}

type DrillCompletion

type DrillCompletion struct {
	gorm.Model
	ID            string `json:"id" gorm:"primaryKey"`
	ActivityMapID string `json:"activity_map_id"`
	DrillID       string `json:"drill"`
}

type Excercise

type Excercise struct {
	gorm.Model
	ID               string `json:"id" gorm:"primaryKey"`
	Title            string `json:"title"`
	VideoURL         string `json:"videoUrl"`
	Description      string `json:"description"`
	Popularity       int    `json:"popoularity"`
	SubMuscleGroupID string `json:"subMuscleGroupID"`
}

type MarkedQuestionSet

type MarkedQuestionSet struct {
	gorm.Model
	UserID string        `json:"uid" gorm:"uniqueIndex"`
	Marked pq.Int32Array `json:"marked" gorm:"type:int[]"`
}

type MuscleGroup

type MuscleGroup struct {
	gorm.Model
	ID              string           `json:"id" gorm:"primaryKey"`
	Title           string           `json:"title"`
	SubMuscleGroups []SubMuscleGroup `gorm:"foreignKey:MuscleGroupID"`
}

type QuestionSet

type QuestionSet struct {
	gorm.Model
	ID        int32          `json:"id" gorm:"primaryKey;autoIncrement:true;unique"`
	Questions pq.StringArray `json:"questions" gorm:"type:text[]"`
}

type SubMuscleGroup

type SubMuscleGroup struct {
	gorm.Model
	ID            string      `json:"id" gorm:"primaryKey"`
	Title         string      `json:"title"`
	Excercises    []Excercise `gorm:"foreignKey:SubMuscleGroupID"`
	MuscleGroupID string      `json:"muscleGroupID"`
}

type Thoughts

type Thoughts struct {
	gorm.Model
	UserID        string    `json:"uid"`
	DateOfThought time.Time `json:"date" gorm:"type:timestamp"`
	Thought       string    `json:"thought" gorm:"type:text"`
}

type User

type User struct {
	gorm.Model
	ID       string `json:"id" gorm:"primaryKey"`
	Username string `json:"username" gorm:"unique;not null"`
	Fname    string `json:"fname" gorm:"not null"`
	Lname    string `json:"lname" gorm:"not null"`
	Email    string `json:"email" gorm:"unique;not null"`
	Password string `json:"-" gorm:"not null"`
	Age      int    `json:"age" gorm:"not null"`
	Access   string `json:"access" gorm:"not null"` //free or premium
	Verified bool   `json:"verified" gorm:"not null"`
	OTP      string `json:"otp"`
}

User struct represents a user in the system. Embedded GORM struct. Includes ID,CreatedAt,UpdatedAt,DeletedAt fields.

func (*User) AfterUpdate

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

afterupdate gorm hook to auto delete all OTPs every 5 mins

type UserActivityMapping

type UserActivityMapping struct {
	gorm.Model
	ID               string                           `json:"id" gorm:"primaryKey"`
	UserID           string                           `json:"user_id"`
	ActivityID       string                           `json:"activity_id"`
	ActivityMappings []ActivityAndActivityTypeMapping `json:"activity_mappings" gorm:"foreignKey:UserActivityMapID"`
}

Jump to

Keyboard shortcuts

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