models

package
v0.0.0-...-eea28b3 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute struct {
	gorm.Model
	Name      string            `gorm:"size:255;not null"`
	Quantity  AttributeQuantity `gorm:"not null"`
	CreatedBy uint              `gorm:"not null"` // Foreign key to the User model
}

Attribute represents a single attribute that can be associated with a mood entry. This can be anything you might want associated with a mood entry.

type AttributeQuantity

type AttributeQuantity int
const (
	Low AttributeQuantity = iota + 1
	Medium
	High
)

type AuthProvider

type AuthProvider struct {
	gorm.Model
	ProviderKey  string `gorm:"size:255;not null"`
	UserID       uint   // Foreign key to the User model
	ProviderName string `gorm:"size:255;not null"`
}

type DeletionConfirmation

type DeletionConfirmation struct {
	gorm.Model
	Email     string `gorm:"unique"`
	OTP       string
	ValidTill time.Time
}

type ForgotPassword

type ForgotPassword struct {
	gorm.Model
	Email     string `gorm:"unique"`
	OTP       string
	ValidTill time.Time
}

type Mood

type Mood struct {
	gorm.Model
	UserID uint     `gorm:"not null"` // Foreign key to the User model
	Mood   MoodType `gorm:"not null"`
	Notes  string   `gorm:"size:255;"` // Notes are optional
}

Mood represents a single mood entry made by a specific user.

type MoodAttribute

type MoodAttribute struct {
	gorm.Model
	MoodID      uint `gorm:"primaryKey;not null"` // Foreign key to the Mood model
	AttributeID uint `gorm:"primaryKey;not null"` // Foreign key to the Attribute model
}

MoodAttribute represents the attributes of a mood entry. Many to many relationship with Mood.

type MoodResponse

type MoodResponse struct {
	ID         uint        `json:"id"`
	Mood       Mood        `json:"mood"`
	Attributes []Attribute `json:"attributes"`
}

MoodResponse represents the response body for a single mood entry.

type MoodType

type MoodType int

MoodType represents the type of mood that a user can have. The mood types are: Angry, Sad, Neutral, Happy, Excited.

const (
	Angry MoodType = iota + 1
	Sad
	Neutral
	Happy
	Excited
)

type PasswordAuth

type PasswordAuth struct {
	gorm.Model
	Email    string `gorm:"size:255;not null;unique;"`
	Password string `gorm:"size:255;not null;"`
	UserID   uint   `gorm:"unique;"`
}

func (*PasswordAuth) HashPassword

func (pa *PasswordAuth) HashPassword() error

type Rating

type Rating int
const (
	OneStar Rating = iota + 1
	TwoStar
	ThreeStar
	FourStar
	FiveStar
)

type Resource

type Resource struct {
	gorm.Model
	CreatedBy uint   `gorm:"not null"` // Foreign key to the User model
	Title     string `gorm:"size:255;not null"`
	Content   string `gorm:"size:10000;not null"`
	URL       string `gorm:"size:255;not null"`
	External  bool   `gorm:"not null"` // True if the resource is external, false default
	AdminPost bool   `gorm:"not null"` // True if the resource is posted by an admin, false default
}

type ResourceResponse

type ResourceResponse struct {
	ID       uint     `json:"id"`
	Resource Resource `json:"resource"`
	Reviews  []Review `json:"reviews"`
}

type Review

type Review struct {
	gorm.Model
	ResourceID uint   `gorm:"not null"` // Foreign key to the Resource model
	UserID     uint   `gorm:"not null"` // Foreign key to the User model
	Content    string `gorm:"size:10000;not null"`
	Rating     Rating `gorm:"not null"` // Rating out of 5
}

type User

type User struct {
	gorm.Model
	Email        string `gorm:"size:255;not null;unique;"`
	Name         string `gorm:"size:255;not null;"`
	ProfileImage string `gorm:"size:255;"`
	Verified     bool   `gorm:"default:false"`
	Admin        bool   `gorm:"default:false"` // TODO add admin route to disable user
	Disabled     bool   `gorm:"default:false"` // TODO disabled user should not be able to login/access routes => edit middleware

}

type VerificationEntry

type VerificationEntry struct {
	gorm.Model
	Email string `gorm:"unique"`
	OTP   string
}

Jump to

Keyboard shortcuts

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