retribusi

This commit is contained in:
2025-08-04 09:37:10 +07:00
parent abaddf2589
commit 26765fcc51
10 changed files with 1779 additions and 65 deletions

View File

@@ -5,18 +5,27 @@ import (
"github.com/coder/websocket"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
swaggerFiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger"
//_ "template_blueprint/docs"
//swaggerFiles "github.com/swaggo/files"
//ginSwagger "github.com/swaggo/gin-swagger"
"io/fs"
"log"
"net/http"
//_ "template_blueprint/cmd/api/docs"
"template_blueprint/cmd/web"
//_ "template_blueprint/internal/docs"
_ "template_blueprint/docs"
patientHandler "template_blueprint/pkg/handlers/patient"
datapoliklinikHandler "template_blueprint/pkg/handlers/poliklinik"
dataRetribusi "template_blueprint/pkg/handlers/retribusi"
"time"
)
func (s *Server) RegisterRoutes() http.Handler {
r := gin.Default()
r.Use(cors.New(cors.Config{
AllowOrigins: []string{"*"}, // or specific domains like "http://example.com"
AllowMethods: []string{"GET", "POST", "PUT", "DELETE"},
@@ -24,6 +33,7 @@ func (s *Server) RegisterRoutes() http.Handler {
AllowCredentials: true,
}))
//r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
r.GET("/", s.HelloWorldHandler)
r.GET("/websocket", s.websocketHandler)
@@ -42,13 +52,32 @@ func (s *Server) RegisterRoutes() http.Handler {
{
Poliklinik.GET("/getdata/statuspelayanan/:statuspelayanan", datapoliklinikHandler.GetDataPoliklinik)
}
retribusi := v1.Group("/retribusi")
{
retribusi.GET("/getData/Limit/:limit/Offset/:offset", dataRetribusi.GetDataRetribusi)
retribusi.POST("/insertretribusi", dataRetribusi.InsertRetribution)
retribusi.PUT("/updateretribusi", dataRetribusi.UpdateRetribution)
retribusi.DELETE("/deleteretribusi/:id", dataRetribusi.DeleteDataRetribusi)
retribusi.GET("/searchData/:kelompok_obyek", dataRetribusi.SearchDataRetribusi)
}
//add swagger
//url := ginSwagger.URL("http://localhost:8084/swagger/doc.json")
//r.GET("/docs/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
//r.GET("/swagger/*any", func(c *gin.Context) {
// if c.Request.RequestURI == "/swagger/" {
// c.Redirect(302, "/swagger/index.html")
// return
// }
// ginSwagger.WrapHandler(swaggerFiles.Handler, ginSwagger.URL("http://localhost:8084/swagger/doc.json"))(c)
//})
r.GET("/docs/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
return r
}
func (s *Server) HelloWorldHandler(c *gin.Context) {
resp := make(map[string]string)
resp["message"] = "Hello World"
resp["message"] = "Hello World 2"
c.JSON(http.StatusOK, resp)
}