controllers

package
v0.0.0-...-1b8c1d8 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRatingtoRestaurant

func AddRatingtoRestaurant(c *gin.Context)

@Summary AddRatingtoRestaurant @Description Add rating to a restaurant @Tags User @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param id path string true "Restaurant ID" @Param rating body types.Rating true "Rating Object" @Success 200 {object} string @Failure 400 {object} string @Router /restaurants/rating/{id} [put]

func ComparePassword

func ComparePassword(hashedPassword string, password string) (bool, string)

func CreateCategory

func CreateCategory(c *gin.Context)

@Summary Create a category @Description Create a category @Tags Admin @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param category body types.Category true "Category" @Success 200 {object} string @Failure 500 {object} string @Router /categories [post]

func CreateFood

func CreateFood(c *gin.Context)

@Summary Create Food @Description Create Food @Tags Admin @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param food body models.Food true "Food Object" @Success 201 {object} string @Failure 400 {object} string @Router /food [post]

func CreateInvoice

func CreateInvoice(c *gin.Context)

@Summary Create Invoice @Description Create Invoice @Tags User @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param invoice body types.Invoice true "Invoice" @Success 201 {object} models.Invoice @Failure 400 {object} string @Router /invoice [post]

func CreateMenu

func CreateMenu(c *gin.Context)

@Summary Create a menu @Description Create a menu @Tags Admin @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param menu body types.Menu true "Menu object" @Success 201 {object} string @Failure 500 {object} string @Router /menu [post]

func CreateOrder

func CreateOrder(c *gin.Context)

@Summary Create a order @Description Create a order @Tags User @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param table_id body string true "Table ID" @Param order_status body string true "Order Status" @Param total_amount body string true "Total Amount" @Success 201 {object} string @Failure 500 {object} string @Router /order [post]

func CreateOrderItem

func CreateOrderItem(c *gin.Context)

@Summary Create Order Item @Description Create Order Item @Tags User @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param orderItem body models.OrderItem true "Order Item Object" @Success 201 {object} models.OrderItem @Failure 400 {object} string @Router /orderItem [post]

func CreateRestaurant

func CreateRestaurant(c *gin.Context)

@Summary CreateRestaurant @Description Create a restaurant @Tags Admin @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param restaurant body types.Restaurant true "Restaurant Object" @Success 200 {object} string @Failure 400 {object} string @Router /restaurants [post]

func CreateTable

func CreateTable(c *gin.Context)

@Summary Create a table @Description Create a table @Tags Admin @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param table body types.Table true "Table" @Success 201 {object} string @Failure 400 {object} string @Router /table [post]

func DeleteCategory

func DeleteCategory(c *gin.Context)

@Summary Delete a category @Description Delete a category @Tags Admin @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @param id path string true "Category ID" @Success 200 {object} string @Failure 500 {object} string @Router /categeory/{id} [delete]

func DeleteFood

func DeleteFood(c *gin.Context)

@Summary Delete Food @Description Delete Food @Tags Admin @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param id path string true "Food ID" @Success 202 {object} string @Failure 400 {object} string @Router /food/{id} [delete]

func DeleteInvoice

func DeleteInvoice(c *gin.Context)

@Summary Delete Invoice @Description Delete Invoice @Tags Admin @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param id path string true "Invoice ID" @Success 200 {object} string @Failure 400 {object} string @Router /invoice/{id} [delete]

func DeleteMenu

func DeleteMenu(c *gin.Context)

@Summary Delete a menu @Description Delete a menu @Tags Admin @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param id path string true "Menu ID" @Success 200 {object} string @Failure 500 {object} string @Router /menu/{id} [delete]

func DeleteOrder

func DeleteOrder(c *gin.Context)

@Summary Delete a order @Description Delete a order @Tags Admin @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param id path string true "Order ID" @Success 200 {object} string @Failure 500 {object} string @Router /order/{id} [delete]

func DeleteOrderItem

func DeleteOrderItem(c *gin.Context)

@Summary Delete Order Item @Description Delete Order Item @Tags User @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param id path string true "Order Item ID" @Success 200 {string} string "Order Item deleted successfully" @Failure 400 {object} string @Router /orderItem/{id} [delete]

func DeleteRestaurant

func DeleteRestaurant(c *gin.Context)

@Summary DeleteRestaurant @Description Delete a restaurant @Tags Admin @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param id path string true "Restaurant ID" @Success 200 {object} string @Failure 400 {object} string @Router /restaurants/{id} [delete]

func DeleteTable

func DeleteTable(c *gin.Context)

@Summary Delete a table @Description Delete a table @Tags Admin @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param id path string true "Table ID" @Success 200 {object} string @Failure 500 {object} string @Router /table/{id} [delete]

func DeleteUser

func DeleteUser(c *gin.Context)

@Summary Delete User @Description Delete user @Tags Admin @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param id path string true "User ID" @Success 200 {object} string @Failure 500 {object} string @Router /users/{id} [delete]

