2025-02-24 20:18:09 +08:00
|
|
|
package subscribeplanhttp
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"net/http"
|
|
|
|
|
|
2025-02-27 07:25:25 +08:00
|
|
|
subscribeplansvc "legalgo-BE-go/internal/services/subscribe_plan"
|
|
|
|
|
"legalgo-BE-go/internal/utilities/response"
|
|
|
|
|
|
2025-02-24 20:18:09 +08:00
|
|
|
"github.com/go-chi/chi/v5"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func GetAllPlan(
|
|
|
|
|
router chi.Router,
|
|
|
|
|
subsPlanSvc subscribeplansvc.SubsPlanIntf,
|
|
|
|
|
) {
|
2025-02-25 14:23:59 +08:00
|
|
|
router.Get("/subscribe-plan", func(w http.ResponseWriter, r *http.Request) {
|
2025-02-24 20:18:09 +08:00
|
|
|
ctx := r.Context()
|
|
|
|
|
subsPlan, err := subsPlanSvc.GetAllPlan()
|
|
|
|
|
if err != nil {
|
|
|
|
|
response.ResponseWithErrorCode(
|
|
|
|
|
ctx,
|
|
|
|
|
w,
|
|
|
|
|
err,
|
|
|
|
|
response.ErrBadRequest.Code,
|
|
|
|
|
response.ErrBadRequest.HttpCode,
|
|
|
|
|
response.ErrBadRequest.Message,
|
|
|
|
|
)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
response.RespondJsonSuccess(ctx, w, subsPlan)
|
|
|
|
|
})
|
|
|
|
|
}
|