restaurant

package
v0.0.0-...-712712c Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Product

type Product struct {
	ID           int64   `db:"id"`
	Name         string  `db:"name"`
	Description  string  `db:"description"`
	Price        float64 `db:"price"`
	RestaurantID int64   `db:"rest_id"`
	Category     string  `db:"category"`
	Active       bool    `db:"active"`
}

type ProductRequest

type ProductRequest struct {
	Name         string  `json:"name" form:"name"`
	Description  string  `json:"description" form:"description"`
	Price        float64 `json:"price" form:"price"`
	RestaurantID int64   `json:"restaurant_id" form:"restaurant_id"`
}

type Restaurant

type Restaurant struct {
	ID       int64     `db:"id"`
	Name     string    `db:"name"`
	Status   bool      `db:"status"`
	Lon      float64   `db:"lon"`
	Lat      float64   `db:"lat"`
	Address  string    `db:"address"`
	Products []Product `db:"products"`
}

type RestaurantHandler

type RestaurantHandler struct {
	// contains filtered or unexported fields
}

func NewRestaurantHandler

func NewRestaurantHandler(service RestaurantService) *RestaurantHandler

func (*RestaurantHandler) CreateRestaurant

func (h *RestaurantHandler) CreateRestaurant(ctx *gin.Context)

func (*RestaurantHandler) GetActiveRestaurant

func (h *RestaurantHandler) GetActiveRestaurant(ctx *gin.Context)

func (*RestaurantHandler) GetRestaurantById

func (h *RestaurantHandler) GetRestaurantById(ctx *gin.Context)

func (*RestaurantHandler) SearchRestaurant

func (h *RestaurantHandler) SearchRestaurant(ctx *gin.Context)

func (*RestaurantHandler) UpdateRestaurant

func (h *RestaurantHandler) UpdateRestaurant(ctx *gin.Context)

func (*RestaurantHandler) UpdateRestaurantStatus

func (h *RestaurantHandler) UpdateRestaurantStatus(ctx *gin.Context)

type RestaurantRepo

type RestaurantRepo interface {
	// admin method
	Create(restaurant Restaurant, createdBy int) error
	Update(restaurant Restaurant, updatedBy int) error
	UpdateStatus(restaurant Restaurant, updatedBy int) error
	Search(query string, limit, offset int, status bool) (shared.PaginationResponse, error)
	GetResProducts(ids ...int) ([]Product, error)
	GetProductsByID(restID int, ids []int) ([]Product, error)
	GetByID(id int64) (Restaurant, error)
}

func NewRestaurantRepo

func NewRestaurantRepo(db *sqlx.DB) RestaurantRepo

type RestaurantRequest

type RestaurantRequest struct {
	ID      int64   `json:"id" form:"id"`
	Name    string  `json:"name" form:"name"`
	Status  bool    `json:"status" form:"status"`
	Lon     float64 `json:"lon" form:"lon"`
	Lat     float64 `json:"lat" form:"lat"`
	Address string  `json:"address" form:"address"`
}

func (*RestaurantRequest) FromRestaurantRequest

func (r *RestaurantRequest) FromRestaurantRequest() Restaurant

func (*RestaurantRequest) Validate

func (r *RestaurantRequest) Validate() error

type RestaurantResponse

type RestaurantResponse struct {
	ID      int64   `json:"id"`
	Name    string  `json:"name"`
	Status  bool    `json:"status"`
	Lon     float64 `json:"lon"`
	Lat     float64 `json:"lat"`
	Address string  `json:"address"`
}

func (*RestaurantResponse) FromRestaurant

func (r *RestaurantResponse) FromRestaurant(restaurant *Restaurant)

type RestaurantService

type RestaurantService struct {
	// contains filtered or unexported fields
}

func NewRestaurantService

func NewRestaurantService(repo RestaurantRepo) RestaurantService

func (*RestaurantService) CreateRestaurant

func (s *RestaurantService) CreateRestaurant(req RestaurantRequest, createdBy int) error

func (*RestaurantService) GetActiveRestaurant

func (s *RestaurantService) GetActiveRestaurant(req SearchRequest) (shared.PaginationResponse, error)

func (*RestaurantService) GetRestaurantByID

func (s *RestaurantService) GetRestaurantByID(resId int, productsIDs []int) (Restaurant, error)

func (*RestaurantService) SearchRestaurant

func (s *RestaurantService) SearchRestaurant(req SearchRequest) (Restaurant, error)

func (*RestaurantService) UpdateRestaurant

func (s *RestaurantService) UpdateRestaurant(req RestaurantRequest, updatedBy int) error

func (*RestaurantService) UpdateRestaurantStatus

func (s *RestaurantService) UpdateRestaurantStatus(req RestaurantRequest, updatedBy int) error

type SearchRequest

type SearchRequest struct {
	ID     int64  `json:"id" form:"id"`
	Status bool   `json:"status" form:"status"`
	Term   string `json:"term" form:"term"`
	Limit  int    `json:"limit" form:"limit"`
	Offset int    `json:"offset" form:"offset"`
}

Jump to

Keyboard shortcuts

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