func GetCategories

func GetCategories(c *gin.Context)

@Summary Get all categories @Description Get all categories @Tags Global @Accept json @Produce json @Success 200 {object} string @Failure 500 {object} string @Router /categories [get]

func GetCategory

func GetCategory(c *gin.Context)

@Summary Get a category @Description Get a category @Tags User @Accept json @Produce json @param id path string true "Category ID" @Security BearerAuth @param Authorization header string true "Token" @Success 200 {object} string @Failure 500 {object} string @Router /categeory/{id} [get]

func GetFood

func GetFood(c *gin.Context)

@Summary Get Food @Description Get Food @Tags Global @Accept json @Produce json @Param id path string true "Food ID" @Success 200 {object} string @Failure 400 {object} string @Router /food/{id} [get]

func GetFoods

func GetFoods(c *gin.Context)

@Summary GetFoods @Description Get all foods @Tags Global @Produce json @Param recordPerPage query int false "Record Per Page" @Param page query int false "Page" @Param startIndex query int false "Start Index" @Success 200 {object} string @Failure 400 {object} string @Router /foods [get]

func GetInvoice

func GetInvoice(c *gin.Context)

@Summary Get Invoice @Description Get Invoice @Tags User @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param id path string true "Invoice ID" @Success 200 {object} models.Invoice @Failure 400 {object} string @Router /invoice/{id} [get]

func GetInvoices

func GetInvoices(c *gin.Context)

@Summary Get Invoices @Description Get Invoices @Tags Admin @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Success 200 {object} models.Invoice @Failure 400 {object} string @Router /invoice [get]

func GetMenu

func GetMenu(c *gin.Context)

@Summary Get a menu @Description Get a menu @Tags Global @Accept json @Produce json @Param id path string true "Menu ID" @Success 200 {object} string @Failure 500 {object} string @Router /menu/{id} [get]

func GetMenus

func GetMenus(c *gin.Context)

@Summary Get all menus @Description Get all menus @Tags Global @Accept json @Produce json @Param recordPerPage query int false "Record Per Page" @Param page query int false "Page" @Param startIndex query int false "Start Index" @Success 200 {object} string @Failure 500 {object} string @Router /menu [get]

func GetOrder

func GetOrder(c *gin.Context)

@Summary Get a order @Description Get a order @Tags User @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param id path string true "Order ID" @Success 200 {object} string @Failure 500 {object} string @Router /order/{id} [get]

func GetOrderItem

func GetOrderItem(c *gin.Context)

@Summary Get Order Item @Description Get Order Item @Tags User @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param id path string true "Order Item ID" @Success 200 {object} models.OrderItem @Failure 400 {object} string @Router /orderItem/{id} [get]

func GetOrderItems

func GetOrderItems(c *gin.Context)

@Summary Get Order Items @Description Get Order Items @Tags Admin @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Success 200 {object} string @Failure 400 {object} string @Router /orderItems [get]

func GetOrders

func GetOrders(c *gin.Context)

@Summary Get all orders @Description Get all orders @Tags Admin @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param recordPerPage query int false "Record Per Page" @Param page query int false "Page" @Param startIndex query int false "Start Index" @Success 200 {object} string @Failure 500 {object} string @Router /orders [get]

func GetRestaurant

func GetRestaurant(c *gin.Context)

@Summary GetRestaurant @Description Get a restaurant @Tags Global @Produce json @Param id path string true "Restaurant ID" @Success 200 {object} string @Failure 400 {object} string @Router /restaurants/{id} [get]

func GetRestaurants

func GetRestaurants(c *gin.Context)

@Summary GetRestaurants @Description Get all restaurants @Tags Global @Produce json @Param recordPerPage query int false "Record Per Page" @Param page query int false "Page" @Param startIndex query int false "Start Index" @Success 200 {object} string @Failure 400 {object} string @Router /restaurants [get]

func GetTable

func GetTable(c *gin.Context)

@Summary Get a table @Description Get a table @Tags Global @Accept json @Produce json @Param id path string true "Table ID" @Success 200 {object} string @Failure 500 {object} string @Router /table/{id} [get]

func GetTables

func GetTables(c *gin.Context)

@Summary Get all tables @Description Get all tables @Tags Global @Accept json @Produce json @Success 200 {object} string @Failure 500 {object} string @Router /table [get]

func GetUser

func GetUser(c *gin.Context)

@Summary Get a User @Description Get a user Details by ID @Tags User @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param id path string true "User ID" @Success 200 {object} string @Failure 500 {object} string @Router /users/{id} [get]

func GetUsers

func GetUsers(c *gin.Context)

@Summary Get all Users @Description Get all users @Tags Admin @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param recordPerPage query int false "Record Per Page" @Param page query int false "Page" @Param startIndex query int false "Start Index" @Success 200 {object} string @Failure 500 {object} string @Router /users [get]

func HashPassword

