feat: add RequestForInformationObjectionReplies

This commit is contained in:
hanif salafi 2024-07-11 00:16:47 +07:00
parent da35a96223
commit c3fe750def
20 changed files with 1837 additions and 128 deletions

View File

@ -0,0 +1,14 @@
package entity
import "time"
type RequestForInformationObjectionReplies struct {
ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"`
RequestForInformationObjectionId int `json:"request_for_information_objection_id" gorm:"type:int4"`
Response string `json:"response" gorm:"type:varchar"`
StatusId int `json:"status_id" gorm:"type:int4"`
CreatedById *uint `json:"created_by_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()"`
}

View File

@ -3,25 +3,27 @@ package entity
import "time" import "time"
type Users struct { type Users struct {
ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"` ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"`
Username string `json:"username" gorm:"type:varchar"` Username string `json:"username" gorm:"type:varchar"`
Email string `json:"email" gorm:"type:varchar"` Email string `json:"email" gorm:"type:varchar"`
Fullname string `json:"fullname" gorm:"type:varchar"` Fullname string `json:"fullname" gorm:"type:varchar"`
Address string `json:"address" gorm:"type:varchar"` Address string `json:"address" gorm:"type:varchar"`
PhoneNumber string `json:"phone_number" gorm:"type:varchar"` PhoneNumber string `json:"phone_number" gorm:"type:varchar"`
WorkType string `json:"work_type" gorm:"type:varchar"` WorkType string `json:"work_type" gorm:"type:varchar"`
GenderType string `json:"gender_type" gorm:"type:varchar"` GenderType string `json:"gender_type" gorm:"type:varchar"`
IdentityType string `json:"identity_type" gorm:"type:varchar"` IdentityType string `json:"identity_type" gorm:"type:varchar"`
IdentityNumber string `json:"identity_number" gorm:"type:varchar"` IdentityGroup string `json:"identity_group" gorm:"type:varchar"`
DateOfBirth string `json:"date_of_birth" gorm:"type:varchar"` IdentityGroupNumber string `json:"identity_group_number" gorm:"type:varchar"`
LastEducation string `json:"last_education" gorm:"type:varchar"` IdentityNumber string `json:"identity_number" gorm:"type:varchar"`
UserRoleId uint `json:"user_role_id" gorm:"type:int4"` DateOfBirth string `json:"date_of_birth" gorm:"type:varchar"`
UserLevelId uint `json:"user_level_id" gorm:"type:int4"` LastEducation string `json:"last_education" gorm:"type:varchar"`
KeycloakId *string `json:"keycloak_id" gorm:"type:varchar"` UserRoleId uint `json:"user_role_id" gorm:"type:int4"`
StatusId *int `json:"status_id" gorm:"type:int4;default:1"` UserLevelId uint `json:"user_level_id" gorm:"type:int4"`
CreatedById *uint `json:"created_by_id" gorm:"type:int4"` KeycloakId *string `json:"keycloak_id" gorm:"type:varchar"`
ProfilePicturePath *string `json:"profile_picture_path" gorm:"type:varchar"` StatusId *int `json:"status_id" gorm:"type:int4;default:1"`
IsActive *bool `json:"is_active" gorm:"type:bool;default:true"` CreatedById *uint `json:"created_by_id" gorm:"type:int4"`
CreatedAt time.Time `json:"created_at" gorm:"default:now()"` ProfilePicturePath *string `json:"profile_picture_path" gorm:"type:varchar"`
UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"` IsActive *bool `json:"is_active" gorm:"type:bool;default:true"`
CreatedAt time.Time `json:"created_at" gorm:"default:now()"`
UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"`
} }

View File

