package handler import ( "kemendagri/sipd/services/transaksi-belanja-sipd/controllers" "github.com/go-playground/validator/v10" "github.com/gofiber/fiber/v2" ) type WelcomeHandler struct { Controller *controllers.WelcomeController Validate *validator.Validate } func NewWelcomeHandler(app *fiber.App, vld *validator.Validate, controller *controllers.WelcomeController) { handler := &WelcomeHandler{ Controller: controller, Validate: vld, } // public route rpub := app.Group("/welcome") rpub.Get("/", handler.Index) // rpub.Get("/:id", handler.View) // rpub.Post("/", handler.Create) // rpub.Put("/:id", handler.Update) // rpub.Delete("/:id", handler.Delete) } // Index func for get welcome. // // @Summary get welcome // @Description get welcome // @Tags Welcome // @Accept json // @Param page query int false "Halaman yang ditampilkan" // @Param limit query int false "Jumlah data per halaman, maksimal 50 data" // @param filter query string false "Key value pencarian ([kode_ddn,nama_daerah,jns_pemda]). Contoh: kode_ddn.11 -> (akan menampilkan data dengan kode ddn = '11')" // @Produce json // @success 200 {array} models.WelcomeModel "Success" // @Failure 400 {object} utils.RequestError "Bad request" // @Failure 401 {object} utils.RequestError "Unauthorized" // @Failure 404 {object} utils.RequestError "Not found" // @Failure 422 {array} utils.RequestError "Data validation failed" // @Failure 500 {object} utils.RequestError "Server error" // @Router /welcome [get] func (h *WelcomeHandler) Index(c *fiber.Ctx) error { resp, err := h.Controller.Index() if err != nil { return err } return c.JSON(resp) }