models

package
v0.0.0-...-15a86da Latest Latest
Warning

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

Go to latest
Published: May 30, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Author

type Author struct {
	CreatedAt     time.Time
	UpdatedAt     time.Time
	DeletedAt     gorm.DeletedAt `gorm:"index"`
	FirstName     string         `gorm:"primaryKey;not null" json:"first_name"`
	LastName      string         `gorm:"primaryKey" json:"last_name"`
	Bio           string         `gorm:"type:text" json:"bio"`
	OriginCountry string         `gorm:"primaryKey;not null" json:"origin_country"`
	Stories       []Story        `` /* 177-byte string literal not displayed */
}

Author struct describes a story author

type Claims

type Claims struct {
	Email string `json:"email"`
	jwt.StandardClaims
}

Claims is a custom JWT claim type not persisted in db

type Country

type Country struct {
	gorm.Model
	Name string `gorm:"primaryKey;not null" json:"country_name"`
}

type Story

type Story struct {
	gorm.Model
	Title           string  `gorm:"not null" json:"title"`
	Content         string  `gorm:"type:text;not null" json:"content"`
	CurrentCity     string  `gorm:"not null" json:"current_city"`
	Year            uint    `gorm:"not null" json:"year"`
	IsVisible       bool    `gorm:"default:false" json:"is_visible"`
	Summary         string  `gorm:"type:text" json:"summary"`
	Latitude        float64 `gorm:"not null" json:"latitude"`
	Longitude       float64 `gorm:"not null" json:"longitude"`
	ImageURL        string  `gorm:"type:text" json:"image_url"`
	VideoURL        string  `gorm:"type:text" json:"video_url"`
	AuthorFirstName string  `json:"author_first_name"`
	AuthorLastName  string  `json:"author_last_name"`
	AuthorCountry   string  `json:"author_country"`
	Author          Author  `gorm:"foreignKey:AuthorFirstName,AuthorLastName,AuthorCountry;references:FirstName,LastName,OriginCountry" json:"author"`
}

Story struct describes a story rendered on the map

type Tag

type Tag struct {
	gorm.Model
	Name    string `gorm:"primaryKey;not null" json:"name"`
	StoryID uint   `gorm:"primaryKey;not null" json:"story_id"`
	Story   Story  `gorm:"foreignKey:StoryID" json:"story"`
}

type User

type User struct {
	gorm.Model
	Email string `json:"email" gorm:"unique; not null"`
	Hd    string `json:"hd" gorm:"not null"`
}

User stores all users that have ever signed in with a uwblueprint or theshoeproject domains (stored in Hd field)

func (*User) BeforeCreate

func (user *User) BeforeCreate(tx *gorm.DB) (err error)

BeforeCreate validates that a user email belongs to either uwblueprint or theshoeproject

Jump to

Keyboard shortcuts

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