@ -88,6 +88,7 @@ func Models() []interface{} {
entity.RequestForInformationItems{}, entity.RequestForInformationItems{},
entity.RequestForInformationReplies{}, entity.RequestForInformationReplies{},
entity.RequestForInformationObjection{}, entity.RequestForInformationObjection{},
entity.RequestForInformationObjectionReplies{},
entity.UserLevels{}, entity.UserLevels{},
entity.UserRoles{}, entity.UserRoles{},
entity.UserRoleAccesses{}, entity.UserRoleAccesses{},

View File

@ -0,0 +1,16 @@
package controller
import (
"github.com/rs/zerolog"
"go-humas-be/app/module/request_for_information_objection_replies/service"
)
type Controller struct {
RequestForInformationObjectionReplies RequestForInformationObjectionRepliesController
}
func NewController(RequestForInformationObjectionRepliesService service.RequestForInformationObjectionRepliesService, log zerolog.Logger) *Controller {
return &Controller{
RequestForInformationObjectionReplies: NewRequestForInformationObjectionRepliesController(RequestForInformationObjectionRepliesService, log),
}
}

View File

@ -0,0 +1,193 @@
package controller
import (
"github.com/gofiber/fiber/v2"
"github.com/rs/zerolog"
"go-humas-be/app/module/request_for_information_objection_replies/request"
"go-humas-be/app/module/request_for_information_objection_replies/service"
"go-humas-be/utils/paginator"
utilRes "go-humas-be/utils/response"
utilVal "go-humas-be/utils/validator"
"strconv"
)
type requestForInformationObjectionRepliesController struct {
requestForInformationObjectionRepliesService service.RequestForInformationObjectionRepliesService
Log zerolog.Logger
}
type RequestForInformationObjectionRepliesController 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 NewRequestForInformationObjectionRepliesController(requestForInformationObjectionRepliesService service.RequestForInformationObjectionRepliesService, log zerolog.Logger) RequestForInformationObjectionRepliesController {
return &requestForInformationObjectionRepliesController{
requestForInformationObjectionRepliesService: requestForInformationObjectionRepliesService,
Log: log,
}
}
// All get all RequestForInformationObjectionReplies
// @Summary Get all RequestForInformationObjectionReplies
// @Description API for getting all RequestForInformationObjectionReplies
// @Tags RequestForInformationObjectionReplies
// @Security Bearer
// @Param req query request.RequestForInformationObjectionRepliesQueryRequest 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-replies [get]
func (_i *requestForInformationObjectionRepliesController) All(c *fiber.Ctx) error {
paginate, err := paginator.Paginate(c)
if err != nil {
return err
}
reqContext := request.RequestForInformationObjectionRepliesQueryRequestContext{
RequestForInformationObjectionId: c.Query("requestForInformationObjectionId"),
Response: c.Query("response"),
StatusId: c.Query("statusId"),
}
req := reqContext.ToParamRequest()
req.Pagination = paginate
requestForInformationObjectionRepliesData, paging, err := _i.requestForInformationObjectionRepliesService.All(req)
if err != nil {
return err
}
return utilRes.Resp(c, utilRes.Response{
Success: true,
Messages: utilRes.Messages{"RequestForInformationObjectionReplies list successfully retrieved"},
Data: requestForInformationObjectionRepliesData,
Meta: paging,
})
}
// Show get one RequestForInformationObjectionReplies
// @Summary Get one RequestForInformationObjectionReplies
// @Description API for getting one RequestForInformationObjectionReplies
// @Tags RequestForInformationObjectionReplies
// @Security Bearer
// @Param id path int true "RequestForInformationObjectionReplies 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-replies/{id} [get]
func (_i *requestForInformationObjectionRepliesController) Show(c *fiber.Ctx) error {
id, err := strconv.ParseUint(c.Params("id"), 10, 0)
if err != nil {
return err
}
requestForInformationObjectionRepliesData, err := _i.requestForInformationObjectionRepliesService.Show(uint(id))
if err != nil {
return err
}
return utilRes.Resp(c, utilRes.Response{
Success: true,
Messages: utilRes.Messages{"RequestForInformationObjectionReplies successfully retrieved"},
Data: requestForInformationObjectionRepliesData,
})
}
// Save create RequestForInformationObjectionReplies
// @Summary Create RequestForInformationObjectionReplies
// @Description API for create RequestForInformationObjectionReplies
// @Tags RequestForInformationObjectionReplies
// @Security Bearer
// @Param Authorization header string true "Insert your access token" default(Bearer <Add access token here>)
// @Param payload body request.RequestForInformationObjectionRepliesCreateRequest 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-replies [post]
func (_i *requestForInformationObjectionRepliesController) Save(c *fiber.Ctx) error {
req := new(request.RequestForInformationObjectionRepliesCreateRequest)
if err := utilVal.ParseAndValidate(c, req); err != nil {
return err
}
authToken := c.Get("Authorization")
dataResult, err := _i.requestForInformationObjectionRepliesService.Save(*req, authToken)
if err != nil {
return err
}
return utilRes.Resp(c, utilRes.Response{
Success: true,
Messages: utilRes.Messages{"RequestForInformationObjectionReplies successfully created"},
Data: dataResult,
})
}
// Update update RequestForInformationObjectionReplies
// @Summary update RequestForInformationObjectionReplies
// @Description API for update RequestForInformationObjectionReplies
// @Tags RequestForInformationObjectionReplies
// @Security Bearer
// @Param payload body request.RequestForInformationObjectionRepliesUpdateRequest true "Required payload"
// @Param id path int true "RequestForInformationObjectionReplies 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-replies/{id} [put]
func (_i *requestForInformationObjectionRepliesController) Update(c *fiber.Ctx) error {
id, err := strconv.ParseUint(c.Params("id"), 10, 0)
if err != nil {
return err
}
req := new(request.RequestForInformationObjectionRepliesUpdateRequest)
if err := utilVal.ParseAndValidate(c, req); err != nil {
return err
}
err = _i.requestForInformationObjectionRepliesService.Update(uint(id), *req)
if err != nil {
return err
}
return utilRes.Resp(c, utilRes.Response{
Success: true,
Messages: utilRes.Messages{"RequestForInformationObjectionReplies successfully updated"},
})
}
// Delete delete RequestForInformationObjectionReplies
// @Summary delete RequestForInformationObjectionReplies
// @Description API for delete RequestForInformationObjectionReplies
// @Tags RequestForInformationObjectionReplies
// @Security Bearer
// @Param id path int true "RequestForInformationObjectionReplies 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-replies/{id} [delete]
func (_i *requestForInformationObjectionRepliesController) Delete(c *fiber.Ctx) error {
id, err := strconv.ParseUint(c.Params("id"), 10, 0)
if err != nil {
return err
}
err = _i.requestForInformationObjectionRepliesService.Delete(uint(id))
if err != nil {
return err
}
return utilRes.Resp(c, utilRes.Response{
Success: true,
Messages: utilRes.Messages{"RequestForInformationObjectionReplies successfully deleted"},
})
}

View File

@ -0,0 +1,22 @@
package mapper
import (
"go-humas-be/app/database/entity"
res "go-humas-be/app/module/request_for_information_objection_replies/response"
)
func RequestForInformationObjectionRepliesResponseMapper(requestForInformationObjectionRepliesReq *entity.RequestForInformationObjectionReplies) (requestForInformationObjectionRepliesRes *res.RequestForInformationObjectionRepliesResponse) {
if requestForInformationObjectionRepliesReq != nil {
requestForInformationObjectionRepliesRes = &res.RequestForInformationObjectionRepliesResponse{
ID: requestForInformationObjectionRepliesReq.ID,
RequestForInformationObjectionId: requestForInformationObjectionRepliesReq.RequestForInformationObjectionId,
Response: requestForInformationObjectionRepliesReq.Response,
StatusId: requestForInformationObjectionRepliesReq.StatusId,
CreatedById: requestForInformationObjectionRepliesReq.CreatedById,
IsActive: requestForInformationObjectionRepliesReq.IsActive,
CreatedAt: requestForInformationObjectionRepliesReq.CreatedAt,
UpdatedAt: requestForInformationObjectionRepliesReq.UpdatedAt,
}
}
return requestForInformationObjectionRepliesRes
}

View File

@ -0,0 +1,98 @@
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_replies/request"
"go-humas-be/utils/paginator"
"strings"
)
type requestForInformationObjectionRepliesRepository struct {
DB *database.Database
Log zerolog.Logger
}
// RequestForInformationObjectionRepliesRepository define interface of IRequestForInformationObjectionRepliesRepository
type RequestForInformationObjectionRepliesRepository interface {
GetAll(req request.RequestForInformationObjectionRepliesQueryRequest) (requestForInformationObjectionRepliess []*entity.RequestForInformationObjectionReplies, paging paginator.Pagination, err error)
FindOne(id uint) (requestForInformationObjectionReplies *entity.RequestForInformationObjectionReplies, err error)
Create(requestForInformationObjectionReplies *entity.RequestForInformationObjectionReplies) (requestForInformationObjectionRepliesReturn *entity.RequestForInformationObjectionReplies, err error)
Update(id uint, requestForInformationObjectionReplies *entity.RequestForInformationObjectionReplies) (err error)
Delete(id uint) (err error)
}
func NewRequestForInformationObjectionRepliesRepository(db *database.Database, logger zerolog.Logger) RequestForInformationObjectionRepliesRepository {
return &requestForInformationObjectionRepliesRepository{
DB: db,
Log: logger,
}
}
// implement interface of IRequestForInformationObjectionRepliesRepository
func (_i *requestForInformationObjectionRepliesRepository) GetAll(req request.RequestForInformationObjectionRepliesQueryRequest) (requestForInformationObjectionRepliess []*entity.RequestForInformationObjectionReplies, paging paginator.Pagination, err error) {
var count int64
query := _i.DB.DB.Model(&entity.RequestForInformationObjectionReplies{})
query = query.Where("is_active = ?", true)
if req.RequestForInformationObjectionId != nil {
query = query.Where("request_for_information_objection_id = ?", req.RequestForInformationObjectionId)
}
if req.Response != nil && *req.Response != "" {
response := strings.ToLower(*req.Response)
query = query.Where("LOWER(response) LIKE ?", "%"+strings.ToLower(response)+"%")
}
if req.StatusId != nil {
query = query.Where("status_id = ?", req.StatusId)
}
if req.CreatedById != nil {
query = query.Where("created_by_id = ?", req.CreatedById)
}
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(&requestForInformationObjectionRepliess).Error
if err != nil {
return
}
paging = *req.Pagination
return
}
func (_i *requestForInformationObjectionRepliesRepository) FindOne(id uint) (requestForInformationObjectionReplies *entity.RequestForInformationObjectionReplies, err error) {
if err := _i.DB.DB.First(&requestForInformationObjectionReplies, id).Error; err != nil {
return nil, err
}
return requestForInformationObjectionReplies, nil
}
func (_i *requestForInformationObjectionRepliesRepository) Create(requestForInformationObjectionReplies *entity.RequestForInformationObjectionReplies) (requestForInformationObjectionRepliesReturn *entity.RequestForInformationObjectionReplies, err error) {
result := _i.DB.DB.Create(requestForInformationObjectionReplies)
return requestForInformationObjectionReplies, result.Error
}
func (_i *requestForInformationObjectionRepliesRepository) Update(id uint, requestForInformationObjectionReplies *entity.RequestForInformationObjectionReplies) (err error) {
return _i.DB.DB.Model(&entity.RequestForInformationObjectionReplies{}).
Where(&entity.RequestForInformationObjectionReplies{ID: id}).
Updates(requestForInformationObjectionReplies).Error
}
func (_i *requestForInformationObjectionRepliesRepository) Delete(id uint) error {
return _i.DB.DB.Delete(&entity.RequestForInformationObjectionReplies{}, id).Error
}