func HashPassword(password string) string

func ItemsByOrder

func ItemsByOrder(id string) (OrderItems []primitive.M, err error)

func Login

func Login(c *gin.Context)

@Summary User Login @Description user can login by giving their email and password @Tags Auth @Accept json @Produce json @Param user body types.Loginuser true "User" @Success 200 {object} string @Failure 500 {object} string @Router /login [post]

func Logout

func Logout(c *gin.Context)

@Summary User Logout @Description user can logout by giving their user_id @Tags Auth @Accept json @Produce json @Param user_id body string true "User ID" @Success 200 {object} string @Failure 500 {object} string @Router /logout [post]

func MenuByRestaurant(c *gin.Context)

@Summary MenuByRestaurant @Description Get all menus by restaurant @Tags User @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param id path string true "Restaurant ID" @Success 200 {object} string @Failure 400 {object} string @Router /restaurants/menus/{id} [get]

func OrderItemOrderCreator

func OrderItemOrderCreator(order models.Order) string

func Register

func Register(c *gin.Context)

@Summary User Signup @Description user can signup by giving their details @Tags Auth @Accept json @Produce json @Param user body types.RegisterUser true "User" @Success 201 {object} string @Failure 500 {object} string @Router /register [post]

func ResetPassword

func ResetPassword(c *gin.Context)

@Summary Reset Password @Description Reset user password @Tags User @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param user body types.PasswordReset true "User" @Success 200 {object} string @Failure 500 {object} string @Router /reset-password [post]

func UpdateCategory

func UpdateCategory(c *gin.Context)

@Summary Update a category @Description Update a category @Tags Admin @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @param id path string true "Category ID" @Param category body types.Category true "Category" @Success 200 {object} string @Failure 500 {object} string @Router /categeory/{id} [put]

func UpdateFood

func UpdateFood(c *gin.Context)

@Summary Update Food @Description Update Food @Tags Admin @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param id path string true "Food ID" @Param food body models.Food true "Food Object" @Success 202 {object} string @Failure 400 {object} string @Router /food/{id} [put]

func UpdateInvoice

func UpdateInvoice(c *gin.Context)

@Summary Update Invoice @Description Update Invoice @Tags User @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param id path string true "Invoice ID" @Param invoice body types.Invoice true "Invoice" @Success 200 {object} models.Invoice @Failure 400 {object} string @Router /invoice/{id} [put]

func UpdateMenu

func UpdateMenu(c *gin.Context)

@Summary Update a menu @Description Update a menu @Tags Admin @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param id path string true "Menu ID" @Param menu body types.Menu true "Menu object" @Success 200 {object} string @Failure 500 {object} string @Router /menu/{id} [put]

func UpdateOrder

func UpdateOrder(c *gin.Context)

@Summary Update a order @Description Update a order @Tags Admin @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param id path string true "Order ID" @Param order body models.Order true "Table ID" @Success 200 {object} string @Failure 500 {object} string @Router /order/{id} [put]

func UpdateOrderItem

func UpdateOrderItem(c *gin.Context)

@Summary Update Order Item @Description Update Order Item @Tags User @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param id path string true "Order Item ID" @Param orderItem body models.OrderItem true "Order Item Object" @Success 200 {object} models.OrderItem @Failure 400 {object} string @Router /orderItem/{id} [put]

func UpdateRestaurant

func UpdateRestaurant(c *gin.Context)

@Summary UpdateRestaurant @Description Update a restaurant @Tags Admin @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param id path string true "Restaurant ID" @Param restaurant body types.Restaurant true "Restaurant Object" @Success 200 {object} string @Failure 400 {object} string @Router /restaurants/{id} [put]

func UpdateTable

func UpdateTable(c *gin.Context)

@Summary Update a table @Description Update a table @Tags Admin @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param id path string true "Table ID" @Param table body types.Table true "Table" @Success 200 {object} string @Failure 400 {object} string @Router /table/{id} [put]

func UpdateUser

func UpdateUser(c *gin.Context)

@Summary Update User @Description Update user details @Tags User @Accept json @Produce json @Security BearerAuth @param Authorization header string true "Token" @Param user body types.RegisterUser true "User" @Success 200 {object} string @Failure 500 {object} string @Router /users/{id} [put]

Types

type InvoiceViewFormat

type InvoiceViewFormat struct {
	Invoice_id        string      `json:"invoice_id"`
	Payment_method    string      `json:"payment_method"`
	Order_id          string      `json:"order_id"`
	Payment_status    string      `json:"payment_status"`
	Payment_due       interface{} `json:"payment_due"`
	Table_number      interface{} `json:"table_number"`
	Paymenet_due_date time.Time   `json:"payment_due_date"`
	Order_details     interface{} `json:"order_details"`
}

type OrderItemPack

type OrderItemPack struct {
	Table_id    string
	Order_items []models.OrderItem
}

Jump to

Keyboard shortcuts

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