book

package
v0.0.0-...-7e9aa71 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BookRes

type BookRes struct {
	ID            uint       `json:"id"`
	Title         string     `json:"title"`
	Price         uint       `json:"price"`
	CoverImageUrl string     `json:"cover_image_url"`
	AuthorName    string     `json:"author_name"`
	Description   string     `json:"description"`
	CreatedAt     time.Time  `json:"created_at"`
	UpdatedAt     time.Time  `json:"updated_at"`
	Tags          []BookTags `json:"tags"`
	IsAvailable   bool       `json:"is_available"`
}

type BookTags

type BookTags struct {
	ID   uint   `json:"id"`
	Name string `json:"name"`
}

type Books

type Books struct {
	gorm.Model
	Title              string
	Price              uint
	FilePath           string
	Description        string
	CoverImagePath     string
	AuthorName         string
	IsAvailableInStore bool
	Tags               []Tags `gorm:"many2many:books_tags;"`
}

type CreateBookReq

type CreateBookReq struct {
	Title          string     `json:"title" validate:"required,max=200"`
	Price          uint       `json:"price" validate:"required"`
	FilePath       string     `json:"file_path"`
	Description    string     `json:"description"`
	CoverImagePath string     `json:"cover_image_path"`
	AuthorName     string     `json:"author_name"`
	Tags           []BookTags `json:"tags"`
}

type SearchBooksReq

type SearchBooksReq struct {
	Title      string `form:"title" validate:"max=200"`
	MaxPrice   *uint  `form:"max_price"`
	MinPrice   *uint  `form:"min_price"`
	AuthorName string `form:"author_name"`
	TagIDs     string `form:"tag_ids"`
	models.PaginatieReq
}

type SearchBooksRes

type SearchBooksRes struct {
	Books      []BookRes           `json:"books"`
	Pagination models.PaginatieRes `json:"pagination"`
}

type Tags

type Tags struct {
	gorm.Model
	Name  string
	Books []Books `gorm:"many2many:books_tags;"`
}

type UpdateBookDetailReq

type UpdateBookDetailReq struct {
	BookID      uint
	Title       string     `json:"title"`
	Price       uint       `json:"price"`
	Description string     `json:"description"`
	AuthorName  string     `json:"author_name"`
	Tags        []BookTags `json:"tags"`
	IsAvailable bool       `json:"is_available"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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