models

package
v0.0.0-...-cc7b2e0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	ID        uuid.UUID `json:"id" gorm:"type:uuid;primary_key;default:gen_random_uuid()"`
	CreatedAt time.Time `json:"createdAt" gorm:"not null;default:current_timestamp"`
	CreatedBy uuid.UUID `json:"createdBy" gorm:"type:uuid"`
	UpdatedAt time.Time `json:"updatedAt"`
	UpdatedBy uuid.UUID `json:"updatedBy" gorm:"type:uuid"`
	IsDeleted bool      `json:"-" gorm:"not null;default:false"`
}

type Catalog

type Catalog struct {
	Base

	Name        string  `json:"name" gorm:"not null;type:varchar(128)"`
	Description string  `json:"description" gorm:"not null;type:varchar(1024)"`
	Price       float32 `json:"price" gorm:"not null;type:decimal(10,2)"`

	Images []CatalogImage    `json:"images"`
	Likes  []CatalogUserLike `json:"-"`

	IsLiked bool `json:"isLiked" gorm:"->"`
}

type CatalogImage

type CatalogImage struct {
	Base

	URL string `json:"url" gorm:"not null;type:varchar(1024)"`

	CatalogID uuid.UUID `json:"-"`
}

type CatalogUserLike

type CatalogUserLike struct {
	CatalogID uuid.UUID `gorm:"primaryKey"`
	UserID    uuid.UUID `gorm:"primaryKey;type:uuid"`
	CreatedAt time.Time `gorm:"not null;default:current_timestamp"`
}

Jump to

Keyboard shortcuts

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