controller

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteMenuItemByID

func DeleteMenuItemByID(c *fiber.Ctx) error

DeleteMenuItemByID godoc @Summary Delete data menuItem. @Description Hapus data menuItem. @Tags MenuItem @Accept json @Produce json @Param id path string true "Masukan ID" @Success 200 @Failure 400 @Failure 500 @Router /delete/{id} [delete]

func DeleteUserByID

func DeleteUserByID(c *fiber.Ctx) error

DeleteUserByID godoc @Summary Delete data user. @Description Hapus data user. @Tags User @Accept json @Produce json @Param id path string true "Masukan ID" @Success 200 @Failure 400 @Failure 500 @Router /delete/{id} [delete]

func GetMenu

func GetMenu(c *fiber.Ctx) error

GetMenu godoc @Summary Get All Data Menu. @Description Mengambil semua data menu. @Tags MenuItem @Accept json @Produce json @Success 200 {object} MenuItem @Router /menu [get] GetAllMenuItem retrieves all menu items from the database

func GetMenuID

func GetMenuID(c *fiber.Ctx) error

GetMenuID godoc @Summary Get By ID Data Menu. @Description Ambil per ID data menu. @Tags MenuItem @Accept json @Produce json @Param id path string true "Masukan ID" @Success 200 {object} MenuItem @Failure 400 @Failure 404 @Failure 500 @Router /menu/{id} [get]

func GetUser

func GetUser(c *fiber.Ctx) error

GetUser godoc @Summary Get All Data User. @Description Mengambil semua data user. @Tags User @Accept json @Produce json @Success 200 {object} User @Router /user [get]

func GetUserID

func GetUserID(c *fiber.Ctx) error

GetUserID godoc @Summary Get By ID Data User. @Description Ambil per ID data USER. @Tags User @Accept json @Produce json @Param id path string true "Masukan ID" @Success 200 {object} User @Failure 400 @Failure 404 @Failure 500 @Router /user/{id} [get]

func Homepage

func Homepage(c *fiber.Ctx) error

func InsertDataMenu

func InsertDataMenu(c *fiber.Ctx) error

InsertDataMenu godoc @Summary Insert data menu. @Description Input data menu. @Tags MenuItem @Accept json @Produce json @Param request body ReqMenuItem true "Payload Body [RAW]" @Success 200 {object} MenuItem @Failure 400 @Failure 500 @Router /insert [post]

func InsertDataUser

func InsertDataUser(c *fiber.Ctx) error

InsertDataUser godoc @Summary Insert data user. @Description Input data user. @Tags User @Accept json @Produce json @Param request body ReqUser true "Payload Body [RAW]" @Success 200 {object} User @Failure 400 @Failure 500 @Router /insert [post]

func Sink

func Sink(c *fiber.Ctx) error

func UpdateDataMenuItem

func UpdateDataMenuItem(c *fiber.Ctx) error

UpdateDataMenu godoc @Summary Update data menuItem. @Description Ubah data menuItem. @Tags MenuItem @Accept json @Produce json @Param id path string true "Masukan ID" @Param request body ReqMenuItem true "Payload Body [RAW]" @Success 200 {object} MenuItem @Failure 400 @Failure 500 @Router /update/{id} [put]

func UpdateDataUser

func UpdateDataUser(c *fiber.Ctx) error

UpdateData godoc @Summary Update data user. @Description Ubah data user. @Tags User @Accept json @Produce json @Param id path string true "Masukan ID" @Param request body ReqUser true "Payload Body [RAW]" @Success 200 {object} User @Failure 400 @Failure 500 @Router /update/{id} [put]

Types

type HTTPRequest

type HTTPRequest struct {
	Header string `json:"header"`
	Body   string `json:"body"`
}
type MenuItem struct {
	ID          primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"`
	Name        string             `bson:"name,omitempty" json:"name,omitempty"`
	Ingredients string             `bson:"ingredients,omitempty" json:"ingredients,omitempty"`
	Description string             `bson:"description,omitempty" json:"description,omitempty"`
	Calories    float64            `bson:"calories,omitempty" json:"calories,omitempty"`
	Category    string             `bson:"category,omitempty" json:"category,omitempty"`
	Image       string             `bson:"image,omitempty" json:"image,omitempty"`
}

type ReqMenu

type ReqMenu struct {
	Name        string  `bson:"name,omitempty" json:"name,omitempty"`
	Ingredients string  `bson:"ingredients,omitempty" json:"ingredients,omitempty"`
	Description string  `bson:"description,omitempty" json:"description,omitempty"`
	Calories    float64 `bson:"calories,omitempty" json:"calories,omitempty"`
	Category    string  `bson:"category,omitempty" json:"category,omitempty"`
	Image       string  `bson:"image,omitempty" json:"image,omitempty"`
}

type ReqUser

type ReqUser struct {
	FullName string `bson:"name,omitempty" json:"name,omitempty"`
	Phone    string `bson:"phone,omitempty" json:"phone,omitempty"`
	Username string `bson:"username,omitempty" json:"username,omitempty"`
	Password string `bson:"password,omitempty" json:"password,omitempty"`
	Role     string `bson:"role,omitempty" json:"role,omitempty"` // "admin" or "customer"
}

type User

type User struct {
	ID       primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"`
	FullName string             `bson:"name,omitempty" json:"name,omitempty"`
	Phone    string             `bson:"phone,omitempty" json:"phone,omitempty"`
	Username string             `bson:"username,omitempty" json:"username,omitempty"`
	Password string             `bson:"password,omitempty" json:"password,omitempty"`
	Role     string             `bson:"role,omitempty" json:"role,omitempty"` // "admin" or "customer"
}

Jump to

Keyboard shortcuts

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