View File

@ -0,0 +1,89 @@
package request
import (
"go-humas-be/app/database/entity"
"go-humas-be/utils/paginator"
"strconv"
"time"
)
type RequestForInformationObjectionRepliesGeneric interface {
ToEntity()
}
type RequestForInformationObjectionRepliesQueryRequest struct {
RequestForInformationObjectionId *int `json:"requestForInformationObjectionId"`
Response *string `json:"response"`
StatusId *int `json:"statusId"`
CreatedById *int `json:"createdById"`
Pagination *paginator.Pagination `json:"pagination"`
}
type RequestForInformationObjectionRepliesCreateRequest struct {
RequestForInformationObjectionId int `json:"requestForInformationObjectionId" validate:"required"`
Response string `json:"response" validate:"required"`
StatusId int `json:"statusId" validate:"required"`
CreatedById int `json:"createdById" validate:"required"`
}
func (req RequestForInformationObjectionRepliesCreateRequest) ToEntity() *entity.RequestForInformationObjectionReplies {
return &entity.RequestForInformationObjectionReplies{
RequestForInformationObjectionId: req.RequestForInformationObjectionId,
Response: req.Response,
StatusId: req.StatusId,
IsActive: func() *bool { b := true; return &b }(),
}
}
type RequestForInformationObjectionRepliesUpdateRequest struct {
ID uint `json:"id" validate:"required"`
RequestForInformationObjectionId int `json:"requestForInformationObjectionId" validate:"required"`
Response string `json:"response" validate:"required"`
StatusId int `json:"statusId" validate:"required"`
UpdatedAt time.Time `json:"updated_at"`
}
func (req RequestForInformationObjectionRepliesUpdateRequest) ToEntity() *entity.RequestForInformationObjectionReplies {
return &entity.RequestForInformationObjectionReplies{
ID: req.ID,
RequestForInformationObjectionId: req.RequestForInformationObjectionId,
Response: req.Response,
StatusId: req.StatusId,
UpdatedAt: time.Now(),
}
}
type RequestForInformationObjectionRepliesQueryRequestContext struct {
RequestForInformationObjectionId string `json:"requestForInformationObjectionId"`
Response string `json:"response"`
StatusId string `json:"statusId"`
CreatedById string `json:"createdById"`
}
func (req RequestForInformationObjectionRepliesQueryRequestContext) ToParamRequest() RequestForInformationObjectionRepliesQueryRequest {
var request RequestForInformationObjectionRepliesQueryRequest
if requestForInformationObjectionIdStr := req.RequestForInformationObjectionId; requestForInformationObjectionIdStr != "" {
requestForInformationObjectionId, err := strconv.Atoi(requestForInformationObjectionIdStr)
if err == nil {
request.RequestForInformationObjectionId = &requestForInformationObjectionId
}
}
if response := req.Response; response != "" {
request.Response = &response
}
if statusIdStr := req.StatusId; statusIdStr != "" {
statusId, err := strconv.Atoi(statusIdStr)
if err == nil {
request.StatusId = &statusId
}
}
if createdByIdStr := req.CreatedById; createdByIdStr != "" {
createdById, err := strconv.Atoi(createdByIdStr)
if err == nil {
request.CreatedById = &createdById
}
}
return request
}

View File

@ -0,0 +1,53 @@
package request_for_information_objection_replies
import (
"github.com/gofiber/fiber/v2"
"go-humas-be/app/module/request_for_information_objection_replies/controller"
"go-humas-be/app/module/request_for_information_objection_replies/repository"
"go-humas-be/app/module/request_for_information_objection_replies/service"
"go.uber.org/fx"
)
// struct of RequestForInformationObjectionRepliesRouter
type RequestForInformationObjectionRepliesRouter struct {
App fiber.Router
Controller *controller.Controller
}
// register bulky of RequestForInformationObjectionReplies module
var NewRequestForInformationObjectionRepliesModule = fx.Options(
// register repository of RequestForInformationObjectionReplies module
fx.Provide(repository.NewRequestForInformationObjectionRepliesRepository),
// register service of RequestForInformationObjectionReplies module
fx.Provide(service.NewRequestForInformationObjectionRepliesService),
// register controller of RequestForInformationObjectionReplies module
fx.Provide(controller.NewController),
// register router of RequestForInformationObjectionReplies module
fx.Provide(NewRequestForInformationObjectionRepliesRouter),
)
// init RequestForInformationObjectionRepliesRouter
func NewRequestForInformationObjectionRepliesRouter(fiber *fiber.App, controller *controller.Controller) *RequestForInformationObjectionRepliesRouter {
return &RequestForInformationObjectionRepliesRouter{
App: fiber,
Controller: controller,
}
}
// register routes of RequestForInformationObjectionReplies module
func (_i *RequestForInformationObjectionRepliesRouter) RegisterRequestForInformationObjectionRepliesRoutes() {
// define controllers
requestForInformationObjectionRepliesController := _i.Controller.RequestForInformationObjectionReplies
// define routes
_i.App.Route("/request-for-information-objection-replies", func(router fiber.Router) {
router.Get("/", requestForInformationObjectionRepliesController.All)
router.Get("/:id", requestForInformationObjectionRepliesController.Show)
router.Post("/", requestForInformationObjectionRepliesController.Save)
router.Put("/:id", requestForInformationObjectionRepliesController.Update)
router.Delete("/:id", requestForInformationObjectionRepliesController.Delete)
})
}

View File

