controllers

package
v0.0.0-...-436c7ba Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFood

func CreateFood() gin.HandlerFunc

CreateFood takes a food JSON and store in DB. CreateFood godoc

@Summary      Store a new food
@Description  Takes a food JSON and store in DB. Return saved JSON.
@Tags         foods
@Produce      json
@Success      200  {object}  models.Food
@Router       /foods [post]

func CreateInvoice

func CreateInvoice() gin.HandlerFunc

CreateInvoice takes a invoice JSON and store in DB. CreateInvoice godoc

@Summary      Store invoice by ID
@Description  Takes a invoice JSON and store in DB. Return saved JSON.
@Tags         invoices
@Produce      json
@Success      200  {object}  models.Invoice
@Router       /invoices [post]

func CreateMenu

func CreateMenu() gin.HandlerFunc

CreateMenu takes a menu JSON and store in DB. CreateMenu godoc

@Summary      Store a new menu
@Description  Takes a menu JSON and store in DB. Return saved JSON.
@Tags         menus
@Produce      json
@Success      200  {object}  models.Menu
@Router       /menus [post]

func CreateOrder

func CreateOrder() gin.HandlerFunc

CreateOrder takes a order JSON and store in DB. CreateOrder godoc

@Summary      Store a new order
@Description  Takes a order JSON and store in DB. Return saved JSON.
@Tags         orders
@Produce      json
@Success      200  {object}  models.Order
@Router       /orders [post]

func CreateOrderItem

func CreateOrderItem() gin.HandlerFunc

CreateOrderItem takes a ordered item JSON and store in DB. CreateOrderItem godoc

@Summary      Store a new ordered item
@Description  Takes a ordered item JSON and store in DB. Return saved JSON.
@Tags         orderItems
@Produce      json
@Success      200  {object}  models.OrderItem
@Router       /orderItems [post]

func CreateTable

func CreateTable() gin.HandlerFunc

CreateTable takes a food JSON and store in DB. CreateTable godoc

@Summary      Store a new table
@Description  Takes a table JSON and store in DB. Return saved JSON.
@Tags         tables
@Produce      json
@Success      200  {object}  models.Table
@Router       /tables [post]

func GetFood

func GetFood() gin.HandlerFunc

GetFood responds with the food with provided ID as JSON. GetFood godoc

@Summary      Get single food by ID
@Description  Responds with the food with provided ID as JSON.
@Tags         foods
@Produce      json
@Success      200  {object}  models.Food
@Router       /foods/{food_id} [get]

func GetFoods

func GetFoods() gin.HandlerFunc

GetFoods responds with the list of all foods as JSON. GetFoods godoc

@Summary      Get all foods
@Description  Responds with the list of all foods as JSON.
@Tags         foods
@Produce      json
@Success      200  {array}  models.Food
@Router       /foods [get]

func GetInvoice

func GetInvoice() gin.HandlerFunc

GetInvoices responds with the invoice with provided ID as JSON. GetInvoices godoc

@Summary      Get single invoice by ID
@Description  Responds with the invoice with provided ID as JSON
@Tags         invoices
@Produce      json
@Success      200  {object}  models.Invoice
@Router       /invoices/{invoice_id} [get]

func GetInvoices

func GetInvoices() gin.HandlerFunc

GetInvoices responds with the list of all invoices as JSON. GetInvoices godoc

@Summary      Get all invoices
@Description  Responds with the list of all invoices as JSON.
@Tags         invoices
@Produce      json
@Success      200  {array}  models.Invoice
@Router       /invoices [get]

func GetMenu

func GetMenu() gin.HandlerFunc

GetMenu responds with the menu with provided ID as JSON. GetMenu godoc

@Summary      Get single menu by ID
@Description  Responds with the menu with provided ID as JSON.
@Tags         menus
@Produce      json
@Success      200  {object}  models.Menu
@Router       /menus/{menu_id} [get]

func GetMenus

func GetMenus() gin.HandlerFunc

GetMenus responds with the list of all menus as JSON. GetMenus godoc

@Summary      Get all menus
@Description  Responds with the list of all menus as JSON.
@Tags         menus
@Produce      json
@Success      200  {array}  models.Menu
@Router       /menus [get]

func GetOrder

func GetOrder() gin.HandlerFunc

GetOrder responds with the order with provided ID as JSON. GetOrder godoc

@Summary      Get single order by ID
@Description  Responds with the order with provided ID as JSON.
@Tags         orders
@Produce      json
@Success      200  {object}  models.Order
@Router       /orders/{order_id} [get]

func GetOrderItem

func GetOrderItem() gin.HandlerFunc

GetOrderItem responds with the ordered item with provided ID as JSON. GetOrderItem godoc

@Summary      Get single ordered item by ID
@Description  Responds with the ordered item with provided ID as JSON.
@Tags         orderItems
@Produce      json
@Success      200  {object}  models.OrderItem
@Router       /orderItems/{order_item_id} [get]

func GetOrderItems

func GetOrderItems() gin.HandlerFunc

GetOrderItems responds with the list of all ordered items as JSON. GetFoods godoc

@Summary      Get all ordered items
@Description  Responds with the list of all foods as JSON.
@Tags         orderItems
@Produce      json
@Success      200  {array}  models.OrderItem
@Router       /orderItems [get]

func GetOrderItemsByOrder

func GetOrderItemsByOrder() gin.HandlerFunc

