diff --git a/app/database/entity/request_for_information_objection.entity.go b/app/database/entity/request_for_information_objection.entity.go new file mode 100644 index 0000000..b614700 --- /dev/null +++ b/app/database/entity/request_for_information_objection.entity.go @@ -0,0 +1,16 @@ +package entity + +import "time" + +type RequestForInformationObjection struct { + ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"` + RequestForInformationId uint `json:"request_for_information_id" gorm:"type:int4"` + DocumentName string `json:"document_name" gorm:"type:varchar"` + MainReason string `json:"main_reason" gorm:"type:varchar"` + SecondaryReason string `json:"secondary_reason" gorm:"type:varchar"` + CreatedById uint `json:"created_by_id" gorm:"type:int4"` + StatusId int `json:"status_id" gorm:"type:int4"` + IsActive *bool `json:"is_active" gorm:"type:bool"` + CreatedAt time.Time `json:"created_at" gorm:"default:now()"` + UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"` +} diff --git a/app/database/index.database.go b/app/database/index.database.go index 28e20d8..652b741 100644 --- a/app/database/index.database.go +++ b/app/database/index.database.go @@ -84,14 +84,15 @@ func Models() []interface{} { entity.PpidDataApprovalHistories{}, entity.PpidDataCategories{}, entity.Provinces{}, + entity.RequestForInformations{}, + entity.RequestForInformationItems{}, + entity.RequestForInformationReplies{}, + entity.RequestForInformationObjection{}, entity.UserLevels{}, entity.UserRoles{}, entity.UserRoleAccesses{}, entity.Users{}, entity.UserRoleLevelDetails{}, - entity.RequestForInformations{}, - entity.RequestForInformationItems{}, - entity.RequestForInformationReplies{}, } } diff --git a/app/module/request_for_information_objection/controller/controller.go b/app/module/request_for_information_objection/controller/controller.go new file mode 100644 index 0000000..ff04155 --- /dev/null +++ b/app/module/request_for_information_objection/controller/controller.go @@ -0,0 +1,16 @@ +package controller + +import ( + "github.com/rs/zerolog" + "go-humas-be/app/module/request_for_information_objection/service" +) + +type Controller struct { + RequestForInformationObjection RequestForInformationObjectionController +} + +func NewController(RequestForInformationObjectionService service.RequestForInformationObjectionService, log zerolog.Logger) *Controller { + return &Controller{ + RequestForInformationObjection: NewRequestForInformationObjectionController(RequestForInformationObjectionService, log), + } +} diff --git a/app/module/request_for_information_objection/controller/request_for_information_objection.controller.go b/app/module/request_for_information_objection/controller/request_for_information_objection.controller.go new file mode 100644 index 0000000..eb3392f --- /dev/null +++ b/app/module/request_for_information_objection/controller/request_for_information_objection.controller.go @@ -0,0 +1,198 @@ +package controller + +import ( + "github.com/gofiber/fiber/v2" + "github.com/rs/zerolog" + "go-humas-be/app/module/request_for_information_objection/request" + "go-humas-be/app/module/request_for_information_objection/service" + "go-humas-be/utils/paginator" + "strconv" + + utilRes "go-humas-be/utils/response" + utilVal "go-humas-be/utils/validator" +) + +type requestForInformationObjectionController struct { + requestForInformationObjectionService service.RequestForInformationObjectionService + Log zerolog.Logger +} + +type RequestForInformationObjectionController interface { + All(c *fiber.Ctx) error + Show(c *fiber.Ctx) error + Save(c *fiber.Ctx) error + Update(c *fiber.Ctx) error + Delete(c *fiber.Ctx) error +} + +func NewRequestForInformationObjectionController(requestForInformationObjectionService service.RequestForInformationObjectionService, log zerolog.Logger) RequestForInformationObjectionController { + return &requestForInformationObjectionController{ + requestForInformationObjectionService: requestForInformationObjectionService, + Log: log, + } +} + +// All get all RequestForInformationObjection +// @Summary Get all RequestForInformationObjection +// @Description API for getting all RequestForInformationObjection +// @Tags RequestForInformationObjection +// @Security Bearer +// @Param req query request.RequestForInformationObjectionQueryRequest false "query parameters" +// @Param req query paginator.Pagination false "pagination parameters" +// @Success 200 {object} response.Response +// @Failure 400 {object} response.BadRequestError +// @Failure 401 {object} response.UnauthorizedError +// @Failure 500 {object} response.InternalServerError +// @Router /request-for-information-objection [get] +func (_i *requestForInformationObjectionController) All(c *fiber.Ctx) error { + paginate, err := paginator.Paginate(c) + if err != nil { + return err + } + + reqContext := request.RequestForInformationObjectionQueryRequestContext{ + RequestForInformationId: c.Query("request_for_information_id"), + DocumentName: c.Query("document_name"), + MainReason: c.Query("main_reason"), + SecondaryReason: c.Query("secondary_reason"), + CreatedById: c.Query("created_by_id"), + StatusId: c.Query("status_id"), + } + req := reqContext.ToParamRequest() + req.Pagination = paginate + + requestForInformationObjectionData, paging, err := _i.requestForInformationObjectionService.All(req) + if err != nil { + return err + } + + return utilRes.Resp(c, utilRes.Response{ + Success: true, + Messages: utilRes.Messages{"RequestForInformationObjection list successfully retrieved"}, + Data: requestForInformationObjectionData, + Meta: paging, + }) +} + +// Show get one RequestForInformationObjection +// @Summary Get one RequestForInformationObjection +// @Description API for getting one RequestForInformationObjection +// @Tags RequestForInformationObjection +// @Security Bearer +// @Param id path int true "RequestForInformationObjection ID" +// @Success 200 {object} response.Response +// @Failure 400 {object} response.BadRequestError +// @Failure 401 {object} response.UnauthorizedError +// @Failure 500 {object} response.InternalServerError +// @Router /request-for-information-objection/:id [get] +func (_i *requestForInformationObjectionController) Show(c *fiber.Ctx) error { + id, err := strconv.ParseUint(c.Params("id"), 10, 0) + if err != nil { + return err + } + + requestForInformationObjectionData, err := _i.requestForInformationObjectionService.Show(uint(id)) + if err != nil { + return err + } + + return utilRes.Resp(c, utilRes.Response{ + Success: true, + Messages: utilRes.Messages{"RequestForInformationObjection successfully retrieved"}, + Data: requestForInformationObjectionData, + }) +} + +// Save create RequestForInformationObjection +// @Summary Create RequestForInformationObjection +// @Description API for create RequestForInformationObjection +// @Tags RequestForInformationObjection +// @Security Bearer +// @Param Authorization header string true "Insert your access token" default(Bearer ) +// @Param payload body request.RequestForInformationObjectionCreateRequest true "Required payload" +// @Success 200 {object} response.Response +// @Failure 400 {object} response.BadRequestError +// @Failure 401 {object} response.UnauthorizedError +// @Failure 500 {object} response.InternalServerError +// @Router /request-for-information-objection [post] +func (_i *requestForInformationObjectionController) Save(c *fiber.Ctx) error { + req := new(request.RequestForInformationObjectionCreateRequest) + if err := utilVal.ParseAndValidate(c, req); err != nil { + return err + } + + authToken := c.Get("Authorization") + dataResult, err := _i.requestForInformationObjectionService.Save(*req, authToken) + if err != nil { + return err + } + + return utilRes.Resp(c, utilRes.Response{ + Success: true, + Messages: utilRes.Messages{"RequestForInformationObjection successfully created"}, + Data: dataResult, + }) +} + +// Update update RequestForInformationObjection +// @Summary update RequestForInformationObjection +// @Description API for update RequestForInformationObjection +// @Tags RequestForInformationObjection +// @Security Bearer +// @Param Authorization header string true "Insert your access token" default(Bearer ) +// @Param payload body request.RequestForInformationObjectionUpdateRequest true "Required payload" +// @Param id path int true "RequestForInformationObjection ID" +// @Success 200 {object} response.Response +// @Failure 400 {object} response.BadRequestError +// @Failure 401 {object} response.UnauthorizedError +// @Failure 500 {object} response.InternalServerError +// @Router /request-for-information-objection/:id [put] +func (_i *requestForInformationObjectionController) Update(c *fiber.Ctx) error { + id, err := strconv.ParseUint(c.Params("id"), 10, 0) + if err != nil { + return err + } + + req := new(request.RequestForInformationObjectionUpdateRequest) + if err := utilVal.ParseAndValidate(c, req); err != nil { + return err + } + + err = _i.requestForInformationObjectionService.Update(uint(id), *req) + if err != nil { + return err + } + + return utilRes.Resp(c, utilRes.Response{ + Success: true, + Messages: utilRes.Messages{"RequestForInformationObjection successfully updated"}, + }) +} + +// Delete delete RequestForInformationObjection +// @Summary delete RequestForInformationObjection +// @Description API for delete RequestForInformationObjection +// @Tags RequestForInformationObjection +// @Security Bearer +// @Param id path int true "RequestForInformationObjection ID" +// @Success 200 {object} response.Response +// @Failure 400 {object} response.BadRequestError +// @Failure 401 {object} response.UnauthorizedError +// @Failure 500 {object} response.InternalServerError +// @Router /request-for-information-objection/:id [delete] +func (_i *requestForInformationObjectionController) Delete(c *fiber.Ctx) error { + id, err := strconv.ParseUint(c.Params("id"), 10, 0) + if err != nil { + return err + } + + err = _i.requestForInformationObjectionService.Delete(uint(id)) + if err != nil { + return err + } + + return utilRes.Resp(c, utilRes.Response{ + Success: true, + Messages: utilRes.Messages{"RequestForInformationObjection successfully deleted"}, + }) +} diff --git a/app/module/request_for_information_objection/mapper/request_for_information_objection.mapper.go b/app/module/request_for_information_objection/mapper/request_for_information_objection.mapper.go new file mode 100644 index 0000000..eac7518 --- /dev/null +++ b/app/module/request_for_information_objection/mapper/request_for_information_objection.mapper.go @@ -0,0 +1,24 @@ +package mapper + +import ( + "go-humas-be/app/database/entity" + res "go-humas-be/app/module/request_for_information_objection/response" +) + +func RequestForInformationObjectionResponseMapper(requestForInformationObjectionReq *entity.RequestForInformationObjection) (requestForInformationObjectionRes *res.RequestForInformationObjectionResponse) { + if requestForInformationObjectionReq != nil { + requestForInformationObjectionRes = &res.RequestForInformationObjectionResponse{ + ID: requestForInformationObjectionReq.ID, + RequestForInformationId: requestForInformationObjectionReq.RequestForInformationId, + DocumentName: requestForInformationObjectionReq.DocumentName, + MainReason: requestForInformationObjectionReq.MainReason, + SecondaryReason: requestForInformationObjectionReq.SecondaryReason, + CreatedById: requestForInformationObjectionReq.CreatedById, + StatusId: requestForInformationObjectionReq.StatusId, + IsActive: requestForInformationObjectionReq.IsActive, + CreatedAt: requestForInformationObjectionReq.CreatedAt, + UpdatedAt: requestForInformationObjectionReq.UpdatedAt, + } + } + return requestForInformationObjectionRes +} diff --git a/app/module/request_for_information_objection/repository/request_for_information_objection.repository.go b/app/module/request_for_information_objection/repository/request_for_information_objection.repository.go new file mode 100644 index 0000000..96ba1d6 --- /dev/null +++ b/app/module/request_for_information_objection/repository/request_for_information_objection.repository.go @@ -0,0 +1,106 @@ +package repository + +import ( + "fmt" + "github.com/rs/zerolog" + "go-humas-be/app/database" + "go-humas-be/app/database/entity" + "go-humas-be/app/module/request_for_information_objection/request" + "go-humas-be/utils/paginator" + "strings" +) + +type requestForInformationObjectionRepository struct { + DB *database.Database + Log zerolog.Logger +} + +// RequestForInformationObjectionRepository define interface of IRequestForInformationObjectionRepository +type RequestForInformationObjectionRepository interface { + GetAll(req request.RequestForInformationObjectionQueryRequest) (requestForInformationObjections []*entity.RequestForInformationObjection, paging paginator.Pagination, err error) + FindOne(id uint) (requestForInformationObjection *entity.RequestForInformationObjection, err error) + Create(requestForInformationObjection *entity.RequestForInformationObjection) (requestForInformationObjectionReturn *entity.RequestForInformationObjection, err error) + Update(id uint, requestForInformationObjection *entity.RequestForInformationObjection) (err error) + Delete(id uint) (err error) +} + +func NewRequestForInformationObjectionRepository(db *database.Database, logger zerolog.Logger) RequestForInformationObjectionRepository { + return &requestForInformationObjectionRepository{ + DB: db, + Log: logger, + } +} + +// implement interface of IRequestForInformationObjectionRepository +func (_i *requestForInformationObjectionRepository) GetAll(req request.RequestForInformationObjectionQueryRequest) (requestForInformationObjections []*entity.RequestForInformationObjection, paging paginator.Pagination, err error) { + var count int64 + + query := _i.DB.DB.Model(&entity.RequestForInformationObjection{}) + query = query.Where("is_active = ?", true) + + if req.RequestForInformationId != nil { + query = query.Where("request_for_information_id = ?", req.RequestForInformationId) + } + if req.DocumentName != nil && *req.DocumentName != "" { + documentName := strings.ToLower(*req.DocumentName) + query = query.Where("LOWER(document_name) LIKE ?", "%"+strings.ToLower(documentName)+"%") + } + if req.MainReason != nil && *req.MainReason != "" { + mainReason := strings.ToLower(*req.MainReason) + query = query.Where("LOWER(main_reason) LIKE ?", "%"+strings.ToLower(mainReason)+"%") + } + if req.SecondaryReason != nil && *req.SecondaryReason != "" { + secondaryReason := strings.ToLower(*req.SecondaryReason) + query = query.Where("LOWER(secondary_reason) LIKE ?", "%"+strings.ToLower(secondaryReason)+"%") + } + if req.CreatedById != nil { + query = query.Where("created_by_id = ?", req.CreatedById) + } + if req.StatusId != nil { + query = query.Where("status_id = ?", req.StatusId) + } + query.Count(&count) + + if req.Pagination.SortBy != "" { + direction := "ASC" + if req.Pagination.Sort == "desc" { + direction = "DESC" + } + query.Order(fmt.Sprintf("%s %s", req.Pagination.SortBy, direction)) + } + + req.Pagination.Count = count + req.Pagination = paginator.Paging(req.Pagination) + + err = query.Offset(req.Pagination.Offset).Limit(req.Pagination.Limit).Find(&requestForInformationObjections).Error + if err != nil { + return + } + + paging = *req.Pagination + + return +} + +func (_i *requestForInformationObjectionRepository) FindOne(id uint) (requestForInformationObjection *entity.RequestForInformationObjection, err error) { + if err := _i.DB.DB.First(&requestForInformationObjection, id).Error; err != nil { + return nil, err + } + + return requestForInformationObjection, nil +} + +func (_i *requestForInformationObjectionRepository) Create(requestForInformationObjection *entity.RequestForInformationObjection) (requestForInformationObjectionReturn *entity.RequestForInformationObjection, err error) { + result := _i.DB.DB.Create(requestForInformationObjection) + return requestForInformationObjection, result.Error +} + +func (_i *requestForInformationObjectionRepository) Update(id uint, requestForInformationObjection *entity.RequestForInformationObjection) (err error) { + return _i.DB.DB.Model(&entity.RequestForInformationObjection{}). + Where(&entity.RequestForInformationObjection{ID: id}). + Updates(requestForInformationObjection).Error +} + +func (_i *requestForInformationObjectionRepository) Delete(id uint) error { + return _i.DB.DB.Delete(&entity.RequestForInformationObjection{}, id).Error +} diff --git a/app/module/request_for_information_objection/request/request_for_information_objection.request.go b/app/module/request_for_information_objection/request/request_for_information_objection.request.go new file mode 100644 index 0000000..0c31144 --- /dev/null +++ b/app/module/request_for_information_objection/request/request_for_information_objection.request.go @@ -0,0 +1,106 @@ +package request + +import ( + "go-humas-be/app/database/entity" + "go-humas-be/utils/paginator" + "strconv" + "time" +) + +type RequestForInformationObjectionGeneric interface { + ToEntity() +} + +type RequestForInformationObjectionQueryRequest struct { + RequestForInformationId *uint `json:"request_for_information_id"` + DocumentName *string `json:"document_name"` + MainReason *string `json:"main_reason"` + SecondaryReason *string `json:"secondary_reason"` + CreatedById *uint `json:"created_by_id"` + StatusId *int `json:"status_id"` + Pagination *paginator.Pagination `json:"pagination"` +} + +type RequestForInformationObjectionCreateRequest struct { + RequestForInformationId uint `json:"request_for_information_id" validate:"required"` + DocumentName string `json:"document_name" validate:"required"` + MainReason string `json:"main_reason" validate:"required"` + SecondaryReason string `json:"secondary_reason" validate:"required"` + StatusId int `json:"status_id" validate:"required"` +} + +func (req RequestForInformationObjectionCreateRequest) ToEntity() *entity.RequestForInformationObjection { + return &entity.RequestForInformationObjection{ + DocumentName: req.DocumentName, + MainReason: req.MainReason, + SecondaryReason: req.SecondaryReason, + StatusId: req.StatusId, + IsActive: func() *bool { b := true; return &b }(), + } +} + +type RequestForInformationObjectionUpdateRequest struct { + ID uint `json:"id" validate:"required"` + RequestForInformationId uint `json:"request_for_information_id" validate:"required"` + DocumentName string `json:"document_name" validate:"required"` + MainReason string `json:"main_reason" validate:"required"` + SecondaryReason string `json:"secondary_reason" validate:"required"` + StatusId int `json:"status_id" validate:"required"` +} + +func (req RequestForInformationObjectionUpdateRequest) ToEntity() *entity.RequestForInformationObjection { + return &entity.RequestForInformationObjection{ + ID: req.ID, + RequestForInformationId: req.RequestForInformationId, + DocumentName: req.DocumentName, + MainReason: req.MainReason, + SecondaryReason: req.SecondaryReason, + StatusId: req.StatusId, + UpdatedAt: time.Now(), + } +} + +type RequestForInformationObjectionQueryRequestContext struct { + RequestForInformationId string `json:"request_for_information_id"` + DocumentName string `json:"document_name"` + MainReason string `json:"main_reason"` + SecondaryReason string `json:"secondary_reason"` + CreatedById string `json:"created_by_id"` + StatusId string `json:"status_id"` +} + +func (req RequestForInformationObjectionQueryRequestContext) ToParamRequest() RequestForInformationObjectionQueryRequest { + var request RequestForInformationObjectionQueryRequest + + if requestForInformationIdStr := req.RequestForInformationId; requestForInformationIdStr != "" { + requestForInformationId, err := strconv.Atoi(requestForInformationIdStr) + if err == nil { + requestForInformationIdUint := uint(requestForInformationId) + request.RequestForInformationId = &requestForInformationIdUint + } + } + if documentName := req.DocumentName; documentName != "" { + request.DocumentName = &documentName + } + if mainReason := req.MainReason; mainReason != "" { + request.MainReason = &mainReason + } + if secondaryReason := req.SecondaryReason; secondaryReason != "" { + request.SecondaryReason = &secondaryReason + } + if createdByIdStr := req.CreatedById; createdByIdStr != "" { + createdById, err := strconv.Atoi(createdByIdStr) + if err == nil { + createdByIdUint := uint(createdById) + request.CreatedById = &createdByIdUint + } + } + if statusIdStr := req.StatusId; statusIdStr != "" { + statusId, err := strconv.Atoi(statusIdStr) + if err == nil { + request.StatusId = &statusId + } + } + + return request +} diff --git a/app/module/request_for_information_objection/request_for_information_objection.module.go b/app/module/request_for_information_objection/request_for_information_objection.module.go new file mode 100644 index 0000000..68a0962 --- /dev/null +++ b/app/module/request_for_information_objection/request_for_information_objection.module.go @@ -0,0 +1,53 @@ +package request_for_information_objection + +import ( + "github.com/gofiber/fiber/v2" + "go-humas-be/app/module/request_for_information_objection/controller" + "go-humas-be/app/module/request_for_information_objection/repository" + "go-humas-be/app/module/request_for_information_objection/service" + "go.uber.org/fx" +) + +// struct of RequestForInformationObjectionRouter +type RequestForInformationObjectionRouter struct { + App fiber.Router + Controller *controller.Controller +} + +// register bulky of RequestForInformationObjection module +var NewRequestForInformationObjectionModule = fx.Options( + // register repository of RequestForInformationObjection module + fx.Provide(repository.NewRequestForInformationObjectionRepository), + + // register service of RequestForInformationObjection module + fx.Provide(service.NewRequestForInformationObjectionService), + + // register controller of RequestForInformationObjection module + fx.Provide(controller.NewController), + + // register router of RequestForInformationObjection module + fx.Provide(NewRequestForInformationObjectionRouter), +) + +// init RequestForInformationObjectionRouter +func NewRequestForInformationObjectionRouter(fiber *fiber.App, controller *controller.Controller) *RequestForInformationObjectionRouter { + return &RequestForInformationObjectionRouter{ + App: fiber, + Controller: controller, + } +} + +// register routes of RequestForInformationObjection module +func (_i *RequestForInformationObjectionRouter) RegisterRequestForInformationObjectionRoutes() { + // define controllers + requestForInformationObjectionController := _i.Controller.RequestForInformationObjection + + // define routes + _i.App.Route("/request-for-information-objection", func(router fiber.Router) { + router.Get("/", requestForInformationObjectionController.All) + router.Get("/:id", requestForInformationObjectionController.Show) + router.Post("/", requestForInformationObjectionController.Save) + router.Put("/:id", requestForInformationObjectionController.Update) + router.Delete("/:id", requestForInformationObjectionController.Delete) + }) +} diff --git a/app/module/request_for_information_objection/response/request_for_information_objection.response.go b/app/module/request_for_information_objection/response/request_for_information_objection.response.go new file mode 100644 index 0000000..9a14696 --- /dev/null +++ b/app/module/request_for_information_objection/response/request_for_information_objection.response.go @@ -0,0 +1,16 @@ +package response + +import "time" + +type RequestForInformationObjectionResponse struct { + ID uint `json:"id"` + RequestForInformationId uint `json:"request_for_information_id"` + DocumentName string `json:"document_name"` + MainReason string `json:"main_reason"` + SecondaryReason string `json:"secondary_reason"` + CreatedById uint `json:"created_by_id"` + StatusId int `json:"status_id"` + IsActive *bool `json:"is_active"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` +} diff --git a/app/module/request_for_information_objection/service/request_for_information_objection.service.go b/app/module/request_for_information_objection/service/request_for_information_objection.service.go new file mode 100644 index 0000000..cd4309e --- /dev/null +++ b/app/module/request_for_information_objection/service/request_for_information_objection.service.go @@ -0,0 +1,90 @@ +package service + +import ( + "github.com/rs/zerolog" + "go-humas-be/app/database/entity" + "go-humas-be/app/module/request_for_information_objection/mapper" + "go-humas-be/app/module/request_for_information_objection/repository" + "go-humas-be/app/module/request_for_information_objection/request" + "go-humas-be/app/module/request_for_information_objection/response" + usersRepository "go-humas-be/app/module/users/repository" + "go-humas-be/utils/paginator" + + utilSvc "go-humas-be/utils/service" +) + +// RequestForInformationObjectionService +type requestForInformationObjectionService struct { + Repo repository.RequestForInformationObjectionRepository + UsersRepo usersRepository.UsersRepository + Log zerolog.Logger +} + +// RequestForInformationObjectionService define interface of IRequestForInformationObjectionService +type RequestForInformationObjectionService interface { + All(req request.RequestForInformationObjectionQueryRequest) (requestForInformationObjection []*response.RequestForInformationObjectionResponse, paging paginator.Pagination, err error) + Show(id uint) (requestForInformationObjection *response.RequestForInformationObjectionResponse, err error) + Save(req request.RequestForInformationObjectionCreateRequest, authToken string) (requestForInformationObjection *entity.RequestForInformationObjection, err error) + Update(id uint, req request.RequestForInformationObjectionUpdateRequest) (err error) + Delete(id uint) error +} + +// NewRequestForInformationObjectionService init RequestForInformationObjectionService +func NewRequestForInformationObjectionService(repo repository.RequestForInformationObjectionRepository, log zerolog.Logger, usersRepo usersRepository.UsersRepository) RequestForInformationObjectionService { + + return &requestForInformationObjectionService{ + Repo: repo, + Log: log, + UsersRepo: usersRepo, + } +} + +// All implement interface of RequestForInformationObjectionService +func (_i *requestForInformationObjectionService) All(req request.RequestForInformationObjectionQueryRequest) (requestForInformationObjections []*response.RequestForInformationObjectionResponse, paging paginator.Pagination, err error) { + results, paging, err := _i.Repo.GetAll(req) + if err != nil { + return + } + + for _, result := range results { + requestForInformationObjections = append(requestForInformationObjections, mapper.RequestForInformationObjectionResponseMapper(result)) + } + + return +} + +func (_i *requestForInformationObjectionService) Show(id uint) (requestForInformationObjection *response.RequestForInformationObjectionResponse, err error) { + result, err := _i.Repo.FindOne(id) + if err != nil { + return nil, err + } + + return mapper.RequestForInformationObjectionResponseMapper(result), nil +} + +func (_i *requestForInformationObjectionService) Save(req request.RequestForInformationObjectionCreateRequest, authToken string) (requestForInformationObjection *entity.RequestForInformationObjection, err error) { + _i.Log.Info().Interface("data", req).Msg("") + + newReq := req.ToEntity() + + createdBy := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) + newReq.CreatedById = createdBy.ID + + return _i.Repo.Create(newReq) +} + +func (_i *requestForInformationObjectionService) Update(id uint, req request.RequestForInformationObjectionUpdateRequest) (err error) { + _i.Log.Info().Interface("data", req).Msg("") + return _i.Repo.Update(id, req.ToEntity()) +} + +func (_i *requestForInformationObjectionService) Delete(id uint) error { + result, err := _i.Repo.FindOne(id) + if err != nil { + return err + } + + isActive := false + result.IsActive = &isActive + return _i.Repo.Update(id, result) +} diff --git a/app/router/api.go b/app/router/api.go index 61949c4..379345d 100644 --- a/app/router/api.go +++ b/app/router/api.go @@ -18,6 +18,7 @@ import ( "go-humas-be/app/module/ppid_datas" "go-humas-be/app/module/provinces" "go-humas-be/app/module/request_for_information_items" + "go-humas-be/app/module/request_for_information_objection" "go-humas-be/app/module/request_for_information_replies" "go-humas-be/app/module/request_for_informations" "go-humas-be/app/module/user_levels" @@ -32,27 +33,28 @@ type Router struct { App fiber.Router Cfg *config.Config - ArticleCategoriesRouter *article_categories.ArticleCategoriesRouter - ArticleCategoryDetailsRouter *article_category_details.ArticleCategoryDetailsRouter - ArticleFilesRouter *article_files.ArticleFilesRouter - ArticlesRouter *articles.ArticlesRouter - CitiesRouter *cities.CitiesRouter - DistrictsRouter *districts.DistrictsRouter - MagazineFilesRouter *magazine_files.MagazineFilesRouter - MagazinesRouter *magazines.MagazinesRouter - MasterMenusRouter *master_menus.MasterMenusRouter - MasterModulesRouter *master_modules.MasterModulesRouter - PpidDataCategoriesRouter *ppid_data_categories.PpidDataCategoriesRouter - PpidDataFilesRouter *ppid_data_files.PpidDataFilesRouter - PpidDatasRouter *ppid_datas.PpidDatasRouter - ProvincesRouter *provinces.ProvincesRouter - RequestForInformationsRouter *request_for_informations.RequestForInformationsRouter - RequestForInformationItemsRouter *request_for_information_items.RequestForInformationItemsRouter - RequestForInformationRepliesRouter *request_for_information_replies.RequestForInformationRepliesRouter - UserLevelsRouter *user_levels.UserLevelsRouter - UserRoleAccessesRouter *user_role_accesses.UserRoleAccessesRouter - UserRolesRouter *user_roles.UserRolesRouter - UsersRouter *users.UsersRouter + ArticleCategoriesRouter *article_categories.ArticleCategoriesRouter + ArticleCategoryDetailsRouter *article_category_details.ArticleCategoryDetailsRouter + ArticleFilesRouter *article_files.ArticleFilesRouter + ArticlesRouter *articles.ArticlesRouter + CitiesRouter *cities.CitiesRouter + DistrictsRouter *districts.DistrictsRouter + MagazineFilesRouter *magazine_files.MagazineFilesRouter + MagazinesRouter *magazines.MagazinesRouter + MasterMenusRouter *master_menus.MasterMenusRouter + MasterModulesRouter *master_modules.MasterModulesRouter + PpidDataCategoriesRouter *ppid_data_categories.PpidDataCategoriesRouter + PpidDataFilesRouter *ppid_data_files.PpidDataFilesRouter + PpidDatasRouter *ppid_datas.PpidDatasRouter + ProvincesRouter *provinces.ProvincesRouter + RequestForInformationsRouter *request_for_informations.RequestForInformationsRouter + RequestForInformationItemsRouter *request_for_information_items.RequestForInformationItemsRouter + RequestForInformationRepliesRouter *request_for_information_replies.RequestForInformationRepliesRouter + RequestForInformationObjectionRouter *request_for_information_objection.RequestForInformationObjectionRouter + UserLevelsRouter *user_levels.UserLevelsRouter + UserRoleAccessesRouter *user_role_accesses.UserRoleAccessesRouter + UserRolesRouter *user_roles.UserRolesRouter + UsersRouter *users.UsersRouter } func NewRouter( @@ -76,35 +78,37 @@ func NewRouter( requestForInformationsRouter *request_for_informations.RequestForInformationsRouter, requestForInformationItemsRouter *request_for_information_items.RequestForInformationItemsRouter, requestForInformationRepliesRouter *request_for_information_replies.RequestForInformationRepliesRouter, + requestForInformationObjectionRouter *request_for_information_objection.RequestForInformationObjectionRouter, userLevelsRouter *user_levels.UserLevelsRouter, userRoleAccessesRouter *user_role_accesses.UserRoleAccessesRouter, userRolesRouter *user_roles.UserRolesRouter, usersRouter *users.UsersRouter, ) *Router { return &Router{ - App: fiber, - Cfg: cfg, - ArticleCategoriesRouter: articleCategoriesRouter, - ArticleCategoryDetailsRouter: articleCategoryDetailsRouter, - ArticleFilesRouter: articleFilesRouter, - ArticlesRouter: articlesRouter, - CitiesRouter: citiesRouter, - DistrictsRouter: districtsRouter, - MagazineFilesRouter: magazineFilesRouter, - MagazinesRouter: magazinesRouter, - MasterMenusRouter: masterMenuRouter, - MasterModulesRouter: masterModuleRouter, - PpidDataCategoriesRouter: ppidDataCategoriesRouter, - PpidDataFilesRouter: ppidDataFilesRouter, - PpidDatasRouter: ppidDatasRouter, - ProvincesRouter: provincesRouter, - RequestForInformationsRouter: requestForInformationsRouter, - RequestForInformationItemsRouter: requestForInformationItemsRouter, - RequestForInformationRepliesRouter: requestForInformationRepliesRouter, - UserLevelsRouter: userLevelsRouter, - UserRoleAccessesRouter: userRoleAccessesRouter, - UserRolesRouter: userRolesRouter, - UsersRouter: usersRouter, + App: fiber, + Cfg: cfg, + ArticleCategoriesRouter: articleCategoriesRouter, + ArticleCategoryDetailsRouter: articleCategoryDetailsRouter, + ArticleFilesRouter: articleFilesRouter, + ArticlesRouter: articlesRouter, + CitiesRouter: citiesRouter, + DistrictsRouter: districtsRouter, + MagazineFilesRouter: magazineFilesRouter, + MagazinesRouter: magazinesRouter, + MasterMenusRouter: masterMenuRouter, + MasterModulesRouter: masterModuleRouter, + PpidDataCategoriesRouter: ppidDataCategoriesRouter, + PpidDataFilesRouter: ppidDataFilesRouter, + PpidDatasRouter: ppidDatasRouter, + ProvincesRouter: provincesRouter, + RequestForInformationsRouter: requestForInformationsRouter, + RequestForInformationItemsRouter: requestForInformationItemsRouter, + RequestForInformationRepliesRouter: requestForInformationRepliesRouter, + RequestForInformationObjectionRouter: requestForInformationObjectionRouter, + UserLevelsRouter: userLevelsRouter, + UserRoleAccessesRouter: userRoleAccessesRouter, + UserRolesRouter: userRolesRouter, + UsersRouter: usersRouter, } } @@ -136,6 +140,7 @@ func (r *Router) Register() { r.RequestForInformationsRouter.RegisterRequestForInformationsRoutes() r.RequestForInformationItemsRouter.RegisterRequestForInformationItemsRoutes() r.RequestForInformationRepliesRouter.RegisterRequestForInformationRepliesRoutes() + r.RequestForInformationObjectionRouter.RegisterRequestForInformationObjectionRoutes() r.UserLevelsRouter.RegisterUserLevelsRoutes() r.UserRoleAccessesRouter.RegisterUserRoleAccessesRoutes() r.UsersRouter.RegisterUsersRoutes() diff --git a/docs/swagger/docs.go b/docs/swagger/docs.go index 6aa33fe..ba892ec 100644 --- a/docs/swagger/docs.go +++ b/docs/swagger/docs.go @@ -5593,6 +5593,335 @@ const docTemplate = `{ } } }, + "/request-for-information-objection": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for getting all RequestForInformationObjection", + "tags": [ + "RequestForInformationObjection" + ], + "summary": "Get all RequestForInformationObjection", + "parameters": [ + { + "type": "integer", + "name": "created_by_id", + "in": "query" + }, + { + "type": "string", + "name": "document_name", + "in": "query" + }, + { + "type": "string", + "name": "main_reason", + "in": "query" + }, + { + "type": "integer", + "name": "request_for_information_id", + "in": "query" + }, + { + "type": "string", + "name": "secondary_reason", + "in": "query" + }, + { + "type": "integer", + "name": "status_id", + "in": "query" + }, + { + "type": "integer", + "name": "count", + "in": "query" + }, + { + "type": "integer", + "name": "limit", + "in": "query" + }, + { + "type": "integer", + "name": "nextPage", + "in": "query" + }, + { + "type": "integer", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "name": "previousPage", + "in": "query" + }, + { + "type": "string", + "name": "sort", + "in": "query" + }, + { + "type": "string", + "name": "sortBy", + "in": "query" + }, + { + "type": "integer", + "name": "totalPage", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.BadRequestError" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.UnauthorizedError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.InternalServerError" + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for create RequestForInformationObjection", + "tags": [ + "RequestForInformationObjection" + ], + "summary": "Create RequestForInformationObjection", + "parameters": [ + { + "type": "string", + "default": "Bearer \u003cAdd access token here\u003e", + "description": "Insert your access token", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "Required payload", + "name": "payload", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.RequestForInformationObjectionCreateRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.BadRequestError" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.UnauthorizedError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.InternalServerError" + } + } + } + } + }, + "/request-for-information-objection/:id": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for getting one RequestForInformationObjection", + "tags": [ + "RequestForInformationObjection" + ], + "summary": "Get one RequestForInformationObjection", + "parameters": [ + { + "type": "integer", + "description": "RequestForInformationObjection ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.BadRequestError" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.UnauthorizedError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.InternalServerError" + } + } + } + }, + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for update RequestForInformationObjection", + "tags": [ + "RequestForInformationObjection" + ], + "summary": "update RequestForInformationObjection", + "parameters": [ + { + "type": "string", + "default": "Bearer \u003cAdd access token here\u003e", + "description": "Insert your access token", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "Required payload", + "name": "payload", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.RequestForInformationObjectionUpdateRequest" + } + }, + { + "type": "integer", + "description": "RequestForInformationObjection ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.BadRequestError" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.UnauthorizedError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.InternalServerError" + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for delete RequestForInformationObjection", + "tags": [ + "RequestForInformationObjection" + ], + "summary": "delete RequestForInformationObjection", + "parameters": [ + { + "type": "integer", + "description": "RequestForInformationObjection ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.BadRequestError" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.UnauthorizedError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.InternalServerError" + } + } + } + } + }, "/request-for-information-replies": { "get": { "security": [ @@ -8348,6 +8677,64 @@ const docTemplate = `{ } } }, + "request.RequestForInformationObjectionCreateRequest": { + "type": "object", + "required": [ + "document_name", + "main_reason", + "request_for_information_id", + "secondary_reason", + "status_id" + ], + "properties": { + "document_name": { + "type": "string" + }, + "main_reason": { + "type": "string" + }, + "request_for_information_id": { + "type": "integer" + }, + "secondary_reason": { + "type": "string" + }, + "status_id": { + "type": "integer" + } + } + }, + "request.RequestForInformationObjectionUpdateRequest": { + "type": "object", + "required": [ + "document_name", + "id", + "main_reason", + "request_for_information_id", + "secondary_reason", + "status_id" + ], + "properties": { + "document_name": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "main_reason": { + "type": "string" + }, + "request_for_information_id": { + "type": "integer" + }, + "secondary_reason": { + "type": "string" + }, + "status_id": { + "type": "integer" + } + } + }, "request.RequestForInformationRepliesCreateRequest": { "type": "object", "required": [ diff --git a/docs/swagger/swagger.json b/docs/swagger/swagger.json index e442725..d599ef3 100644 --- a/docs/swagger/swagger.json +++ b/docs/swagger/swagger.json @@ -5582,6 +5582,335 @@ } } }, + "/request-for-information-objection": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for getting all RequestForInformationObjection", + "tags": [ + "RequestForInformationObjection" + ], + "summary": "Get all RequestForInformationObjection", + "parameters": [ + { + "type": "integer", + "name": "created_by_id", + "in": "query" + }, + { + "type": "string", + "name": "document_name", + "in": "query" + }, + { + "type": "string", + "name": "main_reason", + "in": "query" + }, + { + "type": "integer", + "name": "request_for_information_id", + "in": "query" + }, + { + "type": "string", + "name": "secondary_reason", + "in": "query" + }, + { + "type": "integer", + "name": "status_id", + "in": "query" + }, + { + "type": "integer", + "name": "count", + "in": "query" + }, + { + "type": "integer", + "name": "limit", + "in": "query" + }, + { + "type": "integer", + "name": "nextPage", + "in": "query" + }, + { + "type": "integer", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "name": "previousPage", + "in": "query" + }, + { + "type": "string", + "name": "sort", + "in": "query" + }, + { + "type": "string", + "name": "sortBy", + "in": "query" + }, + { + "type": "integer", + "name": "totalPage", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.BadRequestError" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.UnauthorizedError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.InternalServerError" + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for create RequestForInformationObjection", + "tags": [ + "RequestForInformationObjection" + ], + "summary": "Create RequestForInformationObjection", + "parameters": [ + { + "type": "string", + "default": "Bearer \u003cAdd access token here\u003e", + "description": "Insert your access token", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "Required payload", + "name": "payload", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.RequestForInformationObjectionCreateRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.BadRequestError" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.UnauthorizedError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.InternalServerError" + } + } + } + } + }, + "/request-for-information-objection/:id": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for getting one RequestForInformationObjection", + "tags": [ + "RequestForInformationObjection" + ], + "summary": "Get one RequestForInformationObjection", + "parameters": [ + { + "type": "integer", + "description": "RequestForInformationObjection ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.BadRequestError" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.UnauthorizedError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.InternalServerError" + } + } + } + }, + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for update RequestForInformationObjection", + "tags": [ + "RequestForInformationObjection" + ], + "summary": "update RequestForInformationObjection", + "parameters": [ + { + "type": "string", + "default": "Bearer \u003cAdd access token here\u003e", + "description": "Insert your access token", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "Required payload", + "name": "payload", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.RequestForInformationObjectionUpdateRequest" + } + }, + { + "type": "integer", + "description": "RequestForInformationObjection ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.BadRequestError" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.UnauthorizedError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.InternalServerError" + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for delete RequestForInformationObjection", + "tags": [ + "RequestForInformationObjection" + ], + "summary": "delete RequestForInformationObjection", + "parameters": [ + { + "type": "integer", + "description": "RequestForInformationObjection ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.BadRequestError" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.UnauthorizedError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.InternalServerError" + } + } + } + } + }, "/request-for-information-replies": { "get": { "security": [ @@ -8337,6 +8666,64 @@ } } }, + "request.RequestForInformationObjectionCreateRequest": { + "type": "object", + "required": [ + "document_name", + "main_reason", + "request_for_information_id", + "secondary_reason", + "status_id" + ], + "properties": { + "document_name": { + "type": "string" + }, + "main_reason": { + "type": "string" + }, + "request_for_information_id": { + "type": "integer" + }, + "secondary_reason": { + "type": "string" + }, + "status_id": { + "type": "integer" + } + } + }, + "request.RequestForInformationObjectionUpdateRequest": { + "type": "object", + "required": [ + "document_name", + "id", + "main_reason", + "request_for_information_id", + "secondary_reason", + "status_id" + ], + "properties": { + "document_name": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "main_reason": { + "type": "string" + }, + "request_for_information_id": { + "type": "integer" + }, + "secondary_reason": { + "type": "string" + }, + "status_id": { + "type": "integer" + } + } + }, "request.RequestForInformationRepliesCreateRequest": { "type": "object", "required": [ diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 7ffd5b8..ed8af24 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -404,6 +404,47 @@ definitions: - requested_info - status_id type: object + request.RequestForInformationObjectionCreateRequest: + properties: + document_name: + type: string + main_reason: + type: string + request_for_information_id: + type: integer + secondary_reason: + type: string + status_id: + type: integer + required: + - document_name + - main_reason + - request_for_information_id + - secondary_reason + - status_id + type: object + request.RequestForInformationObjectionUpdateRequest: + properties: + document_name: + type: string + id: + type: integer + main_reason: + type: string + request_for_information_id: + type: integer + secondary_reason: + type: string + status_id: + type: integer + required: + - document_name + - id + - main_reason + - request_for_information_id + - secondary_reason + - status_id + type: object request.RequestForInformationRepliesCreateRequest: properties: file_url: @@ -4305,6 +4346,214 @@ paths: summary: update RequestForInformationItems tags: - RequestForInformationItems + /request-for-information-objection: + get: + description: API for getting all RequestForInformationObjection + parameters: + - in: query + name: created_by_id + type: integer + - in: query + name: document_name + type: string + - in: query + name: main_reason + type: string + - in: query + name: request_for_information_id + type: integer + - in: query + name: secondary_reason + type: string + - in: query + name: status_id + type: integer + - in: query + name: count + type: integer + - in: query + name: limit + type: integer + - in: query + name: nextPage + type: integer + - in: query + name: page + type: integer + - in: query + name: previousPage + type: integer + - in: query + name: sort + type: string + - in: query + name: sortBy + type: string + - in: query + name: totalPage + type: integer + responses: + "200": + description: OK + schema: + $ref: '#/definitions/response.Response' + "400": + description: Bad Request + schema: + $ref: '#/definitions/response.BadRequestError' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/response.UnauthorizedError' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/response.InternalServerError' + security: + - Bearer: [] + summary: Get all RequestForInformationObjection + tags: + - RequestForInformationObjection + post: + description: API for create RequestForInformationObjection + parameters: + - default: Bearer + description: Insert your access token + in: header + name: Authorization + required: true + type: string + - description: Required payload + in: body + name: payload + required: true + schema: + $ref: '#/definitions/request.RequestForInformationObjectionCreateRequest' + responses: + "200": + description: OK + schema: + $ref: '#/definitions/response.Response' + "400": + description: Bad Request + schema: + $ref: '#/definitions/response.BadRequestError' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/response.UnauthorizedError' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/response.InternalServerError' + security: + - Bearer: [] + summary: Create RequestForInformationObjection + tags: + - RequestForInformationObjection + /request-for-information-objection/:id: + delete: + description: API for delete RequestForInformationObjection + parameters: + - description: RequestForInformationObjection ID + in: path + name: id + required: true + type: integer + responses: + "200": + description: OK + schema: + $ref: '#/definitions/response.Response' + "400": + description: Bad Request + schema: + $ref: '#/definitions/response.BadRequestError' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/response.UnauthorizedError' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/response.InternalServerError' + security: + - Bearer: [] + summary: delete RequestForInformationObjection + tags: + - RequestForInformationObjection + get: + description: API for getting one RequestForInformationObjection + parameters: + - description: RequestForInformationObjection ID + in: path + name: id + required: true + type: integer + responses: + "200": + description: OK + schema: + $ref: '#/definitions/response.Response' + "400": + description: Bad Request + schema: + $ref: '#/definitions/response.BadRequestError' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/response.UnauthorizedError' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/response.InternalServerError' + security: + - Bearer: [] + summary: Get one RequestForInformationObjection + tags: + - RequestForInformationObjection + put: + description: API for update RequestForInformationObjection + parameters: + - default: Bearer + description: Insert your access token + in: header + name: Authorization + required: true + type: string + - description: Required payload + in: body + name: payload + required: true + schema: + $ref: '#/definitions/request.RequestForInformationObjectionUpdateRequest' + - description: RequestForInformationObjection ID + in: path + name: id + required: true + type: integer + responses: + "200": + description: OK + schema: + $ref: '#/definitions/response.Response' + "400": + description: Bad Request + schema: + $ref: '#/definitions/response.BadRequestError' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/response.UnauthorizedError' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/response.InternalServerError' + security: + - Bearer: [] + summary: update RequestForInformationObjection + tags: + - RequestForInformationObjection /request-for-information-replies: get: description: API for getting all RequestForInformationReplies diff --git a/main.go b/main.go index 9636ff0..07bfffc 100644 --- a/main.go +++ b/main.go @@ -20,6 +20,7 @@ import ( "go-humas-be/app/module/ppid_datas" "go-humas-be/app/module/provinces" "go-humas-be/app/module/request_for_information_items" + "go-humas-be/app/module/request_for_information_objection" "go-humas-be/app/module/request_for_information_replies" "go-humas-be/app/module/request_for_informations" "go-humas-be/app/module/user_levels" @@ -79,6 +80,7 @@ func main() { request_for_informations.NewRequestForInformationsModule, request_for_information_items.NewRequestForInformationItemsModule, request_for_information_replies.NewRequestForInformationRepliesModule, + request_for_information_objection.NewRequestForInformationObjectionModule, // start aplication fx.Invoke(webserver.Start),