controller

package
v0.0.0-...-9dda008 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteGadgetByID

func DeleteGadgetByID(c *fiber.Ctx) error

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

func GetAllGagdet

func GetAllGagdet(c *fiber.Ctx) error

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

func GetAllReview

func GetAllReview(c *fiber.Ctx) error

GetAllReview godoc @Summary Get All Data Review. @Description Mengambil semua data review. @Tags Review @Accept json @Produce json @Success 200 {object} Gadget @Router /review [get]

func GetGadgetByID

func GetGadgetByID(c *fiber.Ctx) error

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

func InsertDataGadget

func InsertDataGadget(c *fiber.Ctx) error

func InsertDataReview

func InsertDataReview(c *fiber.Ctx) error

InsertDataReview godoc @Summary Insert data Review. @Description Input data review. @Tags Review @Accept json @Produce json @Param request body ReqReview true "Payload Body [RAW]" @Success 200 {object} Review @Failure 400 @Failure 500 @Router /insertreview [post]

func Sink

func Sink(c *fiber.Ctx) error

func UpdateDataGadget

func UpdateDataGadget(c *fiber.Ctx) error

UpdateDataGadget godoc @Summary Update data Gadegt. @Description Ubah data gadget. @Tags Gadget @Accept json @Produce json @Param id path string true "Masukan ID" @Param request body ReqGadget true "Payload Body [RAW]" @Success 200 {object} Gadget @Failure 400 @Failure 500 @Router /updategadget/{id} [put]

Types

type Gadget

type Gadget struct {
	ID          primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty" example:"123456789"`
	Nama        string             `bson:"nama,omitempty" json:"nama,omitempty" example:"iPhone 13"`
	Merk        string             `bson:"merk,omitempty" json:"merk,omitempty" example:"Apple"`
	Harga       float64            `bson:"harga,omitempty" json:"harga,omitempty" example:"15000000"`
	Spesifikasi Spesifikasi        `bson:"spesifikasi,omitempty" json:"spesifikasi,omitempty"`
	Deskripsi   string             `` /* 137-byte string literal not displayed */
}

type HTTPRequest

type HTTPRequest struct {
	Header string `json:"header"`
	Body   string `json:"body"`
}

type ReqGadget

type ReqGadget struct {
	Nama        string         `bson:"nama,omitempty" json:"nama,omitempty" example:"iPhone 13"`
	Merk        string         `bson:"merk,omitempty" json:"merk,omitempty" example:"Apple"`
	Harga       float64        `bson:"harga,omitempty" json:"harga,omitempty" example:"15000000"`
	Spesifikasi ReqSpesifikasi `bson:"spesifikasi,omitempty" json:"spesifikasi,omitempty"`
	Deskripsi   string         `` /* 137-byte string literal not displayed */
}

type ReqReview

type ReqReview struct {
	UserID   primitive.ObjectID `bson:"user_id,omitempty" json:"user_id,omitempty" example:"2233445566"`
	GadgetID primitive.ObjectID `bson:"gadget_id,omitempty" json:"gadget_id,omitempty" example:"3344556677"`
	Rating   int                `bson:"rating,omitempty" json:"rating,omitempty" example:"5"`
	Review   string             `bson:"review,omitempty" json:"review,omitempty" example:"Luar biasa! Kinerja cepat dan kamera sangat bagus."`
}

type ReqSpesifikasi

type ReqSpesifikasi struct {
	Prosesor string `bson:"prosesor,omitempty" json:"prosesor,omitempty" example:"A15 Bionic"`
	RAM      int    `bson:"ram,omitempty" json:"ram,omitempty" example:"6"`
	Storage  int    `bson:"storage,omitempty" json:"storage,omitempty" example:"128"`
}

type Review

type Review struct {
	ID       primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty" example:"1122334455"`
	UserID   primitive.ObjectID `bson:"user_id,omitempty" json:"user_id,omitempty" example:"2233445566"`
	GadgetID primitive.ObjectID `bson:"gadget_id,omitempty" json:"gadget_id,omitempty" example:"3344556677"`
	Rating   int                `bson:"rating,omitempty" json:"rating,omitempty" example:"5"`
	Review   string             `bson:"review,omitempty" json:"review,omitempty" example:"Luar biasa! Kinerja cepat dan kamera sangat bagus."`
	Datetime time.Time          `bson:"datetime,omitempty" json:"datetime,omitempty" example:"2024-07-20T00:00:00Z" format:"date-time"`
}

type Spesifikasi

type Spesifikasi struct {
	ID       primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty" example:"987654321"`
	Prosesor string             `bson:"prosesor,omitempty" json:"prosesor,omitempty" example:"A15 Bionic"`
	RAM      int                `bson:"ram,omitempty" json:"ram,omitempty" example:"6"`
	Storage  int                `bson:"storage,omitempty" json:"storage,omitempty" example:"128"`
}

Jump to

Keyboard shortcuts

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