@ -0,0 +1,14 @@
package response
import "time"
type RequestForInformationObjectionRepliesResponse struct {
ID uint `json:"id"`
RequestForInformationObjectionId int `json:"requestForInformationObjectionId"`
Response string `json:"response"`
StatusId int `json:"statusId"`
CreatedById *uint `json:"createdById"`
IsActive *bool `json:"isActive"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}

View File

@ -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_replies/mapper"
"go-humas-be/app/module/request_for_information_objection_replies/repository"
"go-humas-be/app/module/request_for_information_objection_replies/request"
"go-humas-be/app/module/request_for_information_objection_replies/response"
usersRepository "go-humas-be/app/module/users/repository"
"go-humas-be/utils/paginator"
utilSvc "go-humas-be/utils/service"
)
// RequestForInformationObjectionRepliesService
type requestForInformationObjectionRepliesService struct {
Repo repository.RequestForInformationObjectionRepliesRepository
UsersRepo usersRepository.UsersRepository
Log zerolog.Logger
}
// RequestForInformationObjectionRepliesService define interface of IRequestForInformationObjectionRepliesService
type RequestForInformationObjectionRepliesService interface {
All(req request.RequestForInformationObjectionRepliesQueryRequest) (requestForInformationObjectionReplies []*response.RequestForInformationObjectionRepliesResponse, paging paginator.Pagination, err error)
Show(id uint) (requestForInformationObjectionReplies *response.RequestForInformationObjectionRepliesResponse, err error)
Save(req request.RequestForInformationObjectionRepliesCreateRequest, authToken string) (requestForInformationObjectionReplies *entity.RequestForInformationObjectionReplies, err error)
Update(id uint, req request.RequestForInformationObjectionRepliesUpdateRequest) (err error)
Delete(id uint) error
}
// NewRequestForInformationObjectionRepliesService init RequestForInformationObjectionRepliesService
func NewRequestForInformationObjectionRepliesService(repo repository.RequestForInformationObjectionRepliesRepository, log zerolog.Logger, usersRepo usersRepository.UsersRepository) RequestForInformationObjectionRepliesService {
return &requestForInformationObjectionRepliesService{
Repo: repo,
Log: log,
UsersRepo: usersRepo,
}
}
// All implement interface of RequestForInformationObjectionRepliesService
func (_i *requestForInformationObjectionRepliesService) All(req request.RequestForInformationObjectionRepliesQueryRequest) (requestForInformationObjectionRepliess []*response.RequestForInformationObjectionRepliesResponse, paging paginator.Pagination, err error) {
results, paging, err := _i.Repo.GetAll(req)
if err != nil {
return
}
for _, result := range results {
requestForInformationObjectionRepliess = append(requestForInformationObjectionRepliess, mapper.RequestForInformationObjectionRepliesResponseMapper(result))
}
return
}
func (_i *requestForInformationObjectionRepliesService) Show(id uint) (requestForInformationObjectionReplies *response.RequestForInformationObjectionRepliesResponse, err error) {
result, err := _i.Repo.FindOne(id)
if err != nil {
return nil, err
}
return mapper.RequestForInformationObjectionRepliesResponseMapper(result), nil
}
func (_i *requestForInformationObjectionRepliesService) Save(req request.RequestForInformationObjectionRepliesCreateRequest, authToken string) (requestForInformationObjectionReplies *entity.RequestForInformationObjectionReplies, 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 *requestForInformationObjectionRepliesService) Update(id uint, req request.RequestForInformationObjectionRepliesUpdateRequest) (err error) {
_i.Log.Info().Interface("data", req).Msg("")
return _i.Repo.Update(id, req.ToEntity())
}
func (_i *requestForInformationObjectionRepliesService) 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)
}

View File

@ -50,14 +50,18 @@ func (_i *usersController) All(c *fiber.Ctx) error {
} }
reqContext := request.UsersQueryRequestContext{ reqContext := request.UsersQueryRequestContext{
Username: c.Query("username"), Username: c.Query("username"),
Email: c.Query("email"), Email: c.Query("email"),
Fullname: c.Query("fullname"), Fullname: c.Query("fullname"),
Address: c.Query("address"), PhoneNumber: c.Query("phoneNumber"),
PhoneNumber: c.Query("phoneNumber"), WorkType: c.Query("workType"),
IdentityNumber: c.Query("identityNumber"), GenderType: c.Query("genderType"),
UserRoleId: c.Query("userRoleId"), IdentityType: c.Query("identityType"),
StatusId: c.Query("statusId"), IdentityGroup: c.Query("identityGroup"),
IdentityGroupNumber: c.Query("identityGroupNumber"),
IdentityNumber: c.Query("identityNumber"),
UserRoleId: c.Query("userRoleId"),
StatusId: c.Query("statusId"),
} }
req := reqContext.ToParamRequest() req := reqContext.ToParamRequest()
req.Pagination = paginate req.Pagination = paginate

View File

@ -53,6 +53,21 @@ func (_i *usersRepository) GetAll(req request.UsersQueryRequest) (userss []*enti
if req.PhoneNumber != nil && *req.PhoneNumber != "" { if req.PhoneNumber != nil && *req.PhoneNumber != "" {
query = query.Where("phone_number = ?", req.PhoneNumber) query = query.Where("phone_number = ?", req.PhoneNumber)
} }
if req.WorkType != nil && *req.WorkType != "" {
query = query.Where("work_type = ?", req.WorkType)
}
if req.GenderType != nil && *req.GenderType != "" {
query = query.Where("gender_type = ?", req.GenderType)
}
if req.IdentityType != nil && *req.IdentityType != "" {
query = query.Where("identity_type = ?", req.IdentityType)
}
if req.IdentityGroup != nil && *req.IdentityGroup != "" {
query = query.Where("identity_group = ?", req.IdentityGroup)
}
if req.IdentityGroupNumber != nil && *req.IdentityGroupNumber != "" {
query = query.Where("identity_group_number = ?", req.IdentityGroupNumber)
}
if req.IdentityNumber != nil && *req.IdentityNumber != "" { if req.IdentityNumber != nil && *req.IdentityNumber != "" {
query = query.Where("identity_number = ?", req.IdentityNumber) query = query.Where("identity_number = ?", req.IdentityNumber)
} }

View File

@ -12,85 +12,98 @@ type UsersGeneric interface {
} }
type UsersQueryRequest struct { type UsersQueryRequest struct {
Username *string `json:"username"` Username *string `json:"username"`
Email *string `json:"email"` Email *string `json:"email"`
Fullname *string `json:"fullname"` Fullname *string `json:"fullname"`
PhoneNumber *string `json:"phoneNumber"` PhoneNumber *string `json:"phoneNumber"`
IdentityNumber *string `json:"identityNumber"` WorkType *string `json:"workType"`
UserRoleId *int `json:"userRoleId"` GenderType *string `json:"genderType"`
StatusId *int `json:"statusId"` IdentityType *string `json:"identityType"`
Pagination *paginator.Pagination `json:"pagination"` IdentityGroup *string `json:"identityGroup"`
IdentityGroupNumber *string `json:"identityGroupNumber"`
IdentityNumber *string `json:"identityNumber"`
UserRoleId *int `json:"userRoleId"`
StatusId *int `json:"statusId"`
Pagination *paginator.Pagination `json:"pagination"`
} }
type UsersCreateRequest struct { type UsersCreateRequest struct {
Username string `json:"username" validate:"required,lowercase"` Username string `json:"username" validate:"required,lowercase"`
Email string `json:"email" validate:"required,email"` Email string `json:"email" validate:"required,email"`
Fullname string `json:"fullname" validate:"required"` Fullname string `json:"fullname" validate:"required"`
Address string `json:"address" validate:"required"` Address string `json:"address" validate:"required"`
PhoneNumber string `json:"phoneNumber" validate:"required"` PhoneNumber string `json:"phoneNumber" validate:"required"`
WorkType string `json:"workType" validate:"required"` WorkType string `json:"workType" validate:"required"`
GenderType string `json:"genderType" validate:"required"` GenderType string `json:"genderType" validate:"required"`
IdentityType string `json:"identityType" validate:"required"` IdentityType string `json:"identityType" validate:"required"`
IdentityNumber string `json:"identityNumber" validate:"required"` IdentityGroup string `json:"identityGroup" validate:"required"`
DateOfBirth string `json:"dateOfBirth" validate:"required"` IdentityGroupNumber string `json:"identityGroupNumber" validate:"required"`
LastEducation string `json:"lastEducation" validate:"required"` IdentityNumber string `json:"identityNumber" validate:"required"`
UserRoleId uint `json:"userRoleId" validate:"required"` DateOfBirth string `json:"dateOfBirth" validate:"required"`
UserLevelId uint `json:"userLevelId" validate:"required"` LastEducation string `json:"lastEducation" validate:"required"`
Password string `json:"password" validate:"required"` UserRoleId uint `json:"userRoleId" validate:"required"`
UserLevelId uint `json:"userLevelId" validate:"required"`
Password string `json:"password" validate:"required"`
} }
func (req UsersCreateRequest) ToEntity() *entity.Users { func (req UsersCreateRequest) ToEntity() *entity.Users {
return &entity.Users{ return &entity.Users{
Username: req.Username, Username: req.Username,
Email: req.Email, Email: req.Email,
Fullname: req.Fullname, Fullname: req.Fullname,
Address: req.Address, Address: req.Address,
PhoneNumber: req.PhoneNumber, PhoneNumber: req.PhoneNumber,
WorkType: req.WorkType, WorkType: req.WorkType,
GenderType: req.GenderType, GenderType: req.GenderType,
IdentityType: req.IdentityType, IdentityType: req.IdentityType,
IdentityNumber: req.IdentityNumber, IdentityGroup: req.IdentityGroup,
DateOfBirth: req.DateOfBirth, IdentityGroupNumber: req.IdentityGroupNumber,
LastEducation: req.LastEducation, IdentityNumber: req.IdentityNumber,
UserRoleId: req.UserRoleId, DateOfBirth: req.DateOfBirth,
UserLevelId: req.UserLevelId, LastEducation: req.LastEducation,
UserRoleId: req.UserRoleId,
UserLevelId: req.UserLevelId,
} }
} }
type UsersUpdateRequest struct { type UsersUpdateRequest struct {
Username string `json:"username" validate:"required,lowercase"` Username string `json:"username" validate:"required,lowercase"`
Email string `json:"email" validate:"required,email"` Email string `json:"email" validate:"required,email"`
Fullname string `json:"fullname" validate:"required"` Fullname string `json:"fullname" validate:"required"`
Address string `json:"address" validate:"required"` Address string `json:"address" validate:"required"`
PhoneNumber string `json:"phoneNumber" validate:"required"` PhoneNumber string `json:"phoneNumber" validate:"required"`
WorkType string `json:"workType" validate:"required"` WorkType string `json:"workType" validate:"required"`
GenderType string `json:"genderType" validate:"required"` GenderType string `json:"genderType" validate:"required"`
IdentityType string `json:"identityType" validate:"required"` IdentityType string `json:"identityType" validate:"required"`
IdentityNumber string `json:"identityNumber" validate:"required"` IdentityGroup string `json:"identityGroup" validate:"required"`
DateOfBirth string `json:"dateOfBirth" validate:"required"` IdentityGroupNumber string `json:"identityGroupNumber" validate:"required"`
LastEducation string `json:"lastEducation" validate:"required"` IdentityNumber string `json:"identityNumber" validate:"required"`
UserRoleId uint `json:"userRoleId" validate:"required"` DateOfBirth string `json:"dateOfBirth" validate:"required"`
UserLevelId uint `json:"userLevelId" validate:"required"` LastEducation string `json:"lastEducation" validate:"required"`
StatusId *int `json:"statusId"` UserRoleId uint `json:"userRoleId" validate:"required"`
UserLevelId uint `json:"userLevelId" validate:"required"`
StatusId *int `json:"statusId"`
} }
func (req UsersUpdateRequest) ToEntity() *entity.Users { func (req UsersUpdateRequest) ToEntity() *entity.Users {
return &entity.Users{ return &entity.Users{
Username: req.Username, Username: req.Username,
Email: req.Email, Email: req.Email,
Fullname: req.Fullname, Fullname: req.Fullname,
Address: req.Address, Address: req.Address,
PhoneNumber: req.PhoneNumber, PhoneNumber: req.PhoneNumber,
WorkType: req.WorkType, WorkType: req.WorkType,
GenderType: req.GenderType, GenderType: req.GenderType,
IdentityType: req.IdentityType, IdentityType: req.IdentityType,
IdentityNumber: req.IdentityNumber, IdentityGroup: req.IdentityGroup,
DateOfBirth: req.DateOfBirth, IdentityGroupNumber: req.IdentityGroupNumber,
LastEducation: req.LastEducation, IdentityNumber: req.IdentityNumber,
UserRoleId: req.UserRoleId, DateOfBirth: req.DateOfBirth,
StatusId: req.StatusId, LastEducation: req.LastEducation,
UserLevelId: req.UserLevelId, UserRoleId: req.UserRoleId,
UpdatedAt: time.Now(), StatusId: req.StatusId,
UserLevelId: req.UserLevelId,
UpdatedAt: time.Now(),
} }
} }
@ -101,14 +114,18 @@ type UserLogin struct {
} }
type UsersQueryRequestContext struct { type UsersQueryRequestContext struct {
Username string `json:"username"` Username string `json:"username"`
Email string `json:"email"` Email string `json:"email"`
Fullname string `json:"fullname"` Fullname string `json:"fullname"`
Address string `json:"address"` PhoneNumber string `json:"phoneNumber"`
PhoneNumber string `json:"phoneNumber"` WorkType string `json:"workType"`
IdentityNumber string `json:"identityNumber"` GenderType string `json:"genderType"`
UserRoleId string `json:"userRoleId"` IdentityType string `json:"identityType"`
StatusId string `json:"statusId"` IdentityGroup string `json:"identityGroup"`
IdentityGroupNumber string `json:"identityGroupNumber"`
IdentityNumber string `json:"identityNumber"`
UserRoleId string `json:"userRoleId"`
StatusId string `json:"statusId"`
} }
func (req UsersQueryRequestContext) ToParamRequest() UsersQueryRequest { func (req UsersQueryRequestContext) ToParamRequest() UsersQueryRequest {
@ -126,6 +143,21 @@ func (req UsersQueryRequestContext) ToParamRequest() UsersQueryRequest {
if phoneNumber := req.PhoneNumber; phoneNumber != "" { if phoneNumber := req.PhoneNumber; phoneNumber != "" {
request.PhoneNumber = &phoneNumber request.PhoneNumber = &phoneNumber
} }
if workType := req.WorkType; workType != "" {
request.WorkType = &workType
}
if genderType := req.GenderType; genderType != "" {
request.GenderType = &genderType
}
if identityType := req.IdentityType; identityType != "" {
request.IdentityType = &identityType
}
if identityGroup := req.IdentityGroup; identityGroup != "" {
request.IdentityGroup = &identityGroup
}
if identityGroupNumber := req.IdentityGroupNumber; identityGroupNumber != "" {
request.IdentityGroupNumber = &identityGroupNumber
}
if identityNumber := req.IdentityNumber; identityNumber != "" { if identityNumber := req.IdentityNumber; identityNumber != "" {
request.IdentityNumber = &identityNumber request.IdentityNumber = &identityNumber
} }

View File

@ -19,6 +19,7 @@ import (
"go-humas-be/app/module/provinces" "go-humas-be/app/module/provinces"
"go-humas-be/app/module/request_for_information_items" "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_objection"
"go-humas-be/app/module/request_for_information_objection_replies"
"go-humas-be/app/module/request_for_information_replies" "go-humas-be/app/module/request_for_information_replies"
"go-humas-be/app/module/request_for_informations" "go-humas-be/app/module/request_for_informations"
"go-humas-be/app/module/user_levels" "go-humas-be/app/module/user_levels"
@ -33,28 +34,29 @@ type Router struct {
App fiber.Router App fiber.Router
Cfg *config.Config Cfg *config.Config
ArticleCategoriesRouter *article_categories.ArticleCategoriesRouter ArticleCategoriesRouter *article_categories.ArticleCategoriesRouter
ArticleCategoryDetailsRouter *article_category_details.ArticleCategoryDetailsRouter ArticleCategoryDetailsRouter *article_category_details.ArticleCategoryDetailsRouter
ArticleFilesRouter *article_files.ArticleFilesRouter ArticleFilesRouter *article_files.ArticleFilesRouter
ArticlesRouter *articles.ArticlesRouter ArticlesRouter *articles.ArticlesRouter
CitiesRouter *cities.CitiesRouter CitiesRouter *cities.CitiesRouter
DistrictsRouter *districts.DistrictsRouter DistrictsRouter *districts.DistrictsRouter
MagazineFilesRouter *magazine_files.MagazineFilesRouter MagazineFilesRouter *magazine_files.MagazineFilesRouter
MagazinesRouter *magazines.MagazinesRouter MagazinesRouter *magazines.MagazinesRouter
MasterMenusRouter *master_menus.MasterMenusRouter MasterMenusRouter *master_menus.MasterMenusRouter
MasterModulesRouter *master_modules.MasterModulesRouter MasterModulesRouter *master_modules.MasterModulesRouter
PpidDataCategoriesRouter *ppid_data_categories.PpidDataCategoriesRouter PpidDataCategoriesRouter *ppid_data_categories.PpidDataCategoriesRouter
PpidDataFilesRouter *ppid_data_files.PpidDataFilesRouter PpidDataFilesRouter *ppid_data_files.PpidDataFilesRouter
PpidDatasRouter *ppid_datas.PpidDatasRouter PpidDatasRouter *ppid_datas.PpidDatasRouter
ProvincesRouter *provinces.ProvincesRouter ProvincesRouter *provinces.ProvincesRouter
RequestForInformationsRouter *request_for_informations.RequestForInformationsRouter RequestForInformationsRouter *request_for_informations.RequestForInformationsRouter
RequestForInformationItemsRouter *request_for_information_items.RequestForInformationItemsRouter RequestForInformationItemsRouter *request_for_information_items.RequestForInformationItemsRouter
RequestForInformationRepliesRouter *request_for_information_replies.RequestForInformationRepliesRouter RequestForInformationRepliesRouter *request_for_information_replies.RequestForInformationRepliesRouter
RequestForInformationObjectionRouter *request_for_information_objection.RequestForInformationObjectionRouter RequestForInformationObjectionRouter *request_for_information_objection.RequestForInformationObjectionRouter
UserLevelsRouter *user_levels.UserLevelsRouter RequestForInformationObjectionRepliesRouter *request_for_information_objection_replies.RequestForInformationObjectionRepliesRouter
UserRoleAccessesRouter *user_role_accesses.UserRoleAccessesRouter UserLevelsRouter *user_levels.UserLevelsRouter
UserRolesRouter *user_roles.UserRolesRouter UserRoleAccessesRouter *user_role_accesses.UserRoleAccessesRouter
UsersRouter *users.UsersRouter UserRolesRouter *user_roles.UserRolesRouter
UsersRouter *users.UsersRouter
} }
func NewRouter( func NewRouter(
@ -79,6 +81,7 @@ func NewRouter(
requestForInformationItemsRouter *request_for_information_items.RequestForInformationItemsRouter, requestForInformationItemsRouter *request_for_information_items.RequestForInformationItemsRouter,
requestForInformationRepliesRouter *request_for_information_replies.RequestForInformationRepliesRouter, requestForInformationRepliesRouter *request_for_information_replies.RequestForInformationRepliesRouter,
requestForInformationObjectionRouter *request_for_information_objection.RequestForInformationObjectionRouter, requestForInformationObjectionRouter *request_for_information_objection.RequestForInformationObjectionRouter,
requestForInformationObjectionRepliesRouter *request_for_information_objection_replies.RequestForInformationObjectionRepliesRouter,
userLevelsRouter *user_levels.UserLevelsRouter, userLevelsRouter *user_levels.UserLevelsRouter,
userRoleAccessesRouter *user_role_accesses.UserRoleAccessesRouter, userRoleAccessesRouter *user_role_accesses.UserRoleAccessesRouter,
userRolesRouter *user_roles.UserRolesRouter, userRolesRouter *user_roles.UserRolesRouter,
@ -105,10 +108,11 @@ func NewRouter(
RequestForInformationItemsRouter: requestForInformationItemsRouter, RequestForInformationItemsRouter: requestForInformationItemsRouter,
RequestForInformationRepliesRouter: requestForInformationRepliesRouter, RequestForInformationRepliesRouter: requestForInformationRepliesRouter,
RequestForInformationObjectionRouter: requestForInformationObjectionRouter, RequestForInformationObjectionRouter: requestForInformationObjectionRouter,
UserLevelsRouter: userLevelsRouter, RequestForInformationObjectionRepliesRouter: requestForInformationObjectionRepliesRouter,
UserRoleAccessesRouter: userRoleAccessesRouter, UserLevelsRouter: userLevelsRouter,
UserRolesRouter: userRolesRouter, UserRoleAccessesRouter: userRoleAccessesRouter,
UsersRouter: usersRouter, UserRolesRouter: userRolesRouter,
UsersRouter: usersRouter,
} }
} }
@ -141,6 +145,7 @@ func (r *Router) Register() {
r.RequestForInformationItemsRouter.RegisterRequestForInformationItemsRoutes() r.RequestForInformationItemsRouter.RegisterRequestForInformationItemsRoutes()
r.RequestForInformationRepliesRouter.RegisterRequestForInformationRepliesRoutes() r.RequestForInformationRepliesRouter.RegisterRequestForInformationRepliesRoutes()
r.RequestForInformationObjectionRouter.RegisterRequestForInformationObjectionRoutes() r.RequestForInformationObjectionRouter.RegisterRequestForInformationObjectionRoutes()
r.RequestForInformationObjectionRepliesRouter.RegisterRequestForInformationObjectionRepliesRoutes()
r.UserLevelsRouter.RegisterUserLevelsRoutes() r.UserLevelsRouter.RegisterUserLevelsRoutes()
r.UserRoleAccessesRouter.RegisterUserRoleAccessesRoutes() r.UserRoleAccessesRouter.RegisterUserRoleAccessesRoutes()
r.UsersRouter.RegisterUsersRoutes() r.UsersRouter.RegisterUsersRoutes()

View File

@ -12,7 +12,7 @@ body-limit = 104857600 # "100 * 1024 * 1024"
[db.postgres] [db.postgres]
dsn = "postgresql://humas_polri:P@ssw0rd.1@103.82.242.92:5432/humas_polri" # <driver>://<username>:<password>@<host>:<port>/<database> dsn = "postgresql://humas_polri:P@ssw0rd.1@103.82.242.92:5432/humas_polri" # <driver>://<username>:<password>@<host>:<port>/<database>
migrate = false migrate = true
seed = false seed = false
[logger] [logger]

View File

@ -5768,6 +5768,317 @@ const docTemplate = `{
} }
} }
}, },
"/request-for-information-objection-replies": {
"get": {
"security": [
{
"Bearer": []
}
],
"description": "API for getting all RequestForInformationObjectionReplies",
"tags": [
"RequestForInformationObjectionReplies"
],
"summary": "Get all RequestForInformationObjectionReplies",
"parameters": [
{
"type": "integer",
"name": "createdById",
"in": "query"
},
{
"type": "integer",
"name": "requestForInformationObjectionId",
"in": "query"
},
{
"type": "string",
"name": "response",
"in": "query"
},
{
"type": "integer",
"name": "statusId",
"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 RequestForInformationObjectionReplies",
"tags": [
"RequestForInformationObjectionReplies"
],
"summary": "Create RequestForInformationObjectionReplies",
"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.RequestForInformationObjectionRepliesCreateRequest"
}
}
],
"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-replies/{id}": {
"get": {
"security": [
{
"Bearer": []
}
],
"description": "API for getting one RequestForInformationObjectionReplies",
"tags": [
"RequestForInformationObjectionReplies"
],
"summary": "Get one RequestForInformationObjectionReplies",
"parameters": [
{
"type": "integer",
"description": "RequestForInformationObjectionReplies 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 RequestForInformationObjectionReplies",
"tags": [
"RequestForInformationObjectionReplies"
],
"summary": "update RequestForInformationObjectionReplies",
"parameters": [
{
"description": "Required payload",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.RequestForInformationObjectionRepliesUpdateRequest"
}
},
{
"type": "integer",
"description": "RequestForInformationObjectionReplies 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 RequestForInformationObjectionReplies",
"tags": [
"RequestForInformationObjectionReplies"
],
"summary": "delete RequestForInformationObjectionReplies",
"parameters": [
{
"type": "integer",
"description": "RequestForInformationObjectionReplies 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-objection/{id}": { "/request-for-information-objection/{id}": {
"get": { "get": {
"security": [ "security": [
@ -7741,11 +8052,31 @@ const docTemplate = `{
"name": "fullname", "name": "fullname",
"in": "query" "in": "query"
}, },
{
"type": "string",
"name": "genderType",
"in": "query"
},
{
"type": "string",
"name": "identityGroup",
"in": "query"
},
{
"type": "string",
"name": "identityGroupNumber",
"in": "query"
},
{ {
"type": "string", "type": "string",
"name": "identityNumber", "name": "identityNumber",
"in": "query" "in": "query"
}, },
{
"type": "string",
"name": "identityType",
"in": "query"
},
{ {
"type": "string", "type": "string",
"name": "phoneNumber", "name": "phoneNumber",
@ -7766,6 +8097,11 @@ const docTemplate = `{
"name": "username", "name": "username",
"in": "query" "in": "query"
}, },
{
"type": "string",
"name": "workType",
"in": "query"
},
{ {
"type": "integer", "type": "integer",
"name": "count", "name": "count",
@ -8767,6 +9103,55 @@ const docTemplate = `{
} }
} }
}, },
"request.RequestForInformationObjectionRepliesCreateRequest": {
"type": "object",
"required": [
"createdById",
"requestForInformationObjectionId",
"response",
"statusId"
],
"properties": {
"createdById": {
"type": "integer"
},
"requestForInformationObjectionId": {
"type": "integer"
},
"response": {
"type": "string"
},
"statusId": {
"type": "integer"
}
}
},
"request.RequestForInformationObjectionRepliesUpdateRequest": {
"type": "object",
"required": [
"id",
"requestForInformationObjectionId",
"response",
"statusId"
],
"properties": {
"id": {
"type": "integer"
},
"requestForInformationObjectionId": {
"type": "integer"
},
"response": {
"type": "string"
},
"statusId": {
"type": "integer"
},
"updated_at": {
"type": "string"
}
}
},
"request.RequestForInformationObjectionUpdateRequest": { "request.RequestForInformationObjectionUpdateRequest": {
"type": "object", "type": "object",
"required": [ "required": [
@ -9128,6 +9513,8 @@ const docTemplate = `{
"email", "email",
"fullname", "fullname",
"genderType", "genderType",
"identityGroup",
"identityGroupNumber",
"identityNumber", "identityNumber",
"identityType", "identityType",
"lastEducation", "lastEducation",
@ -9154,6 +9541,12 @@ const docTemplate = `{
"genderType": { "genderType": {
"type": "string" "type": "string"
}, },
"identityGroup": {
"type": "string"
},
"identityGroupNumber": {
"type": "string"
},
"identityNumber": { "identityNumber": {
"type": "string" "type": "string"
}, },
@ -9191,6 +9584,8 @@ const docTemplate = `{
"email", "email",
"fullname", "fullname",
"genderType", "genderType",
"identityGroup",
"identityGroupNumber",
"identityNumber", "identityNumber",
"identityType", "identityType",
"lastEducation", "lastEducation",
@ -9216,6 +9611,12 @@ const docTemplate = `{
"genderType": { "genderType": {
"type": "string" "type": "string"
}, },
"identityGroup": {
"type": "string"
},
"identityGroupNumber": {
"type": "string"
},
"identityNumber": { "identityNumber": {
"type": "string" "type": "string"
}, },

View File

@ -5757,6 +5757,317 @@
} }
} }
}, },
"/request-for-information-objection-replies": {
"get": {
"security": [
{
"Bearer": []
}
],
"description": "API for getting all RequestForInformationObjectionReplies",
"tags": [
"RequestForInformationObjectionReplies"
],
"summary": "Get all RequestForInformationObjectionReplies",
"parameters": [
{
"type": "integer",
"name": "createdById",
"in": "query"
},
{
"type": "integer",
"name": "requestForInformationObjectionId",
"in": "query"
},
{
"type": "string",
"name": "response",
"in": "query"
},
{
"type": "integer",
"name": "statusId",
"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 RequestForInformationObjectionReplies",
"tags": [
"RequestForInformationObjectionReplies"
],
"summary": "Create RequestForInformationObjectionReplies",
"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.RequestForInformationObjectionRepliesCreateRequest"
}
}
],
"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-replies/{id}": {
"get": {
"security": [
{
"Bearer": []
}
],
"description": "API for getting one RequestForInformationObjectionReplies",
"tags": [
"RequestForInformationObjectionReplies"
],
"summary": "Get one RequestForInformationObjectionReplies",
"parameters": [
{
"type": "integer",
"description": "RequestForInformationObjectionReplies 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 RequestForInformationObjectionReplies",
"tags": [
"RequestForInformationObjectionReplies"
],
"summary": "update RequestForInformationObjectionReplies",
"parameters": [
{
"description": "Required payload",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.RequestForInformationObjectionRepliesUpdateRequest"
}
},
{
"type": "integer",
"description": "RequestForInformationObjectionReplies 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 RequestForInformationObjectionReplies",
"tags": [
"RequestForInformationObjectionReplies"
],
"summary": "delete RequestForInformationObjectionReplies",
"parameters": [
{
"type": "integer",
"description": "RequestForInformationObjectionReplies 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-objection/{id}": { "/request-for-information-objection/{id}": {
"get": { "get": {
"security": [ "security": [
@ -7730,11 +8041,31 @@
"name": "fullname", "name": "fullname",
"in": "query" "in": "query"
}, },
{
"type": "string",
"name": "genderType",
"in": "query"
},
{
"type": "string",
"name": "identityGroup",
"in": "query"
},
{
"type": "string",
"name": "identityGroupNumber",
"in": "query"
},
{ {
"type": "string", "type": "string",
"name": "identityNumber", "name": "identityNumber",
"in": "query" "in": "query"
}, },
{
"type": "string",
"name": "identityType",
"in": "query"
},
{ {
"type": "string", "type": "string",
"name": "phoneNumber", "name": "phoneNumber",
@ -7755,6 +8086,11 @@
"name": "username", "name": "username",
"in": "query" "in": "query"
}, },
{
"type": "string",
"name": "workType",
"in": "query"
},
{ {
"type": "integer", "type": "integer",
"name": "count", "name": "count",
@ -8756,6 +9092,55 @@
} }
} }
}, },
"request.RequestForInformationObjectionRepliesCreateRequest": {
"type": "object",
"required": [
"createdById",
"requestForInformationObjectionId",
"response",
"statusId"
],
"properties": {
"createdById": {
"type": "integer"
},
"requestForInformationObjectionId": {
"type": "integer"
},
"response": {
"type": "string"
},
"statusId": {
"type": "integer"
}
}
},
"request.RequestForInformationObjectionRepliesUpdateRequest": {
"type": "object",
"required": [
"id",
"requestForInformationObjectionId",
"response",
"statusId"
],
"properties": {
"id": {
"type": "integer"
},
"requestForInformationObjectionId": {
"type": "integer"
},
"response": {
"type": "string"
},
"statusId": {
"type": "integer"
},
"updated_at": {
"type": "string"
}
}
},
"request.RequestForInformationObjectionUpdateRequest": { "request.RequestForInformationObjectionUpdateRequest": {
"type": "object", "type": "object",
"required": [ "required": [
@ -9117,6 +9502,8 @@
"email", "email",
"fullname", "fullname",
"genderType", "genderType",
"identityGroup",
"identityGroupNumber",
"identityNumber", "identityNumber",
"identityType", "identityType",
"lastEducation", "lastEducation",
@ -9143,6 +9530,12 @@
"genderType": { "genderType": {
"type": "string" "type": "string"
}, },
"identityGroup": {
"type": "string"
},
"identityGroupNumber": {
"type": "string"
},
"identityNumber": { "identityNumber": {
"type": "string" "type": "string"
}, },
@ -9180,6 +9573,8 @@
"email", "email",
"fullname", "fullname",
"genderType", "genderType",
"identityGroup",
"identityGroupNumber",
"identityNumber", "identityNumber",
"identityType", "identityType",
"lastEducation", "lastEducation",
@ -9205,6 +9600,12 @@
"genderType": { "genderType": {
"type": "string" "type": "string"
}, },
"identityGroup": {
"type": "string"
},
"identityGroupNumber": {
"type": "string"
},
"identityNumber": { "identityNumber": {
"type": "string" "type": "string"
}, },

View File

@ -423,6 +423,40 @@ definitions:
- secondaryReason - secondaryReason
- statusId - statusId
type: object type: object
request.RequestForInformationObjectionRepliesCreateRequest:
properties:
createdById:
type: integer
requestForInformationObjectionId:
type: integer
response:
type: string
statusId:
type: integer
required:
- createdById
- requestForInformationObjectionId
- response
- statusId
type: object
request.RequestForInformationObjectionRepliesUpdateRequest:
properties:
id:
type: integer
requestForInformationObjectionId:
type: integer
response:
type: string
statusId:
type: integer
updated_at:
type: string
required:
- id
- requestForInformationObjectionId
- response
- statusId
type: object
request.RequestForInformationObjectionUpdateRequest: request.RequestForInformationObjectionUpdateRequest:
properties: properties:
documentName: documentName:
@ -684,6 +718,10 @@ definitions:
type: string type: string
genderType: genderType:
type: string type: string
identityGroup:
type: string
identityGroupNumber:
type: string
identityNumber: identityNumber:
type: string type: string
identityType: identityType:
@ -708,6 +746,8 @@ definitions:
- email - email
- fullname - fullname
- genderType - genderType
- identityGroup
- identityGroupNumber
- identityNumber - identityNumber
- identityType - identityType
- lastEducation - lastEducation
@ -730,6 +770,10 @@ definitions:
type: string type: string
genderType: genderType:
type: string type: string
identityGroup:
type: string
identityGroupNumber:
type: string
identityNumber: identityNumber:
type: string type: string
identityType: identityType:
@ -754,6 +798,8 @@ definitions:
- email - email
- fullname - fullname
- genderType - genderType
- identityGroup
- identityGroupNumber
- identityNumber - identityNumber
- identityType - identityType
- lastEducation - lastEducation
@ -4453,6 +4499,202 @@ paths:
summary: Create RequestForInformationObjection summary: Create RequestForInformationObjection
tags: tags:
- RequestForInformationObjection - RequestForInformationObjection
/request-for-information-objection-replies:
get:
description: API for getting all RequestForInformationObjectionReplies
parameters:
- in: query
name: createdById
type: integer
- in: query
name: requestForInformationObjectionId
type: integer
- in: query
name: response
type: string
- in: query
name: statusId
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 RequestForInformationObjectionReplies
tags:
- RequestForInformationObjectionReplies
post:
description: API for create RequestForInformationObjectionReplies
parameters:
- default: Bearer <Add access token here>
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.RequestForInformationObjectionRepliesCreateRequest'
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 RequestForInformationObjectionReplies
tags:
- RequestForInformationObjectionReplies
/request-for-information-objection-replies/{id}:
delete:
description: API for delete RequestForInformationObjectionReplies
parameters:
- description: RequestForInformationObjectionReplies 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 RequestForInformationObjectionReplies
tags:
- RequestForInformationObjectionReplies
get:
description: API for getting one RequestForInformationObjectionReplies
parameters:
- description: RequestForInformationObjectionReplies 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 RequestForInformationObjectionReplies
tags:
- RequestForInformationObjectionReplies
put:
description: API for update RequestForInformationObjectionReplies
parameters:
- description: Required payload
in: body
name: payload
required: true
schema:
$ref: '#/definitions/request.RequestForInformationObjectionRepliesUpdateRequest'
- description: RequestForInformationObjectionReplies 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 RequestForInformationObjectionReplies
tags:
- RequestForInformationObjectionReplies
/request-for-information-objection/{id}: /request-for-information-objection/{id}:
delete: delete:
description: API for delete RequestForInformationObjection description: API for delete RequestForInformationObjection
@ -5698,9 +5940,21 @@ paths:
- in: query - in: query
name: fullname name: fullname
type: string type: string
- in: query
name: genderType
type: string
- in: query
name: identityGroup
type: string
- in: query
name: identityGroupNumber
type: string
- in: query - in: query
name: identityNumber name: identityNumber
type: string type: string
- in: query
name: identityType
type: string
- in: query - in: query
name: phoneNumber name: phoneNumber
type: string type: string
@ -5713,6 +5967,9 @@ paths:
- in: query - in: query
name: username name: username
type: string type: string
- in: query
name: workType
type: string
- in: query - in: query
name: count name: count
type: integer type: integer

View File

@ -21,6 +21,7 @@ import (
"go-humas-be/app/module/provinces" "go-humas-be/app/module/provinces"
"go-humas-be/app/module/request_for_information_items" "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_objection"
"go-humas-be/app/module/request_for_information_objection_replies"
"go-humas-be/app/module/request_for_information_replies" "go-humas-be/app/module/request_for_information_replies"
"go-humas-be/app/module/request_for_informations" "go-humas-be/app/module/request_for_informations"
"go-humas-be/app/module/user_levels" "go-humas-be/app/module/user_levels"
@ -81,6 +82,7 @@ func main() {
request_for_information_items.NewRequestForInformationItemsModule, request_for_information_items.NewRequestForInformationItemsModule,
request_for_information_replies.NewRequestForInformationRepliesModule, request_for_information_replies.NewRequestForInformationRepliesModule,
request_for_information_objection.NewRequestForInformationObjectionModule, request_for_information_objection.NewRequestForInformationObjectionModule,
request_for_information_objection_replies.NewRequestForInformationObjectionRepliesModule,
// start aplication // start aplication
fx.Invoke(webserver.Start), fx.Invoke(webserver.Start),