models

package
v0.0.0-...-b59d68e Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth0Config

type Auth0Config struct {
	Domain   string
	ClientID string
	Audience string
}

type Author

type Author struct {
	ID     uint   `gorm:"primaryKey;not null;unique;index" json:"ID" example:"1"`
	UserID string `gorm:"not null;unique" json:"UserID" example:"123e4567-e89b-12d3-a456-426614174000"`
}

type Category

type Category struct {
	gorm.Model
	CategoryName string `gorm:"not null;unique" json:"CategoryName" example:"desserts"`
}

Category struct to hold category data

type Config

type Config struct {
	Global          GlobalConfig
	Cors            CorsConfig
	Auth0           Auth0Config
	Database        DatabaseConfig
	S3              S3Config
	DatabaseClient  *gorm.DB
	S3ClientSession *s3.S3
}

type CorsConfig

type CorsConfig struct {
	AllowedOrigins   []string
	AllowCredentials bool
	AllowedHeaders   []string
	AllowedMethods   []string
	Debug            bool
}

type DatabaseConfig

type DatabaseConfig struct {
	Host     string
	Username string
	Password string
	Database string
	Port     int
	SSLMode  string
	Timezone string
}

DatabaseConfig holds database configuration items

type GlobalConfig

type GlobalConfig struct {
	Debug bool
}

GlobalConfig holds global configuration items

type Ingredient

type Ingredient struct {
	gorm.Model
	IngredientName string `gorm:"unique; not null" json:"IngredientName" example:"apple"`
}

Ingredient struct to hold ingredient data

type Instruction

type Instruction struct {
	gorm.Model
	RecipeID uint   `json:"RecipeID" example:"1"`
	Recipe   Recipe `gorm:"references:ID" json:"-"`
	// StepNumber  int    `json:"StepNumber" example:"1"` // TODO introduce later
	Description string `gorm:"size:65535" json:"Description" example:"lorem ipsum dolor sit amet"`
}

Instruction struct to hold instruction data

type Recipe

type Recipe struct {
	gorm.Model
	RecipeName      string       `gorm:"not null" json:"RecipeName" example:"apple pie"`
	Description     string       `gorm:"size:65535;not null" json:"Description" example:"pie with apples"`
	DifficultyLevel int          `gorm:"not null" json:"DifficultyLevel" example:"1"`
	CookingTime     int          `gorm:"default:0" json:"CookTime" example:"23"`
	ServingCount    int          `gorm:"default:0" json:"ServingCount" example:"4"`
	Ingredient      []Ingredient `gorm:"many2many:recipe_ingredient;" json:"Ingredients"`
	Category        []Category   `gorm:"many2many:recipe_category;" json:"Categories"`
	Tags            []Tag        `gorm:"many2many:recipe_tag;" json:"Tags"`
	ImageName       string       `json:"ImageName" example:"123e4567-e89b-12d3-a456-426614174000"`
	AuthorID        string       `json:"Author" example:"123e4567-e89b-12d3-a456-426614174000"`
	Author          Author       `gorm:"references:UserID" json:"-"`
}

Recipe struct to hold recipe data

type RecipeIngredient

type RecipeIngredient struct {
	RecipeID     int  `gorm:"primaryKey" json:"RecipeID" example:"1"`
	IngredientID int  `gorm:"primaryKey" json:"IngredientID" example:"1"`
	Quantity     int  `json:"Quantity" example:"40"`
	UnitID       int  `json:"UnitID" example:"1"`
	Unit         Unit `gorm:"references:ID"`
}

RecipeIngredient struct to hold recipe ingredient data

type S3Config

type S3Config struct {
	AWSRegion       string
	AWSAccessKey    string
	AWSAccessSecret string
	BucketName      string
	Endpoint        string
}

type Tag

type Tag struct {
	gorm.Model
	TagName string `gorm:"not null;unique" json:"TagName" example:"pies"`
}

Tag struct to hold tag data

type Unit

type Unit struct {
	ID        uint   `gorm:"primaryKey;not null;unique;index" json:"ID" example:"1"`
	FullName  string `gorm:"not null;unique" json:"FullName" example:"Fluid ounce"`
	ShortName string `gorm:"not null;unique" json:"ShortName" example:"fl oz"`
}

type User

type User struct {
	Provider string `json:"provider"`
	UserID   string `json:"user_id"`
}

Jump to

Keyboard shortcuts

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