GetOrderItemsByOrder responds with the ordered items of an order with provided order's ID. GetOrderItemsByOrder godoc

@Summary      Get ordered items order's ID
@Description  Responds with the ordered items of an order with provided order's ID.
@Tags         orderItems
@Produce      json
@Success      200  {array}  models.OrderItem
@Router       /orderItems-order/{order_id} [get]

func GetOrders

func GetOrders() gin.HandlerFunc

GetOrders responds with the list of all orders as JSON. GetOrders godoc

@Summary      Get all orders
@Description  Responds with the list of all orders as JSON.
@Tags         orders
@Produce      json
@Success      200  {array}  models.Order
@Router       /orders [get]

func GetTable

func GetTable() gin.HandlerFunc

GetTable responds with the table with provided ID as JSON. GetTable godoc

@Summary      Get single table by ID
@Description  Responds with the table with provided ID as JSON.
@Tags         tables
@Produce      json
@Success      200  {object}  models.Table
@Router       /tables/{table_id} [get]

func GetTables

func GetTables() gin.HandlerFunc

GetTables responds with the list of all tables as JSON. GetTables godoc

@Summary      Get all tables
@Description  Responds with the list of all tables as JSON.
@Tags         tables
@Produce      json
@Success      200  {array}  models.Table
@Router       /tables [get]

func GetUser

func GetUser() gin.HandlerFunc

GetUser responds with the user with provided ID as JSON. GetUser godoc

@Summary      Get single user by ID
@Description  Responds with the user with provided ID as JSON.
@Tags         users
@Produce      json
@Success      200  {object}  models.User
@Router       /users/{user_id} [get]

func GetUsers

func GetUsers() gin.HandlerFunc

GetUsers responds with the list of all users as JSON. GetUsers godoc

@Summary      Get all users
@Description  Responds with the list of all users as JSON.
@Tags         users
@Produce      json
@Success      200  {array}  models.User
@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() gin.HandlerFunc

SignUp takes user's information, compares with information in DB and provides new JWT. SignUp godoc

@Summary      Log a user in..
@Description  Log a user in.
@Tags         users
@Produce      json
@Success      200  {object}  models.User
@Router       /users/login [post]

func OrderItemOrderCreator

func OrderItemOrderCreator(order models.Order) string

func SignUp

func SignUp() gin.HandlerFunc

SignUp takes user's information, provides JWT and stores in DB. SignUp godoc

@Summary      Create a new user.
@Description  Create a new user.
@Tags         users
@Produce      json
@Success      200  {object}  models.User
@Router       /users/signup [post]

func UpdateFood

func UpdateFood() gin.HandlerFunc

UpdateFood takes a food JSON and update food stored in DB. UpdateFood godoc

@Summary      Update a food
@Description  Takes a food JSON and update food stored in DB. Return saved JSON.
@Tags         foods
@Produce      json
@Success      200  {object}  models.Food
@Router       /foods/{food_id} [patch]

func UpdateInvoice

func UpdateInvoice() gin.HandlerFunc

UpdateInvoice takes an invoice JSON and update invoice stored in DB. UpdateInvoice godoc

@Summary      Update an invoice
@Description  Takes an invoice JSON and update invoice stored in DB. Return saved JSON.
@Tags         invoices
@Produce      json
@Success      200  {object}  models.Invoice
@Router       /invoices/{invoice_id} [patch]

func UpdateMenu

func UpdateMenu() gin.HandlerFunc

UpdateMenu takes a menu JSON and update menu stored in DB. UpdateMenu godoc

@Summary      Update a menu
@Description  Takes a menu JSON and update menu stored in DB. Return saved JSON.
@Tags         menus
@Produce      json
@Success      200  {object}  models.Menu
@Router       /menus/{menu_id} [patch]

func UpdateOrder

func UpdateOrder() gin.HandlerFunc

UpdateOrder takes a order JSON and update order stored in DB. UpdateOrder godoc

@Summary      Update a order
@Description  Takes a order JSON and update order stored in DB. Return saved JSON.
@Tags         orders
@Produce      json
@Success      200  {object}  models.Order
@Router       /orders/{order_id} [patch]

func UpdateOrderItem

func UpdateOrderItem() gin.HandlerFunc

UpdateOrderItem takes a ordered item JSON and update ordered item stored in DB. UpdateOrderItem godoc

@Summary      Update a ordered item
@Description  Takes a ordered item JSON and update ordered item stored in DB. Return saved JSON.
@Tags         orderItems
@Produce      json
@Success      200  {object}  models.OrderItem
@Router       /orderItems/{order_item_id} [patch]

func UpdateTable

func UpdateTable() gin.HandlerFunc

UpdateTable takes a table JSON and update table stored in DB. UpdateTable godoc

@Summary      Update a table
@Description  Takes a table JSON and update table stored in DB. Return saved JSON.
@Tags         tables
@Produce      json
@Success      200  {object}  models.Table
@Router       /tables/{table_id} [patch]

func VerifyPassword

func VerifyPassword(userPassword, providePassword string) (bool, string)

Types

type InvoiceViewFormat

type InvoiceViewFormat struct {
	Invoice_id       string
	Payment_method   string
	Order_id         string
	Payment_status   *string
	Payment_due      interface{}
	Table_number     interface{}
	Payment_due_date time.Time
	Order_details    interface{}
}

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