From fc25e7c5719618afe79b1b0f4947015cb62bda1d Mon Sep 17 00:00:00 2001 From: hanif salafi Date: Sun, 3 Nov 2024 01:20:19 +0700 Subject: [PATCH] feat: update refactoring ppid to humas --- .gitlab-ci.yml | 1 - .idea/.gitignore | 8 - .idea/.name | 1 - .idea/modules.xml | 2 +- .idea/vcs.xml | 2 +- .../ppid_data_approval_histories.entity.go | 15 - .../entity/ppid_data_categories.entity.go | 20 - app/database/entity/ppid_data_files.entity.go | 24 - app/database/entity/ppid_datas.entity.go | 30 - .../request_for_information_items.entity.go | 15 - ...equest_for_information_objection.entity.go | 16 - ...or_information_objection_replies.entity.go | 14 - .../request_for_information_replies.entity.go | 15 - .../entity/request_for_informations.entity.go | 16 - app/database/index.database.go | 9 - .../article_categories.controller.go | 2 +- .../controller/controller.go | 13 - ...ppid_data_approval_histories.controller.go | 169 - .../ppid_data_approval_histories.mapper.go | 32 - .../ppid_data_approval_histories.module.go | 53 - ...ppid_data_approval_histories.repository.go | 67 - .../ppid_data_approval_histories.request.go | 25 - .../ppid_data_approval_histories.response.go | 16 - .../ppid_data_approval_histories.service.go | 87 - .../controller/controller.go | 16 - .../ppid_data_categories.controller.go | 321 -- .../mapper/ppid_data_categories.mapper.go | 91 - .../ppid_data_categories.module.go | 57 - .../ppid_data_categories.repository.go | 185 - .../request/ppid_data_categories.request.go | 132 - .../response/ppid_data_categories.response.go | 40 - .../service/ppid_data_categories.service.go | 369 -- .../ppid_data_files/controller/controller.go | 16 - .../controller/ppid_data_files.controller.go | 241 -- .../mapper/ppid_data_files.mapper.go | 30 - .../ppid_data_files/ppid_data_files.module.go | 55 - .../repository/ppid_data_files.repository.go | 154 - .../request/ppid_data_files.request.go | 152 - .../response/ppid_data_files.response.go | 22 - .../service/ppid_data_files.service.go | 327 -- .../ppid_datas/controller/controller.go | 13 - .../controller/ppid_datas.controller.go | 262 -- .../ppid_datas/mapper/ppid_datas.mapper.go | 83 - app/module/ppid_datas/ppid_datas.module.go | 55 - .../repository/ppid_datas.repository.go | 165 - .../ppid_datas/request/ppid_datas.request.go | 179 - .../response/ppid_datas.response.go | 27 - .../ppid_datas/service/ppid_datas.service.go | 234 - .../controller/controller.go | 16 - ...equest_for_information_items.controller.go | 194 - .../request_for_information_items.mapper.go | 23 - ...equest_for_information_items.repository.go | 103 - .../request_for_information_items.request.go | 97 - .../request_for_information_items.module.go | 53 - .../request_for_information_items.response.go | 15 - .../request_for_information_items.service.go | 85 - .../controller/controller.go | 16 - ...st_for_information_objection.controller.go | 198 - ...equest_for_information_objection.mapper.go | 24 - ...st_for_information_objection.repository.go | 106 - ...quest_for_information_objection.request.go | 106 - ...equest_for_information_objection.module.go | 53 - ...uest_for_information_objection.response.go | 16 - ...quest_for_information_objection.service.go | 90 - .../controller/controller.go | 16 - ...nformation_objection_replies.controller.go | 193 - ...or_information_objection_replies.mapper.go | 22 - ...nformation_objection_replies.repository.go | 98 - ...r_information_objection_replies.request.go | 89 - ...or_information_objection_replies.module.go | 53 - ..._information_objection_replies.response.go | 14 - ...r_information_objection_replies.service.go | 90 - .../controller/controller.go | 16 - ...uest_for_information_replies.controller.go | 195 - .../request_for_information_replies.mapper.go | 23 - ...uest_for_information_replies.repository.go | 99 - ...request_for_information_replies.request.go | 96 - .../request_for_information_replies.module.go | 53 - ...equest_for_information_replies.response.go | 15 - ...request_for_information_replies.service.go | 90 - .../controller/controller.go | 16 - .../request_for_informations.controller.go | 197 - .../mapper/request_for_informations.mapper.go | 24 - .../request_for_informations.repository.go | 112 - .../request_for_informations.request.go | 102 - .../request_for_informations.module.go | 53 - .../request_for_informations.response.go | 16 - .../request_for_informations.service.go | 89 - app/router/api.go | 104 +- config/toml/config.toml | 2 +- docs/swagger/docs.go | 3793 ----------------- docs/swagger/swagger.json | 3793 ----------------- docs/swagger/swagger.yaml | 2422 ----------- main.go | 18 - 94 files changed, 36 insertions(+), 16940 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/.name delete mode 100644 app/database/entity/ppid_data_approval_histories.entity.go delete mode 100644 app/database/entity/ppid_data_categories.entity.go delete mode 100644 app/database/entity/ppid_data_files.entity.go delete mode 100644 app/database/entity/ppid_datas.entity.go delete mode 100644 app/database/entity/request_for_information_items.entity.go delete mode 100644 app/database/entity/request_for_information_objection.entity.go delete mode 100644 app/database/entity/request_for_information_objection_replies.entity.go delete mode 100644 app/database/entity/request_for_information_replies.entity.go delete mode 100644 app/database/entity/request_for_informations.entity.go delete mode 100644 app/module/ppid_data_approval_histories/controller/controller.go delete mode 100644 app/module/ppid_data_approval_histories/controller/ppid_data_approval_histories.controller.go delete mode 100644 app/module/ppid_data_approval_histories/mapper/ppid_data_approval_histories.mapper.go delete mode 100644 app/module/ppid_data_approval_histories/ppid_data_approval_histories.module.go delete mode 100644 app/module/ppid_data_approval_histories/repository/ppid_data_approval_histories.repository.go delete mode 100644 app/module/ppid_data_approval_histories/request/ppid_data_approval_histories.request.go delete mode 100644 app/module/ppid_data_approval_histories/response/ppid_data_approval_histories.response.go delete mode 100644 app/module/ppid_data_approval_histories/service/ppid_data_approval_histories.service.go delete mode 100644 app/module/ppid_data_categories/controller/controller.go delete mode 100644 app/module/ppid_data_categories/controller/ppid_data_categories.controller.go delete mode 100644 app/module/ppid_data_categories/mapper/ppid_data_categories.mapper.go delete mode 100644 app/module/ppid_data_categories/ppid_data_categories.module.go delete mode 100644 app/module/ppid_data_categories/repository/ppid_data_categories.repository.go delete mode 100644 app/module/ppid_data_categories/request/ppid_data_categories.request.go delete mode 100644 app/module/ppid_data_categories/response/ppid_data_categories.response.go delete mode 100644 app/module/ppid_data_categories/service/ppid_data_categories.service.go delete mode 100644 app/module/ppid_data_files/controller/controller.go delete mode 100644 app/module/ppid_data_files/controller/ppid_data_files.controller.go delete mode 100644 app/module/ppid_data_files/mapper/ppid_data_files.mapper.go delete mode 100644 app/module/ppid_data_files/ppid_data_files.module.go delete mode 100644 app/module/ppid_data_files/repository/ppid_data_files.repository.go delete mode 100644 app/module/ppid_data_files/request/ppid_data_files.request.go delete mode 100644 app/module/ppid_data_files/response/ppid_data_files.response.go delete mode 100644 app/module/ppid_data_files/service/ppid_data_files.service.go delete mode 100644 app/module/ppid_datas/controller/controller.go delete mode 100644 app/module/ppid_datas/controller/ppid_datas.controller.go delete mode 100644 app/module/ppid_datas/mapper/ppid_datas.mapper.go delete mode 100644 app/module/ppid_datas/ppid_datas.module.go delete mode 100644 app/module/ppid_datas/repository/ppid_datas.repository.go delete mode 100644 app/module/ppid_datas/request/ppid_datas.request.go delete mode 100644 app/module/ppid_datas/response/ppid_datas.response.go delete mode 100644 app/module/ppid_datas/service/ppid_datas.service.go delete mode 100644 app/module/request_for_information_items/controller/controller.go delete mode 100644 app/module/request_for_information_items/controller/request_for_information_items.controller.go delete mode 100644 app/module/request_for_information_items/mapper/request_for_information_items.mapper.go delete mode 100644 app/module/request_for_information_items/repository/request_for_information_items.repository.go delete mode 100644 app/module/request_for_information_items/request/request_for_information_items.request.go delete mode 100644 app/module/request_for_information_items/request_for_information_items.module.go delete mode 100644 app/module/request_for_information_items/response/request_for_information_items.response.go delete mode 100644 app/module/request_for_information_items/service/request_for_information_items.service.go delete mode 100644 app/module/request_for_information_objection/controller/controller.go delete mode 100644 app/module/request_for_information_objection/controller/request_for_information_objection.controller.go delete mode 100644 app/module/request_for_information_objection/mapper/request_for_information_objection.mapper.go delete mode 100644 app/module/request_for_information_objection/repository/request_for_information_objection.repository.go delete mode 100644 app/module/request_for_information_objection/request/request_for_information_objection.request.go delete mode 100644 app/module/request_for_information_objection/request_for_information_objection.module.go delete mode 100644 app/module/request_for_information_objection/response/request_for_information_objection.response.go delete mode 100644 app/module/request_for_information_objection/service/request_for_information_objection.service.go delete mode 100644 app/module/request_for_information_objection_replies/controller/controller.go delete mode 100644 app/module/request_for_information_objection_replies/controller/request_for_information_objection_replies.controller.go delete mode 100644 app/module/request_for_information_objection_replies/mapper/request_for_information_objection_replies.mapper.go delete mode 100644 app/module/request_for_information_objection_replies/repository/request_for_information_objection_replies.repository.go delete mode 100644 app/module/request_for_information_objection_replies/request/request_for_information_objection_replies.request.go delete mode 100644 app/module/request_for_information_objection_replies/request_for_information_objection_replies.module.go delete mode 100644 app/module/request_for_information_objection_replies/response/request_for_information_objection_replies.response.go delete mode 100644 app/module/request_for_information_objection_replies/service/request_for_information_objection_replies.service.go delete mode 100644 app/module/request_for_information_replies/controller/controller.go delete mode 100644 app/module/request_for_information_replies/controller/request_for_information_replies.controller.go delete mode 100644 app/module/request_for_information_replies/mapper/request_for_information_replies.mapper.go delete mode 100644 app/module/request_for_information_replies/repository/request_for_information_replies.repository.go delete mode 100644 app/module/request_for_information_replies/request/request_for_information_replies.request.go delete mode 100644 app/module/request_for_information_replies/request_for_information_replies.module.go delete mode 100644 app/module/request_for_information_replies/response/request_for_information_replies.response.go delete mode 100644 app/module/request_for_information_replies/service/request_for_information_replies.service.go delete mode 100644 app/module/request_for_informations/controller/controller.go delete mode 100644 app/module/request_for_informations/controller/request_for_informations.controller.go delete mode 100644 app/module/request_for_informations/mapper/request_for_informations.mapper.go delete mode 100644 app/module/request_for_informations/repository/request_for_informations.repository.go delete mode 100644 app/module/request_for_informations/request/request_for_informations.request.go delete mode 100644 app/module/request_for_informations/request_for_informations.module.go delete mode 100644 app/module/request_for_informations/response/request_for_informations.response.go delete mode 100644 app/module/request_for_informations/service/request_for_informations.service.go diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e5f8781..04a5774 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,7 +19,6 @@ build-2: command: [ "--insecure-registry=103.82.242.92:8900" ] script: - docker login -u $DEPLOY_USERNAME -p $DEPLOY_TOKEN 103.82.242.92:8900 -# - docker build -t registry.gitlab.com/hanifsalafi/web-humas-be:dev . - docker-compose build - docker tag registry.gitlab.com/hanifsalafi/web-humas-be:dev 103.82.242.92:8900/humas/web-humas-be:dev - docker push 103.82.242.92:8900/humas/web-humas-be:dev diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b8..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index 438afd1..0000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -go-humas-be \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index 20f9e85..ebf4611 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 94a25f7..35eb1dd 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/app/database/entity/ppid_data_approval_histories.entity.go b/app/database/entity/ppid_data_approval_histories.entity.go deleted file mode 100644 index 93751b2..0000000 --- a/app/database/entity/ppid_data_approval_histories.entity.go +++ /dev/null @@ -1,15 +0,0 @@ -package entity - -import "time" - -type PpidDataApprovalHistories struct { - ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"` - Message string `json:"message" gorm:"type:varchar"` - ApprovalStatusId int `json:"approval_status_id" gorm:"type:int4"` - PpidDataId uint `json:"ppid_data_id" gorm:"type:int4"` - ApprovalBy uint `json:"approval_by" gorm:"type:int4"` - ApprovalAtLevel int `json:"approval_at_level" gorm:"type:int4"` - 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()"` -} diff --git a/app/database/entity/ppid_data_categories.entity.go b/app/database/entity/ppid_data_categories.entity.go deleted file mode 100644 index 9a3e0df..0000000 --- a/app/database/entity/ppid_data_categories.entity.go +++ /dev/null @@ -1,20 +0,0 @@ -package entity - -import "time" - -type PpidDataCategories struct { - ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"` - Title string `json:"title" gorm:"type:varchar"` - Description string `json:"description" gorm:"type:varchar"` - Slug string `json:"slug" gorm:"type:varchar"` - ParentId *uint `json:"parent_id" gorm:"type:int4"` - CreatedById *uint `json:"created_by_id" gorm:"type:int4"` - LevelGroupId *uint `json:"level_group_id" gorm:"type:int4"` - GroupBy *string `json:"group_by" gorm:"type:int4"` - Position *int `json:"position" gorm:"type:int4"` - ThumbnailPath *string `json:"thumbnail_path" gorm:"type:varchar"` - ThumbnailUrl *string `json:"thumbnail_url" gorm:"type:varchar"` - 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()"` -} diff --git a/app/database/entity/ppid_data_files.entity.go b/app/database/entity/ppid_data_files.entity.go deleted file mode 100644 index 067c367..0000000 --- a/app/database/entity/ppid_data_files.entity.go +++ /dev/null @@ -1,24 +0,0 @@ -package entity - -import "time" - -type PpidDataFiles struct { - ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"` - PpidDataId int `json:"ppid_data_id" gorm:"type:int4"` - Title *string `json:"title" gorm:"type:varchar"` - Type *string `json:"type" gorm:"type:varchar"` - FileType *string `json:"file_type" gorm:"type:varchar"` - FileName *string `json:"file_name" gorm:"type:varchar"` - FilePath *string `json:"file_path" gorm:"type:varchar"` - FileUrl *string `json:"file_url" gorm:"type:varchar"` - Size *string `json:"size" gorm:"type:varchar"` - Position *int `json:"position" gorm:"type:int4"` - DownloadCount *int `json:"download_count" gorm:"type:int4;default:0"` - CreatedById *int `json:"created_by_id" gorm:"type:int4"` - StatusId *int `json:"status_id" gorm:"type:int4"` - IsPublish *bool `json:"is_publish" gorm:"type:bool;default:false"` - PublishedAt *time.Time `json:"published_at" gorm:"type:timestamp"` - 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()"` -} diff --git a/app/database/entity/ppid_datas.entity.go b/app/database/entity/ppid_datas.entity.go deleted file mode 100644 index bcf8019..0000000 --- a/app/database/entity/ppid_datas.entity.go +++ /dev/null @@ -1,30 +0,0 @@ -package entity - -import "time" - -type PpidDatas struct { - ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"` - Title string `json:"title" gorm:"type:varchar"` - Description string `json:"description" gorm:"type:varchar"` - Slug string `json:"slug" gorm:"type:varchar"` - CategoryId uint `json:"category_id" gorm:"index"` - Category PpidDataCategories `json:"category" gorm:"foreignKey:CategoryId;references:ID"` - CreatedById *uint `json:"created_by_id" gorm:"index"` - CreatedBy Users `json:"created_by" gorm:"foreignKey:CreatedById;references:ID"` - LevelGroupId *uint `json:"level_group_id" gorm:"index"` - LevelGroup UserLevels `json:"level_group" gorm:"foreignKey:LevelGroupId;references:ID"` - Group *string `json:"group" gorm:"type:varchar"` - Position *int `json:"position" gorm:"type:int4"` - NeedApprovalFromUserRole *string `json:"need_approval_from_user_role" gorm:"type:varchar"` - NeedApprovalFromUserLevel *string `json:"need_approval_from_user_level" gorm:"type:varchar"` - BackApprovalToUserRole *string `json:"back_approval_to_user_role" gorm:"type:varchar"` - BackApprovalToUserLevel *string `json:"back_approval_to_user_level" gorm:"type:varchar"` - IsPublish *bool `json:"is_publish" gorm:"type:bool;default:false"` - PublishLevel *int `json:"publish_level" gorm:"type:int4"` - PublishedAt *time.Time `json:"published_at" gorm:"type:timestamp"` - ApprovalStatusId int `json:"approval_status_id" gorm:"type:int4"` - StatusId int `json:"status_id" gorm:"type:int4"` - 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()"` -} diff --git a/app/database/entity/request_for_information_items.entity.go b/app/database/entity/request_for_information_items.entity.go deleted file mode 100644 index 140a9b5..0000000 --- a/app/database/entity/request_for_information_items.entity.go +++ /dev/null @@ -1,15 +0,0 @@ -package entity - -import "time" - -type RequestForInformationItems struct { - ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"` - RequestForInformationId int `json:"request_for_information_id" gorm:"type:int4"` - RequestedInfo string `json:"requested_info" gorm:"type:varchar"` - DetailedInfo string `json:"detailed_info" gorm:"type:varchar"` - Reason string `json:"reason" gorm:"type:varchar"` - 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/entity/request_for_information_objection.entity.go b/app/database/entity/request_for_information_objection.entity.go deleted file mode 100644 index ff3c989..0000000 --- a/app/database/entity/request_for_information_objection.entity.go +++ /dev/null @@ -1,16 +0,0 @@ -package entity - -import "time" - -type RequestForInformationObjection struct { - ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"` - RequestForInformationItemId uint `json:"request_for_information_item_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/entity/request_for_information_objection_replies.entity.go b/app/database/entity/request_for_information_objection_replies.entity.go deleted file mode 100644 index 911b849..0000000 --- a/app/database/entity/request_for_information_objection_replies.entity.go +++ /dev/null @@ -1,14 +0,0 @@ -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()"` -} diff --git a/app/database/entity/request_for_information_replies.entity.go b/app/database/entity/request_for_information_replies.entity.go deleted file mode 100644 index 5a7851d..0000000 --- a/app/database/entity/request_for_information_replies.entity.go +++ /dev/null @@ -1,15 +0,0 @@ -package entity - -import "time" - -type RequestForInformationReplies struct { - ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"` - RequestForInformationItemId int `json:"request_for_information_item_id" gorm:"type:int4"` - FileUrl string `json:"file_url" gorm:"type:varchar"` - 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()"` -} diff --git a/app/database/entity/request_for_informations.entity.go b/app/database/entity/request_for_informations.entity.go deleted file mode 100644 index 69976e2..0000000 --- a/app/database/entity/request_for_informations.entity.go +++ /dev/null @@ -1,16 +0,0 @@ -package entity - -import "time" - -type RequestForInformations struct { - ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"` - TicketNumber string `json:"ticket_number" gorm:"type:varchar"` - HowToGetInfo string `json:"how_to_get_info" gorm:"type:varchar"` - HowToGetFiles string `json:"how_to_get_files" gorm:"type:varchar"` - NextAction string `json:"next_action" 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()"` -} diff --git a/app/database/index.database.go b/app/database/index.database.go index 34ea2f9..6cc1814 100644 --- a/app/database/index.database.go +++ b/app/database/index.database.go @@ -79,16 +79,7 @@ func Models() []interface{} { entity.MasterModules{}, entity.MasterStatuses{}, entity.MasterApprovalStatuses{}, - entity.PpidDatas{}, - entity.PpidDataFiles{}, - entity.PpidDataApprovalHistories{}, - entity.PpidDataCategories{}, entity.Provinces{}, - entity.RequestForInformations{}, - entity.RequestForInformationItems{}, - entity.RequestForInformationReplies{}, - entity.RequestForInformationObjection{}, - entity.RequestForInformationObjectionReplies{}, entity.UserLevels{}, entity.UserRoles{}, entity.UserRoleAccesses{}, diff --git a/app/module/article_categories/controller/article_categories.controller.go b/app/module/article_categories/controller/article_categories.controller.go index dac1ca5..ac9e255 100644 --- a/app/module/article_categories/controller/article_categories.controller.go +++ b/app/module/article_categories/controller/article_categories.controller.go @@ -132,7 +132,7 @@ func (_i *articleCategoriesController) Save(c *fiber.Ctx) error { }) } -// SaveThumbnail PpidDataCategories +// SaveThumbnail ArticleCategories // @Summary Upload ArticleCategories Thumbnail // @Description API for Upload ArticleCategories Thumbnail // @Tags Article Categories diff --git a/app/module/ppid_data_approval_histories/controller/controller.go b/app/module/ppid_data_approval_histories/controller/controller.go deleted file mode 100644 index 5ddf185..0000000 --- a/app/module/ppid_data_approval_histories/controller/controller.go +++ /dev/null @@ -1,13 +0,0 @@ -package controller - -import "go-humas-be/app/module/ppid_data_approval_histories/service" - -type Controller struct { - PpidDataApprovalHistories PpidDataApprovalHistoriesController -} - -func NewController(PpidDataApprovalHistoriesService service.PpidDataApprovalHistoriesService) *Controller { - return &Controller{ - PpidDataApprovalHistories: NewPpidDataApprovalHistoriesController(PpidDataApprovalHistoriesService), - } -} diff --git a/app/module/ppid_data_approval_histories/controller/ppid_data_approval_histories.controller.go b/app/module/ppid_data_approval_histories/controller/ppid_data_approval_histories.controller.go deleted file mode 100644 index 1d2365e..0000000 --- a/app/module/ppid_data_approval_histories/controller/ppid_data_approval_histories.controller.go +++ /dev/null @@ -1,169 +0,0 @@ -package controller - -import ( - "github.com/gofiber/fiber/v2" - "go-humas-be/app/module/ppid_data_approval_histories/request" - "go-humas-be/app/module/ppid_data_approval_histories/service" - "strconv" - - utilRes "go-humas-be/utils/response" - utilVal "go-humas-be/utils/validator" -) - -type ppidDataApprovalHistoriesController struct { - ppidDataApprovalHistoriesService service.PpidDataApprovalHistoriesService -} - -type PpidDataApprovalHistoriesController interface { - All(c *fiber.Ctx) error - Show(c *fiber.Ctx) error - ShowByPpidData(c *fiber.Ctx) error - Save(c *fiber.Ctx) error - Delete(c *fiber.Ctx) error -} - -func NewPpidDataApprovalHistoriesController(ppidDataApprovalHistoriesService service.PpidDataApprovalHistoriesService) PpidDataApprovalHistoriesController { - return &ppidDataApprovalHistoriesController{ - ppidDataApprovalHistoriesService: ppidDataApprovalHistoriesService, - } -} - -// All PpidDataApprovalHistories -// @Summary Get all PpidDataApprovalHistories -// @Description API for getting all PpidDataApprovalHistories -// @Tags Task -// @Security Bearer -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /ppid-data-approval-histories [get] -func (_i *ppidDataApprovalHistoriesController) All(c *fiber.Ctx) error { - ppidDataApprovalHistoriesData, err := _i.ppidDataApprovalHistoriesService.All() - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"PpidDataApprovalHistories list successfully retrieved"}, - Data: ppidDataApprovalHistoriesData, - }) -} - -// Show PpidDataApprovalHistories -// @Summary Get one PpidDataApprovalHistories -// @Description API for getting one PpidDataApprovalHistories -// @Tags Task -// @Security Bearer -// @Param id path int true "PpidDataApprovalHistories ID" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /ppid-data-approval-histories/{id} [get] -func (_i *ppidDataApprovalHistoriesController) Show(c *fiber.Ctx) error { - id, err := strconv.ParseUint(c.Params("id"), 10, 0) - if err != nil { - return err - } - - ppidDataApprovalHistoriesData, err := _i.ppidDataApprovalHistoriesService.Show(uint(id)) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"PpidDataApprovalHistories successfully retrieved"}, - Data: ppidDataApprovalHistoriesData, - }) -} - -// ShowByPpidData PpidDataApprovalHistories -// @Summary Get one PpidDataApprovalHistories -// @Description API for getting one PpidDataApprovalHistories -// @Tags Task -// @Security Bearer -// @Param ppidDataId path int true "PpidData ID" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /ppid-data-approval-histories/ppid-data/:ppidDataId [get] -func (_i *ppidDataApprovalHistoriesController) ShowByPpidData(c *fiber.Ctx) error { - ppidDataId, err := strconv.Atoi(c.Params("ppidDataId")) - if err != nil { - return err - } - - ppidDataApprovalHistoriesData, err := _i.ppidDataApprovalHistoriesService.ShowByPpidData(uint(ppidDataId)) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"PpidDataApprovalHistories successfully retrieved"}, - Data: ppidDataApprovalHistoriesData, - }) -} - -// Save create PpidDataApprovalHistories -// @Summary Create PpidDataApprovalHistories -// @Description API for create PpidDataApprovalHistories -// @Tags Task -// @Security Bearer -// @Param Authorization header string true "Insert your access token" default(Bearer ) -// @Body request.PpidDataApprovalHistoriesCreateRequest -// @Success 200 {object} response.Response -// @Failure 401 {object} response.Response -// @Failure 404 {object} response.Response -// @Failure 422 {object} response.Response -// @Failure 500 {object} response.Response -// @Router /ppid-data-approval-histories [post] -func (_i *ppidDataApprovalHistoriesController) Save(c *fiber.Ctx) error { - req := new(request.PpidDataApprovalHistoriesCreateRequest) - if err := utilVal.ParseAndValidate(c, req); err != nil { - return err - } - - authToken := c.Get("Authorization") - - err := _i.ppidDataApprovalHistoriesService.Save(*req, authToken) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Messages: utilRes.Messages{"PpidDataApprovalHistories successfully created"}, - }) -} - -// Delete delete PpidDataApprovalHistories -// @Summary delete PpidDataApprovalHistories -// @Description API for delete PpidDataApprovalHistories -// @Tags Task -// @Security Bearer -// @Param id path int true "PpidDataApprovalHistories ID" -// @Success 200 {object} response.Response -// @Failure 401 {object} response.Response -// @Failure 404 {object} response.Response -// @Failure 422 {object} response.Response -// @Failure 500 {object} response.Response -// @Router /ppid-data-approval-histories/{id} [delete] -func (_i *ppidDataApprovalHistoriesController) Delete(c *fiber.Ctx) error { - id, err := strconv.ParseUint(c.Params("id"), 10, 0) - if err != nil { - return err - } - - err = _i.ppidDataApprovalHistoriesService.Delete(uint(id)) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Messages: utilRes.Messages{"PpidDataApprovalHistories successfully deleted"}, - }) -} diff --git a/app/module/ppid_data_approval_histories/mapper/ppid_data_approval_histories.mapper.go b/app/module/ppid_data_approval_histories/mapper/ppid_data_approval_histories.mapper.go deleted file mode 100644 index 07c02a0..0000000 --- a/app/module/ppid_data_approval_histories/mapper/ppid_data_approval_histories.mapper.go +++ /dev/null @@ -1,32 +0,0 @@ -package mapper - -import ( - "go-humas-be/app/database/entity" - res "go-humas-be/app/module/ppid_data_approval_histories/response" - - usersRepository "go-humas-be/app/module/users/repository" -) - -func PpidDataApprovalHistoriesResponseMapper(ppidDataApprovalHistoriesReq *entity.PpidDataApprovalHistories, usersRepo usersRepository.UsersRepository) (ppidDataApprovalHistoriesRes *res.PpidDataApprovalHistoriesResponse) { - if ppidDataApprovalHistoriesReq != nil { - findUser, _ := usersRepo.FindOne(ppidDataApprovalHistoriesReq.ApprovalBy) - createdByName := "" - if findUser != nil { - createdByName = findUser.Fullname - } - - ppidDataApprovalHistoriesRes = &res.PpidDataApprovalHistoriesResponse{ - ID: ppidDataApprovalHistoriesReq.ID, - Message: ppidDataApprovalHistoriesReq.Message, - ApprovalStatusId: ppidDataApprovalHistoriesReq.ApprovalStatusId, - PpidDataId: ppidDataApprovalHistoriesReq.PpidDataId, - ApprovalById: ppidDataApprovalHistoriesReq.ApprovalBy, - ApprovalByName: createdByName, - ApprovalAtLevel: ppidDataApprovalHistoriesReq.ApprovalAtLevel, - IsActive: ppidDataApprovalHistoriesReq.IsActive, - CreatedAt: ppidDataApprovalHistoriesReq.CreatedAt, - UpdatedAt: ppidDataApprovalHistoriesReq.UpdatedAt, - } - } - return ppidDataApprovalHistoriesRes -} diff --git a/app/module/ppid_data_approval_histories/ppid_data_approval_histories.module.go b/app/module/ppid_data_approval_histories/ppid_data_approval_histories.module.go deleted file mode 100644 index ce3e916..0000000 --- a/app/module/ppid_data_approval_histories/ppid_data_approval_histories.module.go +++ /dev/null @@ -1,53 +0,0 @@ -package ppid_data_approval_histories - -import ( - "github.com/gofiber/fiber/v2" - "go-humas-be/app/module/ppid_data_approval_histories/controller" - "go-humas-be/app/module/ppid_data_approval_histories/repository" - "go-humas-be/app/module/ppid_data_approval_histories/service" - "go.uber.org/fx" -) - -// struct of PpidDataApprovalHistoriesRouter -type PpidDataApprovalHistoriesRouter struct { - App fiber.Router - Controller *controller.Controller -} - -// register bulky of PpidDataApprovalHistories module -var NewPpidDataApprovalHistoriesModule = fx.Options( - // register repository of PpidDataApprovalHistories module - fx.Provide(repository.NewPpidDataApprovalHistoriesRepository), - - // register service of PpidDataApprovalHistories module - fx.Provide(service.NewPpidDataApprovalHistoriesService), - - // register controller of PpidDataApprovalHistories module - fx.Provide(controller.NewController), - - // register router of PpidDataApprovalHistories module - fx.Provide(NewPpidDataApprovalHistoriesRouter), -) - -// init PpidDataApprovalHistoriesRouter -func NewPpidDataApprovalHistoriesRouter(fiber *fiber.App, controller *controller.Controller) *PpidDataApprovalHistoriesRouter { - return &PpidDataApprovalHistoriesRouter{ - App: fiber, - Controller: controller, - } -} - -// register routes of PpidDataApprovalHistories module -func (_i *PpidDataApprovalHistoriesRouter) RegisterPpidDataApprovalHistoriesRoutes() { - // define controllers - ppidDataApprovalHistoriesController := _i.Controller.PpidDataApprovalHistories - - // define routes - _i.App.Route("/ppid-data-approval-histories", func(router fiber.Router) { - router.Get("/", ppidDataApprovalHistoriesController.All) - router.Get("/:id", ppidDataApprovalHistoriesController.Show) - router.Get("/ppid-data/:ppidDataId", ppidDataApprovalHistoriesController.ShowByPpidData) - router.Post("/", ppidDataApprovalHistoriesController.Save) - router.Delete("/:id", ppidDataApprovalHistoriesController.Delete) - }) -} diff --git a/app/module/ppid_data_approval_histories/repository/ppid_data_approval_histories.repository.go b/app/module/ppid_data_approval_histories/repository/ppid_data_approval_histories.repository.go deleted file mode 100644 index 863d4da..0000000 --- a/app/module/ppid_data_approval_histories/repository/ppid_data_approval_histories.repository.go +++ /dev/null @@ -1,67 +0,0 @@ -package repository - -import ( - "go-humas-be/app/database" - "go-humas-be/app/database/entity" -) - -type ppidDataApprovalHistoriesRepository struct { - DB *database.Database -} - -// PpidDataApprovalHistoriesRepository define interface of IPpidDataApprovalHistoriesRepository -type PpidDataApprovalHistoriesRepository interface { - GetAll() (ppidDataApprovalHistories []*entity.PpidDataApprovalHistories, err error) - FindOne(id uint) (ppidDataApprovalHistories *entity.PpidDataApprovalHistories, err error) - FindByPpidData(ppidDataId uint) (ppidDataApprovalHistories []*entity.PpidDataApprovalHistories, err error) - Create(ppidDataApprovalHistories *entity.PpidDataApprovalHistories) (err error) - Update(id uint, ppidDataApprovalHistories *entity.PpidDataApprovalHistories) (err error) - Delete(id uint) (err error) -} - -func NewPpidDataApprovalHistoriesRepository(db *database.Database) PpidDataApprovalHistoriesRepository { - return &ppidDataApprovalHistoriesRepository{ - DB: db, - } -} - -// implement interface of IPpidDataApprovalHistoriesRepository -func (_i *ppidDataApprovalHistoriesRepository) GetAll() (ppidDataApprovalHistories []*entity.PpidDataApprovalHistories, err error) { - if err := _i.DB.DB.Find(&ppidDataApprovalHistories). - Where(&entity.PpidDataApprovalHistories{IsActive: true}).Error; err != nil { - return nil, err - } - - return ppidDataApprovalHistories, nil -} - -func (_i *ppidDataApprovalHistoriesRepository) FindOne(id uint) (ppidDataApprovalHistories *entity.PpidDataApprovalHistories, err error) { - if err := _i.DB.DB.First(&ppidDataApprovalHistories, id).Error; err != nil { - return nil, err - } - - return ppidDataApprovalHistories, nil -} - -func (_i *ppidDataApprovalHistoriesRepository) FindByPpidData(ppidDataId uint) (ppidDataApprovalHistories []*entity.PpidDataApprovalHistories, err error) { - if err := _i.DB.DB.Find(&ppidDataApprovalHistories). - Where(&entity.PpidDataApprovalHistories{PpidDataId: ppidDataId, IsActive: true}).Error; err != nil { - return nil, err - } - - return ppidDataApprovalHistories, nil -} - -func (_i *ppidDataApprovalHistoriesRepository) Create(ppidDataApprovalHistories *entity.PpidDataApprovalHistories) (err error) { - return _i.DB.DB.Create(ppidDataApprovalHistories).Error -} - -func (_i *ppidDataApprovalHistoriesRepository) Update(id uint, ppidDataApprovalHistories *entity.PpidDataApprovalHistories) (err error) { - return _i.DB.DB.Model(&entity.PpidDataApprovalHistories{}). - Where(&entity.PpidDataApprovalHistories{ID: id}). - Updates(ppidDataApprovalHistories).Error -} - -func (_i *ppidDataApprovalHistoriesRepository) Delete(id uint) error { - return _i.DB.DB.Delete(&entity.PpidDataApprovalHistories{}, id).Error -} diff --git a/app/module/ppid_data_approval_histories/request/ppid_data_approval_histories.request.go b/app/module/ppid_data_approval_histories/request/ppid_data_approval_histories.request.go deleted file mode 100644 index 73ee8f2..0000000 --- a/app/module/ppid_data_approval_histories/request/ppid_data_approval_histories.request.go +++ /dev/null @@ -1,25 +0,0 @@ -package request - -import ( - "go-humas-be/app/database/entity" -) - -type PpidDataApprovalHistoriesGeneric interface { - ToEntity() -} - -type PpidDataApprovalHistoriesCreateRequest struct { - PpidDataId uint `json:"ppidDataId" validate:"required"` - Message string `json:"message" validate:"required"` - ApprovalStatusId int `json:"approvalStatusId" validate:"required"` - ApprovalAtLevel *int `json:"approvalAtLevel"` -} - -func (req PpidDataApprovalHistoriesCreateRequest) ToEntity() *entity.PpidDataApprovalHistories { - return &entity.PpidDataApprovalHistories{ - PpidDataId: req.PpidDataId, - Message: req.Message, - ApprovalStatusId: req.ApprovalStatusId, - ApprovalAtLevel: *req.ApprovalAtLevel, - } -} diff --git a/app/module/ppid_data_approval_histories/response/ppid_data_approval_histories.response.go b/app/module/ppid_data_approval_histories/response/ppid_data_approval_histories.response.go deleted file mode 100644 index 8d444b4..0000000 --- a/app/module/ppid_data_approval_histories/response/ppid_data_approval_histories.response.go +++ /dev/null @@ -1,16 +0,0 @@ -package response - -import "time" - -type PpidDataApprovalHistoriesResponse struct { - ID uint `json:"id"` - Message string `json:"message"` - ApprovalStatusId int `json:"approval_status_id"` - PpidDataId uint `json:"ppid_data_id"` - ApprovalById uint `json:"approval_by_id"` - ApprovalByName string `json:"approval_by_name"` - ApprovalAtLevel int `json:"approval_at_level"` - IsActive bool `json:"is_active"` - CreatedAt time.Time `json:"created_at"` - UpdatedAt time.Time `json:"updated_at"` -} diff --git a/app/module/ppid_data_approval_histories/service/ppid_data_approval_histories.service.go b/app/module/ppid_data_approval_histories/service/ppid_data_approval_histories.service.go deleted file mode 100644 index 573a9df..0000000 --- a/app/module/ppid_data_approval_histories/service/ppid_data_approval_histories.service.go +++ /dev/null @@ -1,87 +0,0 @@ -package service - -import ( - "github.com/rs/zerolog" - "go-humas-be/app/module/ppid_data_approval_histories/mapper" - "go-humas-be/app/module/ppid_data_approval_histories/repository" - "go-humas-be/app/module/ppid_data_approval_histories/request" - "go-humas-be/app/module/ppid_data_approval_histories/response" - usersRepository "go-humas-be/app/module/users/repository" - utilSvc "go-humas-be/utils/service" -) - -// PpidDataApprovalHistoriesService -type ppidDataApprovalHistoriesService struct { - Repo repository.PpidDataApprovalHistoriesRepository - UsersRepo usersRepository.UsersRepository - Log zerolog.Logger -} - -// PpidDataApprovalHistoriesService define interface of IPpidDataApprovalHistoriesService -type PpidDataApprovalHistoriesService interface { - All() (ppidDataApprovalHistories []*response.PpidDataApprovalHistoriesResponse, err error) - Show(id uint) (ppidDataApprovalHistories *response.PpidDataApprovalHistoriesResponse, err error) - ShowByPpidData(ppidDataId uint) (ppidDataApprovalHistories []*response.PpidDataApprovalHistoriesResponse, err error) - Save(req request.PpidDataApprovalHistoriesCreateRequest, authToken string) (err error) - Delete(id uint) error -} - -// NewPpidDataApprovalHistoriesService init PpidDataApprovalHistoriesService -func NewPpidDataApprovalHistoriesService(repo repository.PpidDataApprovalHistoriesRepository, usersRepo usersRepository.UsersRepository, log zerolog.Logger) PpidDataApprovalHistoriesService { - - return &ppidDataApprovalHistoriesService{ - Repo: repo, - UsersRepo: usersRepo, - Log: log, - } -} - -// All implement interface of PpidDataApprovalHistoriesService -func (_i *ppidDataApprovalHistoriesService) All() (ppidDataApprovalHistories []*response.PpidDataApprovalHistoriesResponse, err error) { - results, err := _i.Repo.GetAll() - if err != nil { - return - } - - for _, result := range results { - ppidDataApprovalHistories = append(ppidDataApprovalHistories, mapper.PpidDataApprovalHistoriesResponseMapper(result, _i.UsersRepo)) - } - - return -} - -func (_i *ppidDataApprovalHistoriesService) Show(id uint) (ppidDataApprovalHistories *response.PpidDataApprovalHistoriesResponse, err error) { - result, err := _i.Repo.FindOne(id) - if err != nil { - return nil, err - } - - return mapper.PpidDataApprovalHistoriesResponseMapper(result, _i.UsersRepo), nil -} - -func (_i *ppidDataApprovalHistoriesService) ShowByPpidData(ppidDataId uint) (ppidDataApprovalHistories []*response.PpidDataApprovalHistoriesResponse, err error) { - results, err := _i.Repo.FindByPpidData(ppidDataId) - if err != nil { - return nil, err - } - - for _, result := range results { - ppidDataApprovalHistories = append(ppidDataApprovalHistories, mapper.PpidDataApprovalHistoriesResponseMapper(result, _i.UsersRepo)) - } - - return -} - -func (_i *ppidDataApprovalHistoriesService) Save(req request.PpidDataApprovalHistoriesCreateRequest, authToken string) (err error) { - _i.Log.Info().Interface("data", req).Msg("") - newReq := req.ToEntity() - - createdBy := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) - newReq.ApprovalBy = createdBy.ID - - return _i.Repo.Create(newReq) -} - -func (_i *ppidDataApprovalHistoriesService) Delete(id uint) error { - return _i.Repo.Delete(id) -} diff --git a/app/module/ppid_data_categories/controller/controller.go b/app/module/ppid_data_categories/controller/controller.go deleted file mode 100644 index 136e207..0000000 --- a/app/module/ppid_data_categories/controller/controller.go +++ /dev/null @@ -1,16 +0,0 @@ -package controller - -import ( - "github.com/rs/zerolog" - "go-humas-be/app/module/ppid_data_categories/service" -) - -type Controller struct { - PpidDataCategories PpidDataCategoriesController -} - -func NewController(PpidDataCategoriesService service.PpidDataCategoriesService, log zerolog.Logger) *Controller { - return &Controller{ - PpidDataCategories: NewPpidDataCategoriesController(PpidDataCategoriesService, log), - } -} diff --git a/app/module/ppid_data_categories/controller/ppid_data_categories.controller.go b/app/module/ppid_data_categories/controller/ppid_data_categories.controller.go deleted file mode 100644 index 5a0731b..0000000 --- a/app/module/ppid_data_categories/controller/ppid_data_categories.controller.go +++ /dev/null @@ -1,321 +0,0 @@ -package controller - -import ( - "github.com/gofiber/fiber/v2" - "github.com/rs/zerolog" - "go-humas-be/app/module/ppid_data_categories/request" - "go-humas-be/app/module/ppid_data_categories/response" - "go-humas-be/app/module/ppid_data_categories/service" - "go-humas-be/utils/paginator" - "strconv" - "time" - - utilRes "go-humas-be/utils/response" - utilVal "go-humas-be/utils/validator" -) - -type ppidDataCategoriesController struct { - ppidDataCategoriesService service.PpidDataCategoriesService - Log zerolog.Logger -} - -type PpidDataCategoriesController interface { - All(c *fiber.Ctx) error - Show(c *fiber.Ctx) error - ShowBySlug(c *fiber.Ctx) error - Save(c *fiber.Ctx) error - SaveThumbnail(c *fiber.Ctx) error - Update(c *fiber.Ctx) error - UpdatePosition(c *fiber.Ctx) error - Delete(c *fiber.Ctx) error - Viewer(c *fiber.Ctx) error -} - -func NewPpidDataCategoriesController(ppidDataCategoriesService service.PpidDataCategoriesService, log zerolog.Logger) PpidDataCategoriesController { - return &ppidDataCategoriesController{ - ppidDataCategoriesService: ppidDataCategoriesService, - Log: log, - } -} - -// All PpidDataCategories -// @Summary Get all PpidDataCategories -// @Description API for getting all PpidDataCategories -// @Tags PPID Categories -// @Security Bearer -// @Param Authorization header string false "Insert your access token" default (Bearer ) -// @Param req query request.PpidDataCategoriesQueryRequest 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 /ppid-data-categories [get] -func (_i *ppidDataCategoriesController) All(c *fiber.Ctx) error { - paginate, err := paginator.Paginate(c) - if err != nil { - return err - } - - reqContext := request.PpidDataCategoriesQueryRequestContext{ - Title: c.Query("title"), - Description: c.Query("description"), - ParentId: c.Query("parentId"), - IsOnlyTop: c.Query("isOnlyTop"), - Group: c.Query("group"), - LevelGroup: c.Query("levelGroup"), - IsPpidDataIncluded: c.Query("isPpidDataIncluded"), - } - req := reqContext.ToParamRequest() - - authToken := c.Get("Authorization") - - _i.Log.Info().Str("timestamp", time.Now(). - Format(time.RFC3339)).Str("Service:All", "ppidDataCategoriesController"). - Interface("authToken", authToken).Msg("") - - req.Pagination = paginate - var ppidDataCategoriesData []*response.PpidDataCategoriesResponse - var ppidDataCategoriesWithPpidDataResponse []*response.PpidDataCategoriesWithPpidDataResponse - var paging paginator.Pagination - - isPpidDataIncluded := req.IsPpidDataIncluded - if isPpidDataIncluded != nil && *isPpidDataIncluded == true { - ppidDataCategoriesWithPpidDataResponse, paging, err = _i.ppidDataCategoriesService.AllInPpidData(req, authToken) - } else { - ppidDataCategoriesData, paging, err = _i.ppidDataCategoriesService.All(req) - } - - if err != nil { - return err - } - - var dataResponse any - if ppidDataCategoriesData != nil { - dataResponse = ppidDataCategoriesData - } else { - dataResponse = ppidDataCategoriesWithPpidDataResponse - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"PpidDataCategories list successfully retrieved"}, - Data: dataResponse, - Meta: paging, - }) -} - -// Show PpidDataCategories -// @Summary Get one PpidDataCategories -// @Description API for getting one PpidDataCategories -// @Tags PPID Categories -// @Security Bearer -// @Param id path int true "PpidDataCategories ID" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /ppid-data-categories/{id} [get] -func (_i *ppidDataCategoriesController) Show(c *fiber.Ctx) error { - id, err := strconv.ParseUint(c.Params("id"), 10, 0) - if err != nil { - return err - } - - ppidDataCategoriesData, err := _i.ppidDataCategoriesService.Show(uint(id)) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"PpidDataCategories successfully retrieved"}, - Data: ppidDataCategoriesData, - }) -} - -// ShowBySlug PpidDataCategories -// @Summary Get one PpidDataCategories -// @Description API for getting one PpidDataCategories -// @Tags PPID Categories -// @Security Bearer -// @Param slug path string true "PpidDataCategories Slug" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /ppid-data-categories/slug/{slug} [get] -func (_i *ppidDataCategoriesController) ShowBySlug(c *fiber.Ctx) error { - slug := c.Params("slug") - - ppidDataCategoriesData, err := _i.ppidDataCategoriesService.ShowBySlug(slug) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"PpidDataCategories successfully retrieved"}, - Data: ppidDataCategoriesData, - }) -} - -// Save PpidDataCategories -// @Summary Create PpidDataCategories -// @Description API for create PpidDataCategories -// @Tags PPID Categories -// @Security Bearer -// @Param Authorization header string true "Insert your access token" default (Bearer ) -// @Param payload body request.PpidDataCategoriesCreateRequest true "Required payload" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /ppid-data-categories [post] -func (_i *ppidDataCategoriesController) Save(c *fiber.Ctx) error { - req := new(request.PpidDataCategoriesCreateRequest) - if err := utilVal.ParseAndValidate(c, req); err != nil { - return err - } - - authToken := c.Get("Authorization") - err := _i.ppidDataCategoriesService.Save(*req, authToken) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"PpidDataCategories successfully created"}, - }) -} - -// SaveThumbnail PpidDataCategories -// @Summary Upload PpidDataCategories Thumbnail -// @Description API for Upload PpidDataCategories Thumbnail -// @Tags PPID Categories -// @Security Bearer -// @Produce json -// @Param files formData file true "Upload thumbnail" -// @Param id path int true "Ppid Data Category ID" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /ppid-data-categories/thumbnail/{id} [post] -func (_i *ppidDataCategoriesController) SaveThumbnail(c *fiber.Ctx) error { - err := _i.ppidDataCategoriesService.SaveThumbnail(c) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"Thumbnail of PpidDataFiles successfully created"}, - }) -} - -// Update PpidDataCategories -// @Summary Update PpidDataCategories -// @Description API for update PpidDataCategories -// @Tags PPID Categories -// @Security Bearer -// @Param payload body request.PpidDataCategoriesUpdateRequest true "Required payload" -// @Param id path int true "PpidDataCategories ID" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /ppid-data-categories/{id} [put] -func (_i *ppidDataCategoriesController) Update(c *fiber.Ctx) error { - id, err := strconv.ParseUint(c.Params("id"), 10, 0) - if err != nil { - return err - } - - req := new(request.PpidDataCategoriesUpdateRequest) - if err := utilVal.ParseAndValidate(c, req); err != nil { - return err - } - - err = _i.ppidDataCategoriesService.Update(uint(id), *req) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"PpidDataCategories successfully updated"}, - }) -} - -// UpdatePosition PpidDataCategories -// @Summary UpdatePosition PpidDataCategories -// @Description API for Update Position PpidDataCategories -// @Tags PPID Categories -// @Security Bearer -// @Param payload body request.PpidDataCategoriesUpdatePositionPayload true "Required payload" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /ppid-data-categories/position [post] -func (_i *ppidDataCategoriesController) UpdatePosition(c *fiber.Ctx) error { - req := new(request.PpidDataCategoriesUpdatePositionPayload) - if err := utilVal.ParseAndValidate(c, req); err != nil { - return err - } - - err := _i.ppidDataCategoriesService.UpdatePosition(req.Positions) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"PpidDataCategories successfully updated"}, - }) -} - -// Delete PpidDataCategories -// @Summary Delete PpidDataCategories -// @Description API for delete PpidDataCategories -// @Tags PPID Categories -// @Security Bearer -// @Param id path int true "PpidDataCategories ID" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /ppid-data-categories/{id} [delete] -func (_i *ppidDataCategoriesController) Delete(c *fiber.Ctx) error { - id, err := strconv.ParseUint(c.Params("id"), 10, 0) - if err != nil { - return err - } - - err = _i.ppidDataCategoriesService.Delete(uint(id)) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"PpidDataCategories successfully deleted"}, - }) -} - -// Viewer PpidDataCategories -// @Summary Viewer PpidDataCategories -// @Description API for View Thumbnail of PpidDataCategories -// @Tags PPID Categories -// @Security Bearer -// @Param id path string true "PPID Categories ID" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /ppid-data-categories/thumbnail/viewer/{id} [get] -func (_i *ppidDataCategoriesController) Viewer(c *fiber.Ctx) error { - return _i.ppidDataCategoriesService.Viewer(c) -} diff --git a/app/module/ppid_data_categories/mapper/ppid_data_categories.mapper.go b/app/module/ppid_data_categories/mapper/ppid_data_categories.mapper.go deleted file mode 100644 index eabe4de..0000000 --- a/app/module/ppid_data_categories/mapper/ppid_data_categories.mapper.go +++ /dev/null @@ -1,91 +0,0 @@ -package mapper - -import ( - "github.com/rs/zerolog" - "go-humas-be/app/database/entity" - "go-humas-be/app/module/ppid_data_categories/repository" - res "go-humas-be/app/module/ppid_data_categories/response" - ppidDataFilesRepository "go-humas-be/app/module/ppid_data_files/repository" - "go-humas-be/app/module/ppid_datas/mapper" - ppidDatasRepository "go-humas-be/app/module/ppid_datas/repository" - "go-humas-be/app/module/ppid_datas/request" - "go-humas-be/app/module/ppid_datas/response" - usersRepository "go-humas-be/app/module/users/repository" - "go-humas-be/utils/paginator" -) - -func PpidDataCategoriesResponseMapper(ppidDataCategoriesReq *entity.PpidDataCategories, childPpidDataCategoriesReq []*entity.PpidDataCategories) (ppidDataCategoriesRes *res.PpidDataCategoriesResponse) { - if ppidDataCategoriesReq != nil { - var childPpidDataCategoriesRes []*res.PpidDataCategoriesResponse - if childPpidDataCategoriesReq != nil && len(childPpidDataCategoriesReq) > 0 { - for _, item := range childPpidDataCategoriesReq { - childPpidDataCategoriesRes = append(childPpidDataCategoriesRes, PpidDataCategoriesResponseMapper(item, nil)) - } - } - - ppidDataCategoriesRes = &res.PpidDataCategoriesResponse{ - ID: ppidDataCategoriesReq.ID, - Title: ppidDataCategoriesReq.Title, - Description: ppidDataCategoriesReq.Description, - Slug: ppidDataCategoriesReq.Slug, - ParentId: ppidDataCategoriesReq.ParentId, - Position: ppidDataCategoriesReq.Position, - LevelGroupId: ppidDataCategoriesReq.LevelGroupId, - GroupBy: ppidDataCategoriesReq.GroupBy, - ThumbnailUrl: ppidDataCategoriesReq.ThumbnailUrl, - IsActive: ppidDataCategoriesReq.IsActive, - CreatedAt: ppidDataCategoriesReq.CreatedAt, - UpdatedAt: ppidDataCategoriesReq.UpdatedAt, - - Children: childPpidDataCategoriesRes, - } - } - return ppidDataCategoriesRes -} - -func PpidDataCategoriesWithPpidDataResponseMapper( - log zerolog.Logger, - ppidDataCategoriesReq *entity.PpidDataCategories, - ppidDataCategoriesRepo repository.PpidDataCategoriesRepository, - ppidDatasRepo ppidDatasRepository.PpidDatasRepository, - ppidDataFilesRepo ppidDataFilesRepository.PpidDataFilesRepository, - usersRepo usersRepository.UsersRepository, -) (ppidDataCategoriesRes *res.PpidDataCategoriesWithPpidDataResponse) { - if ppidDataCategoriesReq != nil { - pagination := paginator.Pagination{ - Limit: -1, - } - - ppidDatasReq := request.PpidDatasQueryRequest{ - CategoryId: &ppidDataCategoriesReq.ID, - Pagination: &pagination, - } - - ppidDatas, _, _ := ppidDatasRepo.GetAll(ppidDatasReq) - - var ppidDatasArr []*response.PpidDatasResponse - if len(ppidDatas) > 0 { - for _, result := range ppidDatas { - ppidDatasArr = append(ppidDatasArr, mapper.PpidDatasResponseMapper(log, ppidDataCategoriesRepo, ppidDataFilesRepo, usersRepo, result)) - } - } - - ppidDataCategoriesRes = &res.PpidDataCategoriesWithPpidDataResponse{ - ID: ppidDataCategoriesReq.ID, - Title: ppidDataCategoriesReq.Title, - Description: ppidDataCategoriesReq.Description, - Slug: ppidDataCategoriesReq.Slug, - ParentId: ppidDataCategoriesReq.ParentId, - Position: ppidDataCategoriesReq.Position, - LevelGroupId: ppidDataCategoriesReq.LevelGroupId, - GroupBy: ppidDataCategoriesReq.GroupBy, - ThumbnailUrl: ppidDataCategoriesReq.ThumbnailUrl, - IsActive: ppidDataCategoriesReq.IsActive, - CreatedAt: ppidDataCategoriesReq.CreatedAt, - UpdatedAt: ppidDataCategoriesReq.UpdatedAt, - - PpidDatas: ppidDatasArr, - } - } - return ppidDataCategoriesRes -} diff --git a/app/module/ppid_data_categories/ppid_data_categories.module.go b/app/module/ppid_data_categories/ppid_data_categories.module.go deleted file mode 100644 index 5bdafae..0000000 --- a/app/module/ppid_data_categories/ppid_data_categories.module.go +++ /dev/null @@ -1,57 +0,0 @@ -package ppid_data_categories - -import ( - "github.com/gofiber/fiber/v2" - "go-humas-be/app/module/ppid_data_categories/controller" - "go-humas-be/app/module/ppid_data_categories/repository" - "go-humas-be/app/module/ppid_data_categories/service" - "go.uber.org/fx" -) - -// struct of PpidDataCategoriesRouter -type PpidDataCategoriesRouter struct { - App fiber.Router - Controller *controller.Controller -} - -// register bulky of PpidDataCategories module -var NewPpidDataCategoriesModule = fx.Options( - // register repository of PpidDataCategories module - fx.Provide(repository.NewPpidDataCategoriesRepository), - - // register service of PpidDataCategories module - fx.Provide(service.NewPpidDataCategoriesService), - - // register controller of PpidDataCategories module - fx.Provide(controller.NewController), - - // register router of PpidDataCategories module - fx.Provide(NewPpidDataCategoriesRouter), -) - -// init PpidDataCategoriesRouter -func NewPpidDataCategoriesRouter(fiber *fiber.App, controller *controller.Controller) *PpidDataCategoriesRouter { - return &PpidDataCategoriesRouter{ - App: fiber, - Controller: controller, - } -} - -// register routes of PpidDataCategories module -func (_i *PpidDataCategoriesRouter) RegisterPpidDataCategoriesRoutes() { - // define controllers - ppidDataCategoriesController := _i.Controller.PpidDataCategories - - // define routes - _i.App.Route("/ppid-data-categories", func(router fiber.Router) { - router.Get("/", ppidDataCategoriesController.All) - router.Get("/:id", ppidDataCategoriesController.Show) - router.Get("/slug/:slug", ppidDataCategoriesController.ShowBySlug) - router.Post("/", ppidDataCategoriesController.Save) - router.Put("/:id", ppidDataCategoriesController.Update) - router.Post("/position", ppidDataCategoriesController.UpdatePosition) - router.Post("/thumbnail/:id", ppidDataCategoriesController.SaveThumbnail) - router.Get("/thumbnail/viewer/:id", ppidDataCategoriesController.Viewer) - router.Delete("/:id", ppidDataCategoriesController.Delete) - }) -} diff --git a/app/module/ppid_data_categories/repository/ppid_data_categories.repository.go b/app/module/ppid_data_categories/repository/ppid_data_categories.repository.go deleted file mode 100644 index bfc6fcc..0000000 --- a/app/module/ppid_data_categories/repository/ppid_data_categories.repository.go +++ /dev/null @@ -1,185 +0,0 @@ -package repository - -import ( - "fmt" - "github.com/rs/zerolog" - "go-humas-be/app/database" - "go-humas-be/app/database/entity" - "go-humas-be/app/module/ppid_data_categories/request" - "go-humas-be/utils/paginator" - "strings" - "time" -) - -type ppidDataCategoriesRepository struct { - DB *database.Database - Log zerolog.Logger -} - -// PpidDataCategoriesRepository define interface of IPpidDataCategoriesRepository -type PpidDataCategoriesRepository interface { - GetAll(req request.PpidDataCategoriesQueryRequest) (ppidDataCategoriess []*entity.PpidDataCategories, paging paginator.Pagination, err error) - GetAllNonPage(req request.PpidDataCategoriesQueryRequest) (ppidDataCategoriess []*entity.PpidDataCategories, paging paginator.Pagination, err error) - FindOne(id uint) (ppidDataCategories *entity.PpidDataCategories, err error) - FindOneBySlug(slug string) (ppidDataCategories *entity.PpidDataCategories, err error) - FindOneLastPosition() (ppidDataCategories *entity.PpidDataCategories, err error) - Create(ppidDataCategories *entity.PpidDataCategories) (err error) - Update(id uint, ppidDataCategories *entity.PpidDataCategories) (err error) - UpdateAll(ppidDataCategories []*entity.PpidDataCategories) (err error) - Delete(id uint) (err error) -} - -func NewPpidDataCategoriesRepository(db *database.Database, logger zerolog.Logger) PpidDataCategoriesRepository { - return &ppidDataCategoriesRepository{ - DB: db, - Log: logger, - } -} - -// implement interface of IPpidDataCategoriesRepository -func (_i *ppidDataCategoriesRepository) GetAll(req request.PpidDataCategoriesQueryRequest) (ppidDataCategoriess []*entity.PpidDataCategories, paging paginator.Pagination, err error) { - var count int64 - - _i.Log.Info().Str("timestamp", time.Now(). - Format(time.RFC3339)).Str("Service:GetAlls", "Interface:ppidDataCategoriesRepository"). - Interface("req", req).Msg("") - - query := _i.DB.DB.Model(&entity.PpidDataCategories{}) - query = query.Where("is_active = ?", true) - - if req.Title != nil && *req.Title != "" { - title := strings.ToLower(*req.Title) - query = query.Where("LOWER(title) LIKE ?", "%"+strings.ToLower(title)+"%") - } - if req.Description != nil && *req.Description != "" { - description := strings.ToLower(*req.Description) - query = query.Where("LOWER(description) LIKE ?", "%"+strings.ToLower(description)+"%") - } - if req.ParentId != nil { - query = query.Where("parent_id = ?", req.ParentId) - } - if req.Group != nil { - query = query.Where("group_by = ?", req.Group) - } - if req.LevelGroupId != nil { - query = query.Where("level_group_id = ?", req.LevelGroupId) - } - if req.IsOnlyTop != nil { - if *req.IsOnlyTop == true { - query = query.Where("parent_id IS NULL") - } - } - 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(&ppidDataCategoriess).Error - if err != nil { - return - } - - paging = *req.Pagination - - return -} - -// implement interface of IPpidDataCategoriesRepository -func (_i *ppidDataCategoriesRepository) GetAllNonPage(req request.PpidDataCategoriesQueryRequest) (ppidDataCategoriess []*entity.PpidDataCategories, paging paginator.Pagination, err error) { - var count int64 - - _i.Log.Info().Str("timestamp", time.Now(). - Format(time.RFC3339)).Str("Service:GetAll", "Interface:ppidDataCategoriesRepository"). - Interface("req", req).Msg("") - - query := _i.DB.DB.Model(&entity.PpidDataCategories{}) - query = query.Where("is_active = ?", true) - - if req.Title != nil && *req.Title != "" { - title := strings.ToLower(*req.Title) - query = query.Where("LOWER(title) LIKE ?", "%"+strings.ToLower(title)+"%") - } - if req.Description != nil && *req.Description != "" { - description := strings.ToLower(*req.Description) - query = query.Where("LOWER(description) LIKE ?", "%"+strings.ToLower(description)+"%") - } - if req.ParentId != nil { - query = query.Where("parent_id = ?", req.ParentId) - } - if req.IsOnlyTop != nil { - if *req.IsOnlyTop == true { - query = query.Where("parent_id IS NULL") - } - } - query.Count(&count) - - err = query.Find(&ppidDataCategoriess).Error - if err != nil { - return - } - - return -} - -func (_i *ppidDataCategoriesRepository) FindOne(id uint) (ppidDataCategories *entity.PpidDataCategories, err error) { - if err := _i.DB.DB.First(&ppidDataCategories, id).Error; err != nil { - return nil, err - } - - return ppidDataCategories, nil -} - -func (_i *ppidDataCategoriesRepository) FindOneBySlug(slug string) (ppidDataCategories *entity.PpidDataCategories, err error) { - if err := _i.DB.DB.Where("slug = ?", slug).First(&ppidDataCategories).Error; err != nil { - return nil, err - } - - _i.Log.Info().Str("timestamp", time.Now(). - Format(time.RFC3339)).Str("Service:FindOneBySlug", "Interface:FindOneBySlug"). - Interface("ppidDataCategories", ppidDataCategories).Msg("") - - return ppidDataCategories, nil -} - -func (_i *ppidDataCategoriesRepository) FindOneLastPosition() (ppidDataCategories *entity.PpidDataCategories, err error) { - if err := _i.DB.DB.Where("position IS NOT NULL").Last(&ppidDataCategories). - Order(fmt.Sprintf("%s %s", "position", "DESC")).Error; err != nil { - return nil, err - } - - return ppidDataCategories, nil -} - -func (_i *ppidDataCategoriesRepository) Create(ppidDataCategories *entity.PpidDataCategories) (err error) { - return _i.DB.DB.Create(ppidDataCategories).Error -} - -func (_i *ppidDataCategoriesRepository) Update(id uint, ppidDataCategories *entity.PpidDataCategories) (err error) { - return _i.DB.DB.Model(&entity.PpidDataCategories{}). - Where(&entity.PpidDataCategories{ID: id}). - Updates(ppidDataCategories).Error -} - -func (_i *ppidDataCategoriesRepository) UpdateAll(ppidDataCategories []*entity.PpidDataCategories) (err error) { - for _, req := range ppidDataCategories { - err := _i.DB.DB.Model(&entity.PpidDataCategories{}). - Where(&entity.PpidDataCategories{ID: req.ID}). - Updates(req).Error - if err != nil { - return err - } - } - return nil -} - -func (_i *ppidDataCategoriesRepository) Delete(id uint) error { - return _i.DB.DB.Delete(&entity.PpidDataCategories{}, id).Error -} diff --git a/app/module/ppid_data_categories/request/ppid_data_categories.request.go b/app/module/ppid_data_categories/request/ppid_data_categories.request.go deleted file mode 100644 index b7385c5..0000000 --- a/app/module/ppid_data_categories/request/ppid_data_categories.request.go +++ /dev/null @@ -1,132 +0,0 @@ -package request - -import ( - "go-humas-be/app/database/entity" - "go-humas-be/utils/paginator" - "strconv" - "time" -) - -type PpidDataCategoriesGeneric interface { - ToEntity() -} - -type PpidDataCategoriesQueryRequest struct { - Title *string `json:"title"` - Description *string `json:"description"` - IsOnlyTop *bool `json:"isOnlyTop"` - IsPpidDataIncluded *bool `json:"isPpidDataIncluded"` - ParentId *uint `json:"parentId"` - Group *string `json:"group"` - LevelGroup *string `json:"levelGroup"` - LevelGroupId *uint `json:"levelGroupId"` - Pagination *paginator.Pagination `json:"pagination"` -} - -type PpidDataCategoriesCreateRequest struct { - Title string `json:"title" validate:"required"` - Description string `json:"description" validate:"required"` - Slug string `json:"slug" validate:"required"` - ParentId *uint `json:"parentId"` -} - -func (req PpidDataCategoriesCreateRequest) ToEntity() *entity.PpidDataCategories { - return &entity.PpidDataCategories{ - Title: req.Title, - Description: req.Description, - Slug: req.Slug, - ParentId: req.ParentId, - } -} - -type PpidDataCategoriesUpdateRequest struct { - ID uint `json:"id" validate:"required"` - Title string `json:"title" validate:"required"` - Description string `json:"description" validate:"required"` - Slug string `json:"slug" validate:"required"` - ParentId *uint `json:"parentId"` -} - -func (req PpidDataCategoriesUpdateRequest) ToEntity() *entity.PpidDataCategories { - return &entity.PpidDataCategories{ - ID: req.ID, - Title: req.Title, - Description: req.Description, - Slug: req.Slug, - ParentId: req.ParentId, - UpdatedAt: time.Now(), - } -} - -type PpidDataCategoriesUpdatePositionPayload struct { - Positions []PpidDataCategoriesUpdatePositionRequest `json:"positions"` -} - -type PpidDataCategoriesUpdatePositionRequest struct { - ID uint `json:"id" validate:"required"` - Position int `json:"position" validate:"required"` -} - -func (req PpidDataCategoriesUpdatePositionRequest) ToEntity() *entity.PpidDataCategories { - return &entity.PpidDataCategories{ - ID: req.ID, - Position: &req.Position, - UpdatedAt: time.Now(), - } -} - -type PpidDataCategoriesQueryRequestContext struct { - Title string `json:"title"` - Description string `json:"description"` - IsOnlyTop string `json:"isOnlyTop"` - IsPpidDataIncluded string `json:"isPpidDataIncluded"` - Group string `json:"group"` - LevelGroup string `json:"levelGroup"` - LevelGroupId string `json:"levelGroupId"` - ParentId string `json:"parentId"` -} - -func (req PpidDataCategoriesQueryRequestContext) ToParamRequest() PpidDataCategoriesQueryRequest { - var request PpidDataCategoriesQueryRequest - - if title := req.Title; title != "" { - request.Title = &title - } - if description := req.Description; description != "" { - request.Description = &description - } - if parentIdStr := req.ParentId; parentIdStr != "" { - parentId, err := strconv.ParseUint(parentIdStr, 10, 0) - parentIdUint := uint(parentId) - if err == nil { - request.ParentId = &parentIdUint - } - } - if isOnlyTopStr := req.IsOnlyTop; isOnlyTopStr != "" { - isOnlyTop, err := strconv.ParseBool(isOnlyTopStr) - if err == nil { - request.IsOnlyTop = &isOnlyTop - } - } - if group := req.Group; group != "" { - request.Group = &group - } - if levelGroup := req.LevelGroup; levelGroup != "" { - request.LevelGroup = &levelGroup - } - if levelGroupIdStr := req.LevelGroupId; levelGroupIdStr != "" { - levelGroupId, err := strconv.ParseUint(levelGroupIdStr, 10, 0) - levelGroupIdUint := uint(levelGroupId) - if err == nil { - request.LevelGroupId = &levelGroupIdUint - } - } - if isPpidDataIncludedStr := req.IsPpidDataIncluded; isPpidDataIncludedStr != "" { - isPpidDataIncluded, err := strconv.ParseBool(isPpidDataIncludedStr) - if err == nil { - request.IsPpidDataIncluded = &isPpidDataIncluded - } - } - - return request -} diff --git a/app/module/ppid_data_categories/response/ppid_data_categories.response.go b/app/module/ppid_data_categories/response/ppid_data_categories.response.go deleted file mode 100644 index f6758c0..0000000 --- a/app/module/ppid_data_categories/response/ppid_data_categories.response.go +++ /dev/null @@ -1,40 +0,0 @@ -package response - -import ( - "go-humas-be/app/module/ppid_datas/response" - "time" -) - -type PpidDataCategoriesResponse struct { - ID uint `json:"id"` - Title string `json:"title"` - Description string `json:"description"` - Slug string `json:"slug"` - ParentId *uint `json:"parentId"` - Position *int `json:"position"` - LevelGroupId *uint `json:"levelGroupId"` - GroupBy *string `json:"groupBy"` - ThumbnailUrl *string `json:"thumbnailUrl"` - IsActive *bool `json:"isActive"` - CreatedAt time.Time `json:"createdAt"` - UpdatedAt time.Time `json:"updatedAt"` - - Children []*PpidDataCategoriesResponse `json:"children"` -} - -type PpidDataCategoriesWithPpidDataResponse struct { - ID uint `json:"id"` - Title string `json:"title"` - Description string `json:"description"` - Slug string `json:"slug"` - ParentId *uint `json:"parentId"` - Position *int `json:"position"` - LevelGroupId *uint `json:"levelGroupId"` - GroupBy *string `json:"groupBy"` - ThumbnailUrl *string `json:"thumbnailUrl"` - IsActive *bool `json:"isActive"` - CreatedAt time.Time `json:"createdAt"` - UpdatedAt time.Time `json:"updatedAt"` - - PpidDatas []*response.PpidDatasResponse `json:"ppidDatas"` -} diff --git a/app/module/ppid_data_categories/service/ppid_data_categories.service.go b/app/module/ppid_data_categories/service/ppid_data_categories.service.go deleted file mode 100644 index 3128b7f..0000000 --- a/app/module/ppid_data_categories/service/ppid_data_categories.service.go +++ /dev/null @@ -1,369 +0,0 @@ -package service - -import ( - "context" - "github.com/gofiber/fiber/v2" - "github.com/minio/minio-go/v7" - "github.com/rs/zerolog" - "go-humas-be/app/database/entity" - "go-humas-be/app/module/ppid_data_categories/mapper" - "go-humas-be/app/module/ppid_data_categories/repository" - "go-humas-be/app/module/ppid_data_categories/request" - "go-humas-be/app/module/ppid_data_categories/response" - ppidDataFilesRepository "go-humas-be/app/module/ppid_data_files/repository" - ppidDatasRepository "go-humas-be/app/module/ppid_datas/repository" - userLevelsRepository "go-humas-be/app/module/user_levels/repository" - usersRepository "go-humas-be/app/module/users/repository" - config "go-humas-be/config/config" - "go-humas-be/utils/paginator" - utilSvc "go-humas-be/utils/service" - "io" - "log" - "math/rand" - "mime" - "path/filepath" - "strconv" - "strings" - "time" -) - -// PpidDataCategoriesService -type ppidDataCategoriesService struct { - Repo repository.PpidDataCategoriesRepository - PpidDatasRepo ppidDatasRepository.PpidDatasRepository - PpidDataFilesRepo ppidDataFilesRepository.PpidDataFilesRepository - UsersRepo usersRepository.UsersRepository - UserLevelsRepo userLevelsRepository.UserLevelsRepository - MinioStorage *config.MinioStorage - Log zerolog.Logger - Cfg *config.Config -} - -// PpidDataCategoriesService define interface of IPpidDataCategoriesService -type PpidDataCategoriesService interface { - All(req request.PpidDataCategoriesQueryRequest) (ppidDataCategories []*response.PpidDataCategoriesResponse, paging paginator.Pagination, err error) - AllInPpidData(req request.PpidDataCategoriesQueryRequest, authToken string) (ppidDataCategories []*response.PpidDataCategoriesWithPpidDataResponse, paging paginator.Pagination, err error) - Show(id uint) (ppidDataCategories *response.PpidDataCategoriesResponse, err error) - ShowBySlug(slug string) (ppidDataCategories *response.PpidDataCategoriesResponse, err error) - Save(req request.PpidDataCategoriesCreateRequest, authToken string) (err error) - SaveThumbnail(c *fiber.Ctx) (err error) - Update(id uint, req request.PpidDataCategoriesUpdateRequest) (err error) - UpdatePosition(req []request.PpidDataCategoriesUpdatePositionRequest) (err error) - Delete(id uint) error - Viewer(c *fiber.Ctx) error -} - -// NewPpidDataCategoriesService init PpidDataCategoriesService -func NewPpidDataCategoriesService( - repo repository.PpidDataCategoriesRepository, - ppidDatasRepo ppidDatasRepository.PpidDatasRepository, - ppidDataFilesRepo ppidDataFilesRepository.PpidDataFilesRepository, - usersRepo usersRepository.UsersRepository, - userLevelsRepo userLevelsRepository.UserLevelsRepository, - minioStorage *config.MinioStorage, - log zerolog.Logger, - cfg *config.Config, -) PpidDataCategoriesService { - - return &ppidDataCategoriesService{ - Repo: repo, - PpidDatasRepo: ppidDatasRepo, - PpidDataFilesRepo: ppidDataFilesRepo, - UsersRepo: usersRepo, - UserLevelsRepo: userLevelsRepo, - MinioStorage: minioStorage, - Log: log, - Cfg: cfg, - } -} - -// All implement interface of PpidDataCategoriesService -func (_i *ppidDataCategoriesService) All(req request.PpidDataCategoriesQueryRequest) (ppidDataCategories []*response.PpidDataCategoriesResponse, paging paginator.Pagination, err error) { - results, paging, err := _i.Repo.GetAll(req) - if err != nil { - return - } - - for _, result := range results { - req := request.PpidDataCategoriesQueryRequest{ - ParentId: &result.ID, - } - subResult, _, _ := _i.Repo.GetAllNonPage(req) - ppidDataCategories = append(ppidDataCategories, mapper.PpidDataCategoriesResponseMapper(result, subResult)) - } - - return -} - -func (_i *ppidDataCategoriesService) AllInPpidData(req request.PpidDataCategoriesQueryRequest, authToken string) (ppidDataCategories []*response.PpidDataCategoriesWithPpidDataResponse, paging paginator.Pagination, err error) { - - if req.LevelGroup != nil { - findLevel, err := _i.UserLevelsRepo.FindOneByAlias(*req.LevelGroup) - if err != nil { - return ppidDataCategories, paging, err - } - if findLevel != nil { - req.LevelGroupId = &findLevel.ID - } - } else { - createdBy := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) - if createdBy != nil { - req.LevelGroupId = &createdBy.UserLevelId - } else { - mabesGroup := "mabes" - req.Group = &mabesGroup - } - } - results, paging, err := _i.Repo.GetAll(req) - if err != nil { - return - } - - for _, result := range results { - ppidDataCategories = append(ppidDataCategories, mapper.PpidDataCategoriesWithPpidDataResponseMapper(_i.Log, result, _i.Repo, _i.PpidDatasRepo, _i.PpidDataFilesRepo, _i.UsersRepo)) - } - - return -} - -func (_i *ppidDataCategoriesService) Show(id uint) (ppidDataCategories *response.PpidDataCategoriesResponse, err error) { - result, err := _i.Repo.FindOne(id) - if err != nil { - return nil, err - } - - req := request.PpidDataCategoriesQueryRequest{ - ParentId: &result.ID, - } - _i.Log.Info().Str("timestamp", time.Now(). - Format(time.RFC3339)).Str("Service:Show", "Interface:ppidDataCategoriesService"). - Interface("req", req).Msg("") - - subResult, _, _ := _i.Repo.GetAllNonPage(req) - - _i.Log.Info().Str("timestamp", time.Now(). - Format(time.RFC3339)).Str("Service:Show", "Interface:ppidDataCategoriesService"). - Interface("res", subResult).Msg("") - - return mapper.PpidDataCategoriesResponseMapper(result, subResult), nil -} - -func (_i *ppidDataCategoriesService) ShowBySlug(slug string) (ppidDataCategories *response.PpidDataCategoriesResponse, err error) { - result, err := _i.Repo.FindOneBySlug(slug) - if err != nil { - return nil, err - } - - req := request.PpidDataCategoriesQueryRequest{ - ParentId: &result.ID, - Pagination: &paginator.Pagination{ - Limit: 20, - }, - } - subResult, _, _ := _i.Repo.GetAll(req) - - return mapper.PpidDataCategoriesResponseMapper(result, subResult), nil -} - -func (_i *ppidDataCategoriesService) Save(req request.PpidDataCategoriesCreateRequest, authToken string) (err error) { - _i.Log.Info().Interface("data", req).Msg("") - - lastPpidData, _ := _i.Repo.FindOneLastPosition() - lastPosition := lastPpidData.Position - *lastPosition += 1 - - newReq := req.ToEntity() - newReq.Position = lastPosition - - createdBy := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) - if createdBy != nil { - newReq.CreatedById = &createdBy.ID - newReq.LevelGroupId = &createdBy.UserLevelId - - userLevels, err := _i.UserLevelsRepo.FindOne(uint(createdBy.UserLevelId)) - if err != nil { - return err - } - if userLevels != nil { - newReq.GroupBy = userLevels.Group - } - } - - return _i.Repo.Create(newReq) -} - -func (_i *ppidDataCategoriesService) SaveThumbnail(c *fiber.Ctx) (err error) { - - id, err := strconv.ParseUint(c.Params("id"), 10, 0) - if err != nil { - return err - } - - host := _i.Cfg.App.Domain - port := _i.Cfg.App.ExternalPort - - _i.Log.Info().Str("timestamp", time.Now(). - Format(time.RFC3339)).Str("Service:SaveThumbnail", "Categories:SaveThumbnail"). - Interface("id", id).Msg("") - - bucketName := _i.MinioStorage.Cfg.ObjectStorage.MinioStorage.BucketName - - form, err := c.MultipartForm() - if err != nil { - return err - } - files := form.File["files"] - - // Create minio connection. - minioClient, err := _i.MinioStorage.ConnectMinio() - if err != nil { - // Return status 500 and minio connection error. - return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{ - "error": true, - "msg": err.Error(), - }) - } - - // Iterasi semua file yang diunggah - for _, file := range files { - - _i.Log.Info().Str("timestamp", time.Now(). - Format(time.RFC3339)).Str("Service:Resource", "Uploader:: loop1"). - Interface("data", file).Msg("") - - src, err := file.Open() - if err != nil { - return err - } - defer src.Close() - - filename := filepath.Base(file.Filename) - filename = strings.ReplaceAll(filename, " ", "") - filenameWithoutExt := filepath.Clean(filename[:len(filename)-len(filepath.Ext(filename))]) - extension := filepath.Ext(file.Filename)[1:] - - rand.New(rand.NewSource(time.Now().UnixNano())) - randUniqueId := rand.Intn(1000000) - - newFilenameWithoutExt := filenameWithoutExt + "_" + strconv.Itoa(randUniqueId) - newFilename := newFilenameWithoutExt + "." + extension - objectName := "ppid/category/thumbnail/" + newFilename - - findCategory, err := _i.Repo.FindOne(uint(id)) - - thumbnailUrl := host + port + "/ppid-data-categories/thumbnail/viewer/" + strconv.Itoa(int(id)) - - findCategory.ThumbnailPath = &objectName - findCategory.ThumbnailUrl = &thumbnailUrl - - err = _i.Repo.Update(uint(id), findCategory) - if err != nil { - return err - } - - // Upload file ke MinIO - _, err = minioClient.PutObject(context.Background(), bucketName, objectName, src, file.Size, minio.PutObjectOptions{}) - if err != nil { - return err - } - } - - _i.Log.Info().Str("timestamp", time.Now(). - Format(time.RFC3339)).Str("Service:Resource", "User:All"). - Interface("data", "Successfully uploaded").Msg("") - - return -} - -func (_i *ppidDataCategoriesService) Update(id uint, req request.PpidDataCategoriesUpdateRequest) (err error) { - _i.Log.Info().Interface("data", req).Msg("") - return _i.Repo.Update(id, req.ToEntity()) -} - -func (_i *ppidDataCategoriesService) UpdatePosition(req []request.PpidDataCategoriesUpdatePositionRequest) (err error) { - _i.Log.Info().Interface("data", req).Msg("") - - var entityReq []*entity.PpidDataCategories - for _, reqItem := range req { - entityReq = append(entityReq, reqItem.ToEntity()) - } - - _i.Log.Info().Str("timestamp", time.Now(). - Format(time.RFC3339)).Str("Service:UpdatePosition", "ppidDataCategoriesController"). - Interface("entityReq", entityReq).Msg("") - - return _i.Repo.UpdateAll(entityReq) -} - -func (_i *ppidDataCategoriesService) 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) -} - -func (_i *ppidDataCategoriesService) Viewer(c *fiber.Ctx) (err error) { - id, err := strconv.ParseUint(c.Params("id"), 10, 0) - result, err := _i.Repo.FindOne(uint(id)) - if err != nil { - return err - } - - if result.ThumbnailPath == nil { - return nil - } - - ctx := context.Background() - bucketName := _i.MinioStorage.Cfg.ObjectStorage.MinioStorage.BucketName - objectName := result.ThumbnailPath - - _i.Log.Info().Str("timestamp", time.Now(). - Format(time.RFC3339)).Str("Service:Resource", "Article:Uploads"). - Interface("data", objectName).Msg("") - - // Create minio connection. - minioClient, err := _i.MinioStorage.ConnectMinio() - if err != nil { - // Return status 500 and minio connection error. - return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{ - "error": true, - "msg": err.Error(), - }) - } - - fileContent, err := minioClient.GetObject(ctx, bucketName, *objectName, minio.GetObjectOptions{}) - if err != nil { - log.Fatalln(err) - } - defer fileContent.Close() - - contentType := mime.TypeByExtension("." + getFileExtension(*objectName)) - if contentType == "" { - contentType = "application/octet-stream" - } - - c.Set("Content-Type", contentType) - - if _, err := io.Copy(c.Response().BodyWriter(), fileContent); err != nil { - return err - } - - return -} - -func getFileExtension(filename string) string { - // split file name - parts := strings.Split(filename, ".") - - // jika tidak ada ekstensi, kembalikan string kosong - if len(parts) == 1 || (len(parts) == 2 && parts[0] == "") { - return "" - } - - // ambil ekstensi terakhir - return parts[len(parts)-1] -} diff --git a/app/module/ppid_data_files/controller/controller.go b/app/module/ppid_data_files/controller/controller.go deleted file mode 100644 index 9bbebfa..0000000 --- a/app/module/ppid_data_files/controller/controller.go +++ /dev/null @@ -1,16 +0,0 @@ -package controller - -import ( - "github.com/rs/zerolog" - "go-humas-be/app/module/ppid_data_files/service" -) - -type Controller struct { - PpidDataFiles PpidDataFilesController -} - -func NewController(PpidDataFilesService service.PpidDataFilesService, log zerolog.Logger) *Controller { - return &Controller{ - PpidDataFiles: NewPpidDataFilesController(PpidDataFilesService, log), - } -} diff --git a/app/module/ppid_data_files/controller/ppid_data_files.controller.go b/app/module/ppid_data_files/controller/ppid_data_files.controller.go deleted file mode 100644 index f40a967..0000000 --- a/app/module/ppid_data_files/controller/ppid_data_files.controller.go +++ /dev/null @@ -1,241 +0,0 @@ -package controller - -import ( - "github.com/gofiber/fiber/v2" - "github.com/rs/zerolog" - "go-humas-be/app/module/ppid_data_files/request" - "go-humas-be/app/module/ppid_data_files/service" - "go-humas-be/utils/paginator" - utilRes "go-humas-be/utils/response" - utilVal "go-humas-be/utils/validator" - "strconv" -) - -type ppidDataFilesController struct { - ppidDataFilesService service.PpidDataFilesService - Log zerolog.Logger -} - -type PpidDataFilesController interface { - All(c *fiber.Ctx) error - Show(c *fiber.Ctx) error - Save(c *fiber.Ctx) error - Update(c *fiber.Ctx) error - UpdatePosition(c *fiber.Ctx) error - Delete(c *fiber.Ctx) error - Viewer(c *fiber.Ctx) error -} - -func NewPpidDataFilesController(ppidDataFilesService service.PpidDataFilesService, log zerolog.Logger) PpidDataFilesController { - return &ppidDataFilesController{ - ppidDataFilesService: ppidDataFilesService, - Log: log, - } -} - -// All PpidDataFiles -// @Summary Get all PpidDataFiles -// @Description API for getting all PpidDataFiles -// @Tags PPID Files -// @Security Bearer -// @Param req query request.PpidDataFilesQueryRequest 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 /ppid-data-files [get] -func (_i *ppidDataFilesController) All(c *fiber.Ctx) error { - paginate, err := paginator.Paginate(c) - if err != nil { - return err - } - - reqContext := request.PpidDataFilesQueryRequestContext{ - Title: c.Query("title"), - PpidDataId: c.Query("ppidDataId"), - Description: c.Query("description"), - Unit: c.Query("unit"), - FileType: c.Query("fileType"), - StatusId: c.Query("statusId"), - IsPublish: c.Query("isPublish"), - } - req := reqContext.ToParamRequest() - req.Pagination = paginate - - ppidDataFilesData, paging, err := _i.ppidDataFilesService.All(req) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"PpidDataFiles list successfully retrieved"}, - Data: ppidDataFilesData, - Meta: paging, - }) -} - -// Show PpidDataFiles -// @Summary Get one PpidDataFiles -// @Description API for getting one PpidDataFiles -// @Tags PPID Files -// @Security Bearer -// @Param id path int true "PpidDataFiles ID" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /ppid-data-files/{id} [get] -func (_i *ppidDataFilesController) Show(c *fiber.Ctx) error { - id, err := strconv.ParseUint(c.Params("id"), 10, 0) - if err != nil { - return err - } - - ppidDataFilesData, err := _i.ppidDataFilesService.Show(uint(id)) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"PpidDataFiles successfully retrieved"}, - Data: ppidDataFilesData, - }) -} - -// Save PpidDataFiles -// @Summary Create PpidDataFiles -// @Description API for create PpidDataFiles -// @Tags PPID Files -// @Security Bearer -// @Produce json -// @Param titles formData string false "Titles" -// @Param types formData string false "Types" -// @Param positions formData string false "Positions" -// @Param urls formData string false "Upload Url" -// @Param files formData file false "Upload File" -// @Param ppidDataId path int true "Ppid Data ID" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /ppid-data-files/{ppidDataId} [post] -func (_i *ppidDataFilesController) Save(c *fiber.Ctx) error { - err := _i.ppidDataFilesService.Save(c) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"PpidDataFiles successfully created"}, - }) -} - -// Update PpidDataFiles -// @Summary update PpidDataFiles -// @Description API for update PpidDataFiles -// @Tags PPID Files -// @Security Bearer -// @Param payload body request.PpidDataFilesUpdateRequest true "Required payload" -// @Param id path int true "Ppid Data ID" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /ppid-data-files/{id} [put] -func (_i *ppidDataFilesController) Update(c *fiber.Ctx) error { - id, err := strconv.ParseUint(c.Params("id"), 10, 0) - if err != nil { - return err - } - - req := new(request.PpidDataFilesUpdateRequest) - if err := utilVal.ParseAndValidate(c, req); err != nil { - return err - } - - err = _i.ppidDataFilesService.Update(uint(id), *req) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"PpidDataFiles successfully updated"}, - }) -} - -// UpdatePosition PpidDataFiles -// @Summary updatePosition PpidDataFiles -// @Description API for PpidDataFiles -// @Tags PPID Files -// @Security Bearer -// @Param payload body request.PpidDataFilesUpdatePositionPayload true "Required payload" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /ppid-data-files/update/position [post] -func (_i *ppidDataFilesController) UpdatePosition(c *fiber.Ctx) error { - req := new(request.PpidDataFilesUpdatePositionPayload) - if err := utilVal.ParseAndValidate(c, req); err != nil { - return err - } - - err := _i.ppidDataFilesService.UpdatePosition(req.Positions) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"PpidDataFiles successfully updated"}, - }) -} - -// Delete PpidDataFiles -// @Summary delete PpidDataFiles -// @Description API for delete PpidDataFiles -// @Tags PPID Files -// @Security Bearer -// @Param id path int true "PpidDataFiles ID" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /ppid-data-files/{id} [delete] -func (_i *ppidDataFilesController) Delete(c *fiber.Ctx) error { - id, err := strconv.ParseUint(c.Params("id"), 10, 0) - if err != nil { - return err - } - - err = _i.ppidDataFilesService.Delete(uint(id)) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"PpidDataFiles successfully deleted"}, - }) -} - -// Viewer PpidDataFiles -// @Summary Create PpidDataFiles -// @Description API for create PpidDataFiles -// @Tags PPID Files -// @Security Bearer -// @Param filename path string true "Ppid Data Filename" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /ppid-data-files/viewer/{filename} [get] -func (_i *ppidDataFilesController) Viewer(c *fiber.Ctx) error { - filename := c.Params("filename") - return _i.ppidDataFilesService.Viewer(c, filename) -} diff --git a/app/module/ppid_data_files/mapper/ppid_data_files.mapper.go b/app/module/ppid_data_files/mapper/ppid_data_files.mapper.go deleted file mode 100644 index c2f4824..0000000 --- a/app/module/ppid_data_files/mapper/ppid_data_files.mapper.go +++ /dev/null @@ -1,30 +0,0 @@ -package mapper - -import ( - "go-humas-be/app/database/entity" - res "go-humas-be/app/module/ppid_data_files/response" -) - -func PpidDataFilesResponseMapper(ppidDataFilesReq *entity.PpidDataFiles) (ppidDataFilesRes *res.PpidDataFilesResponse) { - if ppidDataFilesReq != nil { - ppidDataFilesRes = &res.PpidDataFilesResponse{ - ID: ppidDataFilesReq.ID, - Title: ppidDataFilesReq.Title, - Type: ppidDataFilesReq.Type, - PpidDataId: ppidDataFilesReq.PpidDataId, - FileName: ppidDataFilesReq.FileName, - FileUrl: ppidDataFilesReq.FileUrl, - FileType: ppidDataFilesReq.FileType, - DownloadCount: ppidDataFilesReq.DownloadCount, - Position: ppidDataFilesReq.Position, - CreatedById: ppidDataFilesReq.CreatedById, - StatusId: ppidDataFilesReq.StatusId, - IsPublish: ppidDataFilesReq.IsPublish, - PublishedAt: ppidDataFilesReq.PublishedAt, - IsActive: ppidDataFilesReq.IsActive, - CreatedAt: ppidDataFilesReq.CreatedAt, - UpdatedAt: ppidDataFilesReq.UpdatedAt, - } - } - return ppidDataFilesRes -} diff --git a/app/module/ppid_data_files/ppid_data_files.module.go b/app/module/ppid_data_files/ppid_data_files.module.go deleted file mode 100644 index 794aba7..0000000 --- a/app/module/ppid_data_files/ppid_data_files.module.go +++ /dev/null @@ -1,55 +0,0 @@ -package ppid_data_files - -import ( - "github.com/gofiber/fiber/v2" - "go-humas-be/app/module/ppid_data_files/controller" - "go-humas-be/app/module/ppid_data_files/repository" - "go-humas-be/app/module/ppid_data_files/service" - "go.uber.org/fx" -) - -// struct of PpidDataFilesRouter -type PpidDataFilesRouter struct { - App fiber.Router - Controller *controller.Controller -} - -// register bulky of PpidDataFiles module -var NewPpidDataFilesModule = fx.Options( - // register repository of PpidDataFiles module - fx.Provide(repository.NewPpidDataFilesRepository), - - // register service of PpidDataFiles module - fx.Provide(service.NewPpidDataFilesService), - - // register controller of PpidDataFiles module - fx.Provide(controller.NewController), - - // register router of PpidDataFiles module - fx.Provide(NewPpidDataFilesRouter), -) - -// init PpidDataFilesRouter -func NewPpidDataFilesRouter(fiber *fiber.App, controller *controller.Controller) *PpidDataFilesRouter { - return &PpidDataFilesRouter{ - App: fiber, - Controller: controller, - } -} - -// register routes of PpidDataFiles module -func (_i *PpidDataFilesRouter) RegisterPpidDataFilesRoutes() { - // define controllers - ppidDataFilesController := _i.Controller.PpidDataFiles - - // define routes - _i.App.Route("/ppid-data-files", func(router fiber.Router) { - router.Get("/", ppidDataFilesController.All) - router.Get("/:id", ppidDataFilesController.Show) - router.Post("/:ppidDataId", ppidDataFilesController.Save) - router.Put("/:id", ppidDataFilesController.Update) - router.Post("/update/position", ppidDataFilesController.UpdatePosition) - router.Delete("/:id", ppidDataFilesController.Delete) - router.Get("/viewer/:filename", ppidDataFilesController.Viewer) - }) -} diff --git a/app/module/ppid_data_files/repository/ppid_data_files.repository.go b/app/module/ppid_data_files/repository/ppid_data_files.repository.go deleted file mode 100644 index b81dd1b..0000000 --- a/app/module/ppid_data_files/repository/ppid_data_files.repository.go +++ /dev/null @@ -1,154 +0,0 @@ -package repository - -import ( - "fmt" - "github.com/rs/zerolog" - "go-humas-be/app/database" - "go-humas-be/app/database/entity" - "go-humas-be/app/module/ppid_data_files/request" - "go-humas-be/utils/paginator" - "strings" -) - -type ppidDataFilesRepository struct { - DB *database.Database - Log zerolog.Logger -} - -// PpidDataFilesRepository define interface of IPpidDataFilesRepository -type PpidDataFilesRepository interface { - GetAll(req request.PpidDataFilesQueryRequest) (ppidDataFiless []*entity.PpidDataFiles, paging paginator.Pagination, err error) - FindOne(id uint) (ppidDataFiles *entity.PpidDataFiles, err error) - FindByFilename(filename string) (ppidDataFiles *entity.PpidDataFiles, err error) - FindByPpidData(ppidDataId uint) (ppidDataFiles []*entity.PpidDataFiles, err error) - FindOneLastPosition() (ppidDataFiles *entity.PpidDataFiles, err error) - Create(ppidDataFiles *entity.PpidDataFiles) (err error) - Update(id uint, ppidDataFiles *entity.PpidDataFiles) (err error) - UpdateAll(ppidDataFiles []*entity.PpidDataFiles) (err error) - Delete(id uint) (err error) -} - -func NewPpidDataFilesRepository(db *database.Database, logger zerolog.Logger) PpidDataFilesRepository { - return &ppidDataFilesRepository{ - DB: db, - Log: logger, - } -} - -// implement interface of IPpidDataFilesRepository -func (_i *ppidDataFilesRepository) GetAll(req request.PpidDataFilesQueryRequest) (ppidDataFiless []*entity.PpidDataFiles, paging paginator.Pagination, err error) { - var count int64 - - query := _i.DB.DB.Model(&entity.PpidDataFiles{}) - query = query.Where("is_active = ?", true) - - if req.Title != nil && *req.Title != "" { - title := strings.ToLower(*req.Title) - query = query.Where("LOWER(title) LIKE ?", "%"+strings.ToLower(title)+"%") - } - if req.Description != nil && *req.Description != "" { - description := strings.ToLower(*req.Description) - query = query.Where("LOWER(description) LIKE ?", "%"+strings.ToLower(description)+"%") - } - if req.Unit != nil && *req.Unit != "" { - unit := strings.ToLower(*req.Unit) - query = query.Where("LOWER(unit) LIKE ?", "%"+strings.ToLower(unit)+"%") - } - if req.FileType != nil && *req.FileType != "" { - query = query.Where("file_type = ?", req.FileType) - } - if req.PpidDataId != nil { - query = query.Where("ppid_data_id = ?", req.PpidDataId) - } - if req.IsPublish != nil { - query = query.Where("is_publish = ?", req.IsPublish) - } - 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) - - if req.Pagination.Limit == -1 { - query.Limit(req.Pagination.Limit) - } - - err = query.Offset(req.Pagination.Offset).Limit(req.Pagination.Limit).Find(&ppidDataFiless).Error - if err != nil { - return - } - - paging = *req.Pagination - - return -} - -func (_i *ppidDataFilesRepository) FindOne(id uint) (ppidDataFiles *entity.PpidDataFiles, err error) { - if err := _i.DB.DB.First(&ppidDataFiles, id).Error; err != nil { - return nil, err - } - - return ppidDataFiles, nil -} - -func (_i *ppidDataFilesRepository) FindByFilename(filename string) (ppidDataFiles *entity.PpidDataFiles, err error) { - - if err := _i.DB.DB.Where("file_name = ?", filename).First(&ppidDataFiles).Error; err != nil { - return nil, err - } - - return ppidDataFiles, nil -} - -func (_i *ppidDataFilesRepository) FindByPpidData(ppidDataId uint) (ppidDataFiles []*entity.PpidDataFiles, err error) { - if err := _i.DB.DB.Where("ppid_data_id = ?", ppidDataId).Find(&ppidDataFiles).Error; err != nil { - return nil, err - } - - return ppidDataFiles, nil -} - -func (_i *ppidDataFilesRepository) FindOneLastPosition() (ppidDataFiles *entity.PpidDataFiles, err error) { - if err := _i.DB.DB.Where("position IS NOT NULL").Last(&ppidDataFiles). - Order(fmt.Sprintf("%s %s", "position", "DESC")).Error; err != nil { - return nil, err - } - - return ppidDataFiles, nil -} - -func (_i *ppidDataFilesRepository) Create(ppidDataFiles *entity.PpidDataFiles) (err error) { - return _i.DB.DB.Create(ppidDataFiles).Error -} - -func (_i *ppidDataFilesRepository) Update(id uint, ppidDataFiles *entity.PpidDataFiles) (err error) { - return _i.DB.DB.Model(&entity.PpidDataFiles{}). - Where(&entity.PpidDataFiles{ID: id}). - Updates(ppidDataFiles).Error -} - -func (_i *ppidDataFilesRepository) UpdateAll(ppidDataFiles []*entity.PpidDataFiles) (err error) { - for _, req := range ppidDataFiles { - err := _i.DB.DB.Model(&entity.PpidDataFiles{}). - Where(&entity.PpidDataFiles{ID: req.ID}). - Updates(req).Error - if err != nil { - return err - } - } - return nil -} - -func (_i *ppidDataFilesRepository) Delete(id uint) error { - return _i.DB.DB.Delete(&entity.PpidDataFiles{}, id).Error -} diff --git a/app/module/ppid_data_files/request/ppid_data_files.request.go b/app/module/ppid_data_files/request/ppid_data_files.request.go deleted file mode 100644 index 657b9e1..0000000 --- a/app/module/ppid_data_files/request/ppid_data_files.request.go +++ /dev/null @@ -1,152 +0,0 @@ -package request - -import ( - "go-humas-be/app/database/entity" - "go-humas-be/utils/paginator" - "strconv" - "time" -) - -type PpidDataFilesGeneric interface { - ToEntity() -} - -type PpidDataFilesQueryRequest struct { - Title *string `json:"title"` - PpidDataId *int `json:"ppidDataId"` - Description *string `json:"description"` - Unit *string `json:"unit"` - FileType *string `json:"fileType"` - Position *int `json:"position"` - StatusId *int `json:"statusId"` - IsPublish *bool `json:"isPublish"` - Pagination *paginator.Pagination `json:"pagination"` -} - -type PpidDataFilesCreateRequest struct { - PpidDataId int `json:"ppidDataId" validate:"required"` - Title *string `json:"title"` - Type *string `json:"type"` - Position *int `json:"position"` - FileType *string `json:"fileType"` - FileName *string `json:"fileName"` - FilePath *string `json:"filePath"` - FileUrl *string `json:"fileUrl"` - Size *string `json:"size"` - CreatedById *int `json:"createdById"` - StatusId *int `json:"statusId"` -} - -func (req PpidDataFilesCreateRequest) ToEntity() *entity.PpidDataFiles { - return &entity.PpidDataFiles{ - Title: req.Title, - Type: req.Type, - Position: req.Position, - PpidDataId: req.PpidDataId, - FileType: req.FileType, - FileName: req.FileName, - FilePath: req.FilePath, - FileUrl: req.FileUrl, - Size: req.Size, - CreatedById: req.CreatedById, - StatusId: req.StatusId, - } -} - -type PpidDataFilesUpdateRequest struct { - ID uint `json:"id" validate:"required"` - PpidDataId int `json:"ppidDataId" validate:"required"` - Title *string `json:"title"` - FileType *string `json:"fileType"` - FilePath *string `json:"filePath"` - CreatedById *int `json:"createdById"` - StatusId *int `json:"statusId"` - IsPublish *bool `json:"isPublish"` - PublishedAt *time.Time `json:"publishedAt"` -} - -func (req PpidDataFilesUpdateRequest) ToEntity() *entity.PpidDataFiles { - return &entity.PpidDataFiles{ - ID: req.ID, - Title: req.Title, - PpidDataId: req.PpidDataId, - FileType: req.FileType, - FilePath: req.FilePath, - CreatedById: req.CreatedById, - StatusId: req.StatusId, - IsPublish: req.IsPublish, - PublishedAt: req.PublishedAt, - UpdatedAt: time.Now(), - } -} - -type PpidDataFilesUpdatePositionPayload struct { - Positions []PpidDataFilesUpdatePositionRequest `json:"positions"` -} - -type PpidDataFilesUpdatePositionRequest struct { - ID uint `json:"id" validate:"required"` - Position int `json:"position" validate:"required"` -} - -func (req PpidDataFilesUpdatePositionRequest) ToEntity() *entity.PpidDataFiles { - return &entity.PpidDataFiles{ - ID: req.ID, - Position: &req.Position, - UpdatedAt: time.Now(), - } -} - -type PpidDataFilesQueryRequestContext struct { - Title string `json:"title"` - PpidDataId string `json:"ppidDataId"` - Description string `json:"description"` - Unit string `json:"unit"` - FileType string `json:"fileType"` - Position string `json:"position"` - StatusId string `json:"statusId"` - IsPublish string `json:"isPublish"` -} - -func (req PpidDataFilesQueryRequestContext) ToParamRequest() PpidDataFilesQueryRequest { - var request PpidDataFilesQueryRequest - - if title := req.Title; title != "" { - request.Title = &title - } - if ppidDataIdStr := req.PpidDataId; ppidDataIdStr != "" { - ppidDataId, err := strconv.Atoi(ppidDataIdStr) - if err == nil { - request.PpidDataId = &ppidDataId - } - } - if description := req.Description; description != "" { - request.Title = &description - } - if unit := req.Unit; unit != "" { - request.Unit = &unit - } - if fileType := req.FileType; fileType != "" { - request.FileType = &fileType - } - if positionStr := req.Position; positionStr != "" { - position, err := strconv.Atoi(positionStr) - if err == nil { - request.Position = &position - } - } - if statusIdStr := req.StatusId; statusIdStr != "" { - statusId, err := strconv.Atoi(statusIdStr) - if err == nil { - request.StatusId = &statusId - } - } - if isPublishStr := req.IsPublish; isPublishStr != "" { - isPublish, err := strconv.ParseBool(isPublishStr) - if err == nil { - request.IsPublish = &isPublish - } - } - - return request -} diff --git a/app/module/ppid_data_files/response/ppid_data_files.response.go b/app/module/ppid_data_files/response/ppid_data_files.response.go deleted file mode 100644 index a3f8ded..0000000 --- a/app/module/ppid_data_files/response/ppid_data_files.response.go +++ /dev/null @@ -1,22 +0,0 @@ -package response - -import "time" - -type PpidDataFilesResponse struct { - ID uint `json:"id"` - Title *string `json:"title"` - Type *string `json:"type"` - PpidDataId int `json:"ppidDataId"` - FileName *string `json:"fileName"` - FileType *string `json:"fileType"` - FileUrl *string `json:"fileUrl"` - DownloadCount *int `json:"downloadCount"` - CreatedById *int `json:"createdById"` - Position *int `json:"position"` - StatusId *int `json:"statusId"` - IsPublish *bool `json:"isPublish"` - PublishedAt *time.Time `json:"publishedAt"` - IsActive *bool `json:"isActive"` - CreatedAt time.Time `json:"createdAt"` - UpdatedAt time.Time `json:"updatedAt"` -} diff --git a/app/module/ppid_data_files/service/ppid_data_files.service.go b/app/module/ppid_data_files/service/ppid_data_files.service.go deleted file mode 100644 index 7c32d18..0000000 --- a/app/module/ppid_data_files/service/ppid_data_files.service.go +++ /dev/null @@ -1,327 +0,0 @@ -package service - -import ( - "context" - "github.com/gofiber/fiber/v2" - "github.com/minio/minio-go/v7" - "github.com/rs/zerolog" - "go-humas-be/app/database/entity" - "go-humas-be/app/module/ppid_data_files/mapper" - "go-humas-be/app/module/ppid_data_files/repository" - "go-humas-be/app/module/ppid_data_files/request" - "go-humas-be/app/module/ppid_data_files/response" - config "go-humas-be/config/config" - "go-humas-be/utils/paginator" - "io" - "log" - "math/rand" - "mime" - "path/filepath" - "strconv" - "strings" - "time" -) - -// PpidDataFilesService -type ppidDataFilesService struct { - Repo repository.PpidDataFilesRepository - Log zerolog.Logger - MinioStorage *config.MinioStorage - Cfg *config.Config -} - -// PpidDataFilesService define interface of IPpidDataFilesService -type PpidDataFilesService interface { - All(req request.PpidDataFilesQueryRequest) (ppidDataFiles []*response.PpidDataFilesResponse, paging paginator.Pagination, err error) - Show(id uint) (ppidDataFiles *response.PpidDataFilesResponse, err error) - Save(c *fiber.Ctx) error - Update(id uint, req request.PpidDataFilesUpdateRequest) (err error) - UpdatePosition(req []request.PpidDataFilesUpdatePositionRequest) (err error) - Delete(id uint) error - Viewer(c *fiber.Ctx, filename string) error -} - -// NewPpidDataFilesService init PpidDataFilesService -func NewPpidDataFilesService(repo repository.PpidDataFilesRepository, log zerolog.Logger, minioStorage *config.MinioStorage, cfg *config.Config) PpidDataFilesService { - - return &ppidDataFilesService{ - Repo: repo, - Log: log, - MinioStorage: minioStorage, - Cfg: cfg, - } -} - -// All implement interface of PpidDataFilesService -func (_i *ppidDataFilesService) All(req request.PpidDataFilesQueryRequest) (ppidDataFiless []*response.PpidDataFilesResponse, paging paginator.Pagination, err error) { - results, paging, err := _i.Repo.GetAll(req) - if err != nil { - return - } - - for _, result := range results { - ppidDataFiless = append(ppidDataFiless, mapper.PpidDataFilesResponseMapper(result)) - } - - return -} - -func (_i *ppidDataFilesService) Show(id uint) (ppidDataFiles *response.PpidDataFilesResponse, err error) { - result, err := _i.Repo.FindOne(id) - if err != nil { - return nil, err - } - - return mapper.PpidDataFilesResponseMapper(result), nil -} - -func (_i *ppidDataFilesService) Save(c *fiber.Ctx) (err error) { - - id, err := strconv.ParseUint(c.Params("ppidDataId"), 10, 0) - if err != nil { - return err - } - - host := _i.Cfg.App.Domain - port := _i.Cfg.App.ExternalPort - - form, err := c.MultipartForm() - - _i.Log.Info().Str("timestamp", time.Now(). - Format(time.RFC3339)).Str("Service", "Save"). - Interface("form", form).Msg("") - - titlesString := form.Value["titles"] - titles := strings.Split(titlesString[0], ",") - typesString := form.Value["types"] - types := strings.Split(typesString[0], ",") - positionsString := form.Value["positions"] - positions := strings.Split(positionsString[0], ",") - var urls []string - urlsString := form.Value["urls"] - if urlsString != nil { - urls = strings.Split(urlsString[0], ",") - } - files := form.File["files"] - - _i.Log.Info().Str("timestamp", time.Now(). - Format(time.RFC3339)).Str("Service", "Save"). - Interface("titlesString", titlesString).Msg("") - _i.Log.Info().Str("timestamp", time.Now(). - Format(time.RFC3339)).Str("Service", "Save"). - Interface("typesString", typesString).Msg("") - _i.Log.Info().Str("timestamp", time.Now(). - Format(time.RFC3339)).Str("Service", "Save"). - Interface("positionsString", positionsString).Msg("") - _i.Log.Info().Str("timestamp", time.Now(). - Format(time.RFC3339)).Str("Service", "Save"). - Interface("urlsString", urlsString).Msg("") - _i.Log.Info().Str("timestamp", time.Now(). - Format(time.RFC3339)).Str("Service", "Save"). - Interface("urls", urls).Msg("") - - fileCounter := 0 - urlCounter := 0 - - _i.Log.Info().Str("timestamp", time.Now(). - Format(time.RFC3339)).Str("Service", "Save"). - Interface("form", files).Msg("") - - for index, fileType := range types { - - _i.Log.Info().Str("timestamp", time.Now(). - Format(time.RFC3339)).Str("Service", "Save"). - Interface("types", fileType).Msg("") - - position := &positions[index] - positionInt64, err := strconv.ParseInt(*position, 10, 0) - if err != nil { - return err - } - positionInt := int(positionInt64) - statusId := 1 - title := titles[index] - req := request.PpidDataFilesCreateRequest{ - Title: &title, - PpidDataId: int(id), - Type: &fileType, - Position: &positionInt, - StatusId: &statusId, - } - - _i.Log.Info().Str("timestamp", time.Now(). - Format(time.RFC3339)).Str("Service", "Save"). - Interface("request", req).Msg("") - - if fileType == "url" { - url := urls[urlCounter] - //filename := path.Base(url) - //filenameWithoutExt := filepath.Clean(filename[:len(filename)-len(filepath.Ext(filename))]) - //extension := filepath.Ext(filename)[1:] - //title := strings.ReplaceAll(filenameWithoutExt, "-", " ") - - //req.Title = &title - //req.FileType = &extension - req.FileName = &title - req.FileUrl = &url - - urlCounter += 1 - } else { - bucketName := _i.MinioStorage.Cfg.ObjectStorage.MinioStorage.BucketName - - // Create minio connection. - minioClient, err := _i.MinioStorage.ConnectMinio() - if err != nil { - // Return status 500 and minio connection error. - return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{ - "error": true, - "msg": err.Error(), - }) - } - - // Iterasi semua file yang diunggah - file := files[fileCounter] - - _i.Log.Info().Str("timestamp", time.Now(). - Format(time.RFC3339)).Str("Service:Resource", "Uploader:: loop1"). - Interface("data", file).Msg("") - - src, err := file.Open() - if err != nil { - return err - } - defer src.Close() - - filename := filepath.Base(file.Filename) - filename = strings.ReplaceAll(filename, " ", "") - filenameWithoutExt := filepath.Clean(filename[:len(filename)-len(filepath.Ext(filename))]) - extension := filepath.Ext(file.Filename)[1:] - - rand.New(rand.NewSource(time.Now().UnixNano())) - randUniqueId := rand.Intn(1000000) - - newFilenameWithoutExt := filenameWithoutExt + "_" + strconv.Itoa(randUniqueId) - newFilename := newFilenameWithoutExt + "." + extension - objectName := "ppid/upload/" + newFilename - - size := strconv.FormatInt(file.Size, 10) - viewerPath := "/ppid-data-files/viewer/" - fileUrl := host + port + viewerPath + newFilename - - //req.Title = &newFilenameWithoutExt - req.FileType = &extension - req.FileName = &newFilename - req.FilePath = &objectName - req.FileUrl = &fileUrl - req.Size = &size - - // Upload file to MinIO - _, err = minioClient.PutObject(context.Background(), bucketName, objectName, src, file.Size, minio.PutObjectOptions{}) - if err != nil { - return err - } - - fileCounter += 1 - } - - err = _i.Repo.Create(req.ToEntity()) - if err != nil { - return err - } - } - - _i.Log.Info().Str("timestamp", time.Now(). - Format(time.RFC3339)).Str("Service:Resource", "User:All"). - Interface("data", "Successfully uploaded").Msg("") - - return -} - -func (_i *ppidDataFilesService) Update(id uint, req request.PpidDataFilesUpdateRequest) (err error) { - _i.Log.Info().Interface("data", req).Msg("") - return _i.Repo.Update(id, req.ToEntity()) -} - -func (_i *ppidDataFilesService) UpdatePosition(req []request.PpidDataFilesUpdatePositionRequest) (err error) { - _i.Log.Info().Interface("data", req).Msg("") - - var entityReq []*entity.PpidDataFiles - for _, reqItem := range req { - entityReq = append(entityReq, reqItem.ToEntity()) - } - - return _i.Repo.UpdateAll(entityReq) -} - -func (_i *ppidDataFilesService) 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) -} - -func (_i *ppidDataFilesService) Viewer(c *fiber.Ctx, filename string) (err error) { - result, err := _i.Repo.FindByFilename(filename) - if err != nil { - return err - } - - if result.FilePath == nil { - return nil - } - - ctx := context.Background() - bucketName := _i.MinioStorage.Cfg.ObjectStorage.MinioStorage.BucketName - objectName := result.FilePath - - _i.Log.Info().Str("timestamp", time.Now(). - Format(time.RFC3339)).Str("Service:Resource", "Article:Uploads"). - Interface("data", objectName).Msg("") - - // Create minio connection. - minioClient, err := _i.MinioStorage.ConnectMinio() - if err != nil { - // Return status 500 and minio connection error. - return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{ - "error": true, - "msg": err.Error(), - }) - } - - fileContent, err := minioClient.GetObject(ctx, bucketName, *objectName, minio.GetObjectOptions{}) - if err != nil { - log.Fatalln(err) - } - defer fileContent.Close() - - // Tentukan Content-Type berdasarkan ekstensi file - contentType := mime.TypeByExtension("." + getFileExtension(*objectName)) - if contentType == "" { - contentType = "application/octet-stream" // fallback jika tidak ada tipe MIME yang cocok - } - - c.Set("Content-Type", contentType) - - if _, err := io.Copy(c.Response().BodyWriter(), fileContent); err != nil { - return err - } - - return -} - -func getFileExtension(filename string) string { - // split file name - parts := strings.Split(filename, ".") - - // jika tidak ada ekstensi, kembalikan string kosong - if len(parts) == 1 || (len(parts) == 2 && parts[0] == "") { - return "" - } - - // ambil ekstensi terakhir - return parts[len(parts)-1] -} diff --git a/app/module/ppid_datas/controller/controller.go b/app/module/ppid_datas/controller/controller.go deleted file mode 100644 index 4479ed2..0000000 --- a/app/module/ppid_datas/controller/controller.go +++ /dev/null @@ -1,13 +0,0 @@ -package controller - -import "go-humas-be/app/module/ppid_datas/service" - -type Controller struct { - PpidDatas PpidDatasController -} - -func NewController(PpidDatasService service.PpidDatasService) *Controller { - return &Controller{ - PpidDatas: NewPpidDatasController(PpidDatasService), - } -} \ No newline at end of file diff --git a/app/module/ppid_datas/controller/ppid_datas.controller.go b/app/module/ppid_datas/controller/ppid_datas.controller.go deleted file mode 100644 index 5e05ca6..0000000 --- a/app/module/ppid_datas/controller/ppid_datas.controller.go +++ /dev/null @@ -1,262 +0,0 @@ -package controller - -import ( - "github.com/gofiber/fiber/v2" - "github.com/rs/zerolog" - "go-humas-be/app/module/ppid_datas/request" - "go-humas-be/app/module/ppid_datas/service" - "go-humas-be/utils/paginator" - "strconv" - - requestPpidApproval "go-humas-be/app/module/ppid_data_approval_histories/request" - utilRes "go-humas-be/utils/response" - utilVal "go-humas-be/utils/validator" -) - -type ppidDatasController struct { - ppidDatasService service.PpidDatasService - log zerolog.Logger -} - -type PpidDatasController interface { - All(c *fiber.Ctx) error - Show(c *fiber.Ctx) error - Save(c *fiber.Ctx) error - Update(c *fiber.Ctx) error - UpdatePosition(c *fiber.Ctx) error - UpdateApprovalStatus(c *fiber.Ctx) error - Delete(c *fiber.Ctx) error -} - -func NewPpidDatasController(ppidDatasService service.PpidDatasService) PpidDatasController { - return &ppidDatasController{ - ppidDatasService: ppidDatasService, - } -} - -// All PpidDatas -// @Summary Get all PpidDatas -// @Description API for getting all PpidDatas -// @Tags PPID Data -// @Security Bearer -// @Param Authorization header string false "Insert your access token" default(Bearer ) -// @Param req query request.PpidDatasQueryRequest 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 /ppid-datas [get] -func (_i *ppidDatasController) All(c *fiber.Ctx) error { - paginate, err := paginator.Paginate(c) - if err != nil { - return err - } - - authToken := c.Get("Authorization") - - reqContext := request.PpidDatasQueryRequestContext{ - Title: c.Query("title"), - Description: c.Query("description"), - CategoryId: c.Query("categoryId"), - UserId: c.Query("userId"), - UserRoleId: c.Query("userRoleId"), - UserLevelId: c.Query("userLevelId"), - Group: c.Query("group"), - LevelGroupId: c.Query("levelGroupId"), - StatusId: c.Query("statusId"), - IsPublish: c.Query("isPublish"), - } - - req := reqContext.ToParamRequest() - req.Pagination = paginate - - ppidDatasData, paging, err := _i.ppidDatasService.All(req, &authToken) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"PpidDatas list successfully retrieved"}, - Data: ppidDatasData, - Meta: paging, - }) -} - -// Show PpidDatas -// @Summary Get one PpidDatas -// @Description API for getting one PpidDatas -// @Tags PPID Data -// @Security Bearer -// @Param id path string true "PpidDatas [ ID / Slug ]" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /ppid-datas/{id} [get] -func (_i *ppidDatasController) Show(c *fiber.Ctx) error { - id := c.Params("id") - ppidDatasData, err := _i.ppidDatasService.Show(id) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"PpidDatas successfully retrieved"}, - Data: ppidDatasData, - }) -} - -// Save PpidDatas -// @Summary Create PpidDatas -// @Description API for create PpidDatas -// @Tags PPID Data -// @Security Bearer -// @Param Authorization header string true "Insert your access token" default (Bearer ) -// @Param payload body request.PpidDatasCreateRequest true "Required payload" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /ppid-datas [post] -func (_i *ppidDatasController) Save(c *fiber.Ctx) error { - req := new(request.PpidDatasCreateRequest) - if err := utilVal.ParseAndValidate(c, req); err != nil { - return err - } - - authToken := c.Get("Authorization") - dataResult, err := _i.ppidDatasService.Save(*req, authToken) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"PpidDatas successfully created"}, - Data: dataResult, - }) -} - -// Update PpidDatas -// @Summary update PpidDatas -// @Description API for update PpidDatas -// @Tags PPID Data -// @Security Bearer -// @Param payload body request.PpidDatasCreateRequest true "Required payload" -// @Param id path int true "PpidDatas ID" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /ppid-datas/{id} [put] -func (_i *ppidDatasController) Update(c *fiber.Ctx) error { - id, err := strconv.ParseUint(c.Params("id"), 10, 0) - if err != nil { - return err - } - - req := new(request.PpidDatasUpdateRequest) - if err := utilVal.ParseAndValidate(c, req); err != nil { - return err - } - - err = _i.ppidDatasService.Update(uint(id), *req) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"PpidDatas successfully updated"}, - }) -} - -// UpdateApprovalStatus PpidDatas -// @Summary UpdateApprovalStatus PpidDatas -// @Description API for UpdateApprovalStatus PpidDatas -// @Tags PPID Data -// @Security Bearer -// @Param Authorization header string true "Insert your access token" default(Bearer ) -// @Param payload body requestPpidApproval.PpidDataApprovalHistoriesCreateRequest true "Required payload" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /ppid-datas/approval [post] -func (_i *ppidDatasController) UpdateApprovalStatus(c *fiber.Ctx) error { - req := new(requestPpidApproval.PpidDataApprovalHistoriesCreateRequest) - - if err := utilVal.ParseAndValidate(c, req); err != nil { - return err - } - - authToken := c.Get("Authorization") - err := _i.ppidDatasService.UpdateApprovalStatus(*req, authToken) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"PpidDatas successfully updated"}, - }) -} - -// UpdatePosition PpidDatas -// @Summary UpdatePosition PpidDatas -// @Description API for Update Position PpidDatas -// @Tags PPID Data -// @Security Bearer -// @Param payload body request.PpidDatasUpdatePositionPayload true "Required payload" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /ppid-datas/position [post] -func (_i *ppidDatasController) UpdatePosition(c *fiber.Ctx) error { - req := new(request.PpidDatasUpdatePositionPayload) - if err := utilVal.ParseAndValidate(c, req); err != nil { - return err - } - - err := _i.ppidDatasService.UpdatePosition(req.Positions) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"PpidDataCategories successfully updated"}, - }) -} - -// Delete PpidDatas -// @Summary delete PpidDatas -// @Description API for delete PpidDatas -// @Tags PPID Data -// @Security Bearer -// @Param id path int true "PpidDatas ID" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /ppid-datas/{id} [delete] -func (_i *ppidDatasController) Delete(c *fiber.Ctx) error { - id, err := strconv.ParseUint(c.Params("id"), 10, 0) - if err != nil { - return err - } - - err = _i.ppidDatasService.Delete(uint(id)) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"PpidDatas successfully deleted"}, - }) -} diff --git a/app/module/ppid_datas/mapper/ppid_datas.mapper.go b/app/module/ppid_datas/mapper/ppid_datas.mapper.go deleted file mode 100644 index ee87c7e..0000000 --- a/app/module/ppid_datas/mapper/ppid_datas.mapper.go +++ /dev/null @@ -1,83 +0,0 @@ -package mapper - -import ( - "github.com/rs/zerolog" - "go-humas-be/app/database/entity" - ppidDataCategoriesRepository "go-humas-be/app/module/ppid_data_categories/repository" - ppidDataFilesMapper "go-humas-be/app/module/ppid_data_files/mapper" - ppidDataFilesRepository "go-humas-be/app/module/ppid_data_files/repository" - ppidDataFilesResponse "go-humas-be/app/module/ppid_data_files/response" - res "go-humas-be/app/module/ppid_datas/response" - usersRepository "go-humas-be/app/module/users/repository" - "time" -) - -func PpidDatasResponseMapper( - log zerolog.Logger, - ppidDataCategoriesRepo ppidDataCategoriesRepository.PpidDataCategoriesRepository, - ppidDataFilesRepo ppidDataFilesRepository.PpidDataFilesRepository, - usersRepo usersRepository.UsersRepository, - ppidDatasReq *entity.PpidDatas, -) (ppidDatasRes *res.PpidDatasResponse) { - if ppidDatasReq == nil { - return nil - } - - //log.Info().Str("timestamp", time.Now(). - // Format(time.RFC3339)).Str("Service:PpidDatasResponseMapper", "PpidData:Category"). - // Interface("Category", ppidDatasReq.Category).Msg("") - - log.Info().Str("timestamp", time.Now(). - Format(time.RFC3339)).Str("Service:PpidDatasResponseMapper", "PpidData:Category"). - Interface("CreatedBy", ppidDatasReq.CreatedBy).Msg("") - - categoryName := "" - if ppidDatasReq.Category.ID != 0 { - categoryName = ppidDatasReq.Category.Title - } - - findUser, err := usersRepo.FindOne(*ppidDatasReq.CreatedById) - if err != nil { - log.Error().Err(err).Msg("Error fetching user") - return nil - } - createdByName := "" - if findUser != nil { - createdByName = findUser.Fullname - } - - ppidDataFiles, err := ppidDataFilesRepo.FindByPpidData(ppidDatasReq.ID) - if err != nil { - log.Error().Err(err).Msg("Error fetching files") - return nil - } - - var ppidDataFilesArr []*ppidDataFilesResponse.PpidDataFilesResponse - if len(ppidDataFiles) > 0 { - for _, result := range ppidDataFiles { - ppidDataFilesArr = append(ppidDataFilesArr, ppidDataFilesMapper.PpidDataFilesResponseMapper(result)) - } - } - - ppidDatasRes = &res.PpidDatasResponse{ - ID: ppidDatasReq.ID, - Title: ppidDatasReq.Title, - Description: ppidDatasReq.Description, - Slug: ppidDatasReq.Slug, - CategoryId: ppidDatasReq.CategoryId, - CategoryName: &categoryName, - CreatedById: ppidDatasReq.CreatedById, - CreatedByName: &createdByName, - Position: ppidDatasReq.Position, - StatusId: ppidDatasReq.StatusId, - IsPublish: ppidDatasReq.IsPublish, - PublishedAt: ppidDatasReq.PublishedAt, - IsActive: ppidDatasReq.IsActive, - CreatedAt: ppidDatasReq.CreatedAt, - UpdatedAt: ppidDatasReq.UpdatedAt, - - PpidDataFiles: ppidDataFilesArr, - } - - return ppidDatasRes -} diff --git a/app/module/ppid_datas/ppid_datas.module.go b/app/module/ppid_datas/ppid_datas.module.go deleted file mode 100644 index f11611e..0000000 --- a/app/module/ppid_datas/ppid_datas.module.go +++ /dev/null @@ -1,55 +0,0 @@ -package ppid_datas - -import ( - "github.com/gofiber/fiber/v2" - "go-humas-be/app/module/ppid_datas/controller" - "go-humas-be/app/module/ppid_datas/repository" - "go-humas-be/app/module/ppid_datas/service" - "go.uber.org/fx" -) - -// struct of PpidDatasRouter -type PpidDatasRouter struct { - App fiber.Router - Controller *controller.Controller -} - -// register bulky of PpidDatas module -var NewPpidDatasModule = fx.Options( - // register repository of PpidDatas module - fx.Provide(repository.NewPpidDatasRepository), - - // register service of PpidDatas module - fx.Provide(service.NewPpidDatasService), - - // register controller of PpidDatas module - fx.Provide(controller.NewController), - - // register router of PpidDatas module - fx.Provide(NewPpidDatasRouter), -) - -// init PpidDatasRouter -func NewPpidDatasRouter(fiber *fiber.App, controller *controller.Controller) *PpidDatasRouter { - return &PpidDatasRouter{ - App: fiber, - Controller: controller, - } -} - -// register routes of PpidDatas module -func (_i *PpidDatasRouter) RegisterPpidDatasRoutes() { - // define controllers - ppidDatasController := _i.Controller.PpidDatas - - // define routes - _i.App.Route("/ppid-datas", func(router fiber.Router) { - router.Get("/", ppidDatasController.All) - router.Get("/:id", ppidDatasController.Show) - router.Post("/", ppidDatasController.Save) - router.Put("/:id", ppidDatasController.Update) - router.Post("/position", ppidDatasController.UpdatePosition) - router.Post("/approval", ppidDatasController.UpdateApprovalStatus) - router.Delete("/:id", ppidDatasController.Delete) - }) -} diff --git a/app/module/ppid_datas/repository/ppid_datas.repository.go b/app/module/ppid_datas/repository/ppid_datas.repository.go deleted file mode 100644 index f0f8e33..0000000 --- a/app/module/ppid_datas/repository/ppid_datas.repository.go +++ /dev/null @@ -1,165 +0,0 @@ -package repository - -import ( - "fmt" - "github.com/rs/zerolog" - "go-humas-be/app/database" - "go-humas-be/app/database/entity" - "go-humas-be/app/module/ppid_datas/request" - "go-humas-be/utils/paginator" - "strconv" - "strings" - "time" -) - -type ppidDatasRepository struct { - DB *database.Database - Log zerolog.Logger -} - -// PpidDatasRepository define interface of IPpidDatasRepository -type PpidDatasRepository interface { - GetAll(req request.PpidDatasQueryRequest) (ppidDatass []*entity.PpidDatas, paging paginator.Pagination, err error) - FindOne(id uint) (ppidDatas *entity.PpidDatas, err error) - FindOneUsingSlug(slug string) (ppidDatas *entity.PpidDatas, err error) - FindOneLastPosition() (ppidDatas *entity.PpidDatas, err error) - Create(ppidDatas *entity.PpidDatas) (ppidDataReturn *entity.PpidDatas, err error) - Update(id uint, ppidDatas *entity.PpidDatas) (err error) - UpdateAll(ppidDatas []*entity.PpidDatas) (err error) - Delete(id uint) (err error) -} - -func NewPpidDatasRepository(db *database.Database, logger zerolog.Logger) PpidDatasRepository { - return &ppidDatasRepository{ - DB: db, - Log: logger, - } -} - -// implement interface of IPpidDatasRepository -func (_i *ppidDatasRepository) GetAll(req request.PpidDatasQueryRequest) (ppidDatass []*entity.PpidDatas, paging paginator.Pagination, err error) { - var count int64 - - query := _i.DB.DB.Model(&entity.PpidDatas{}).Preload("CreatedBy").Preload("Category").Preload("LevelGroup") - query = query.Where("is_active = ?", true) - - if req.Title != nil && *req.Title != "" { - title := strings.ToLower(*req.Title) - query = query.Where("LOWER(title) LIKE ?", "%"+strings.ToLower(title)+"%") - } - if req.Description != nil && *req.Description != "" { - description := strings.ToLower(*req.Description) - query = query.Where("LOWER(description) LIKE ?", "%"+strings.ToLower(description)+"%") - } - if req.CategoryId != nil { - query = query.Where("category_id = ?", req.CategoryId) - } - if req.LevelGroupId != nil { - query = query.Where("level_group_id = ?", req.LevelGroupId) - } - if req.LevelGroupId != nil { - query = query.Where("level_group_id = ?", req.LevelGroupId) - } - if req.IsPublish != nil { - query = query.Where("is_publish = ?", req.IsPublish) - } - if req.StatusId != nil { - query = query.Where("status_id = ?", req.StatusId) - } - if req.UserId != nil { - userRoleIdStr := strconv.Itoa(int(*req.UserRoleId)) - userLevelIdStr := strconv.Itoa(int(*req.UserLevelId)) - query = query. - Where("created_by_id = ?", req.UserId). - Or("need_approval_from_user_role LIKE ?", ":"+userRoleIdStr+":"). - Or("need_approval_from_user_level LIKE ?", userLevelIdStr). - Or("back_approval_to_user_role = ?", userRoleIdStr). - Or("back_approval_to_user_level = ?", userLevelIdStr) - } - query.Count(&count) - - //_i.Log.Info().Str("timestamp", time.Now(). - // Format(time.RFC3339)).Str("ppidDatasRepository:GetAll", "PpidData:CreatedBy"). - // Interface("Query", query.ToSQL).Msg("") - - 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) - - if req.Pagination.Limit != -1 { - query.Limit(req.Pagination.Limit) - } - - err = query.Offset(req.Pagination.Offset).Find(&ppidDatass).Error - if err != nil { - return - } - - paging = *req.Pagination - - return -} - -func (_i *ppidDatasRepository) FindOne(id uint) (ppidDatas *entity.PpidDatas, err error) { - if err := _i.DB.DB.First(&ppidDatas, id).Error; err != nil { - return nil, err - } - - return ppidDatas, nil -} - -func (_i *ppidDatasRepository) FindOneUsingSlug(slug string) (ppidDatas *entity.PpidDatas, err error) { - if err := _i.DB.DB.Where("slug = ?", slug).First(&ppidDatas).Error; err != nil { - return nil, err - } - - return ppidDatas, nil -} - -func (_i *ppidDatasRepository) FindOneLastPosition() (ppidDatas *entity.PpidDatas, err error) { - if err := _i.DB.DB.Where("position IS NOT NULL").Last(&ppidDatas). - Order(fmt.Sprintf("%s %s", "position", "DESC")).Error; err != nil { - return nil, err - } - - return ppidDatas, nil -} - -func (_i *ppidDatasRepository) Create(ppidDatas *entity.PpidDatas) (ppidDataReturn *entity.PpidDatas, err error) { - result := _i.DB.DB.Create(ppidDatas) - - _i.Log.Info().Str("timestamp", time.Now(). - Format(time.RFC3339)).Str("Service:Create", "PpidData:Create"). - Interface("result", ppidDatas).Msg("") - - return ppidDatas, result.Error -} - -func (_i *ppidDatasRepository) Update(id uint, ppidDatas *entity.PpidDatas) (err error) { - return _i.DB.DB.Model(&entity.PpidDatas{}). - Where(&entity.PpidDatas{ID: id}). - Updates(ppidDatas).Error -} - -func (_i *ppidDatasRepository) UpdateAll(ppidDatas []*entity.PpidDatas) (err error) { - for _, req := range ppidDatas { - err := _i.DB.DB.Model(&entity.PpidDatas{}). - Where(&entity.PpidDatas{ID: req.ID}). - Updates(req).Error - if err != nil { - return err - } - } - return nil -} - -func (_i *ppidDatasRepository) Delete(id uint) error { - return _i.DB.DB.Delete(&entity.PpidDatas{}, id).Error -} diff --git a/app/module/ppid_datas/request/ppid_datas.request.go b/app/module/ppid_datas/request/ppid_datas.request.go deleted file mode 100644 index 5d290fc..0000000 --- a/app/module/ppid_datas/request/ppid_datas.request.go +++ /dev/null @@ -1,179 +0,0 @@ -package request - -import ( - "go-humas-be/app/database/entity" - "go-humas-be/utils/paginator" - "strconv" - "time" -) - -type PpidDatasGeneric interface { - ToEntity() -} - -type PpidDatasQueryRequest struct { - Title *string `json:"title"` - Description *string `json:"description"` - CategoryId *uint `json:"categoryId"` - LevelGroupId *int `json:"levelGroupId"` - Group *string `json:"group"` - UserId *uint `json:"userId"` - UserRoleId *uint `json:"userRoleId"` - UserLevelId *uint `json:"userLevelId"` - StatusId *int `json:"statusId"` - IsPublish *bool `json:"isPublish"` - Pagination *paginator.Pagination `json:"pagination"` -} - -type PpidDatasCreateRequest struct { - Title string `json:"title" validate:"required"` - Description string `json:"description" validate:"required"` - Slug string `json:"slug" validate:"required"` - CategoryId uint `json:"categoryId" validate:"required"` - StatusId int `json:"statusId" validate:"required"` - LevelGroupId *uint `json:"levelGroupId"` - Group *string `json:"group"` -} - -func (req PpidDatasCreateRequest) ToEntity() *entity.PpidDatas { - return &entity.PpidDatas{ - Title: req.Title, - Description: req.Description, - Slug: req.Slug, - CategoryId: req.CategoryId, - StatusId: req.StatusId, - LevelGroupId: req.LevelGroupId, - Group: req.Group, - } -} - -type PpidDatasUpdateRequest struct { - ID uint `json:"id" validate:"required"` - Title string `json:"title" validate:"required"` - Description string `json:"description" validate:"required"` - Slug string `json:"slug" validate:"required"` - CategoryId uint `json:"categoryId" validate:"required"` - StatusId int `json:"statusId" validate:"required"` - NeedApprovalFromUserRole *string `json:"needApprovalFrom"` - NeedApprovalFromUserLevel *string `json:"needApprovalFromUserLevel"` - BackApprovalToUserRole *string `json:"backApprovalToUserRole"` - BackApprovalToUserLevel *string `json:"backApprovalToUserLevel"` - IsPublish *bool `json:"isPublish"` - PublishLevel *int `json:"publishLevel"` - PublishedAt *time.Time `json:"publishedAt"` - LevelGroupId *uint `json:"levelGroupId"` - Group *string `json:"group"` -} - -func (req PpidDatasUpdateRequest) ToEntity() *entity.PpidDatas { - return &entity.PpidDatas{ - ID: req.ID, - Title: req.Title, - Description: req.Description, - Slug: req.Slug, - CategoryId: req.CategoryId, - StatusId: req.StatusId, - NeedApprovalFromUserRole: req.NeedApprovalFromUserRole, - NeedApprovalFromUserLevel: req.NeedApprovalFromUserLevel, - BackApprovalToUserRole: req.BackApprovalToUserRole, - BackApprovalToUserLevel: req.BackApprovalToUserLevel, - IsPublish: req.IsPublish, - PublishedAt: req.PublishedAt, - LevelGroupId: req.LevelGroupId, - Group: req.Group, - UpdatedAt: time.Now(), - } -} - -type PpidDatasUpdatePositionPayload struct { - Positions []PpidDatasUpdatePositionRequest `json:"positions"` -} - -type PpidDatasUpdatePositionRequest struct { - ID uint `json:"id" validate:"required"` - Position int `json:"position" validate:"required"` -} - -func (req PpidDatasUpdatePositionRequest) ToEntity() *entity.PpidDatas { - return &entity.PpidDatas{ - ID: req.ID, - Position: &req.Position, - UpdatedAt: time.Now(), - } -} - -type PpidDatasQueryRequestContext struct { - Title string `json:"title"` - Description string `json:"description"` - CategoryId string `json:"categoryId"` - LevelGroupId string `json:"levelGroupId"` - Group string `json:"group"` - CreatedById string `json:"createdById"` - UserId string `json:"userId"` - UserRoleId string `json:"userRoleId"` - UserLevelId string `json:"userLevelId"` - StatusId string `json:"statusId"` - IsPublish string `json:"isPublish"` -} - -func (req PpidDatasQueryRequestContext) ToParamRequest() PpidDatasQueryRequest { - var request PpidDatasQueryRequest - - if title := req.Title; title != "" { - request.Title = &title - } - if description := req.Description; description != "" { - request.Description = &description - } - if levelGroupIdStr := req.LevelGroupId; levelGroupIdStr != "" { - levelGroupId, err := strconv.Atoi(levelGroupIdStr) - if err == nil { - request.LevelGroupId = &levelGroupId - } - } - if group := req.Group; group != "" { - request.Group = &group - } - if categoryIdStr := req.CategoryId; categoryIdStr != "" { - categoryId, err := strconv.Atoi(categoryIdStr) - if err == nil { - categoryIdUint := uint(categoryId) - request.CategoryId = &categoryIdUint - } - } - if isPublishStr := req.IsPublish; isPublishStr != "" { - isPublish, err := strconv.ParseBool(isPublishStr) - if err == nil { - request.IsPublish = &isPublish - } - } - if statusIdStr := req.StatusId; statusIdStr != "" { - statusId, err := strconv.Atoi(statusIdStr) - if err == nil { - request.StatusId = &statusId - } - } - if userIdStr := req.UserId; userIdStr != "" { - userId, err := strconv.Atoi(userIdStr) - if err == nil { - userIdUint := uint(userId) - request.UserId = &userIdUint - } - } - if userRoleIdStr := req.UserRoleId; userRoleIdStr != "" { - userRoleId, err := strconv.Atoi(userRoleIdStr) - if err == nil { - userRoleIdUint := uint(userRoleId) - request.UserRoleId = &userRoleIdUint - } - } - if userLevelIdStr := req.UserLevelId; userLevelIdStr != "" { - userLevelId, err := strconv.Atoi(userLevelIdStr) - if err == nil { - userLevelIdUint := uint(userLevelId) - request.UserLevelId = &userLevelIdUint - } - } - - return request -} diff --git a/app/module/ppid_datas/response/ppid_datas.response.go b/app/module/ppid_datas/response/ppid_datas.response.go deleted file mode 100644 index 4c8254f..0000000 --- a/app/module/ppid_datas/response/ppid_datas.response.go +++ /dev/null @@ -1,27 +0,0 @@ -package response - -import ( - ppidDataFilesResponse "go-humas-be/app/module/ppid_data_files/response" - "time" -) - -type PpidDatasResponse struct { - ID uint `json:"id"` - Title string `json:"title"` - Description string `json:"description"` - Slug string `json:"slug"` - CategoryId uint `json:"categoryId"` - CategoryName *string `json:"categoryName"` - CreatedById *uint `json:"createdById"` - CreatedByName *string `json:"createdByName"` - StatusId int `json:"statusId"` - StatusName int `json:"statusName"` - IsPublish *bool `json:"isPublish"` - Position *int `json:"position"` - PublishedAt *time.Time `json:"publishedAt"` - IsActive *bool `json:"isActive"` - CreatedAt time.Time `json:"createdAt"` - UpdatedAt time.Time `json:"updatedAt"` - - PpidDataFiles []*ppidDataFilesResponse.PpidDataFilesResponse `json:"files"` -} diff --git a/app/module/ppid_datas/service/ppid_datas.service.go b/app/module/ppid_datas/service/ppid_datas.service.go deleted file mode 100644 index 5db89c5..0000000 --- a/app/module/ppid_datas/service/ppid_datas.service.go +++ /dev/null @@ -1,234 +0,0 @@ -package service - -import ( - "github.com/rs/zerolog" - "go-humas-be/app/database/entity" - requestPpidApproval "go-humas-be/app/module/ppid_data_approval_histories/request" - ppidDataCategoriesRepository "go-humas-be/app/module/ppid_data_categories/repository" - ppidDataFilesRepository "go-humas-be/app/module/ppid_data_files/repository" - "go-humas-be/app/module/ppid_datas/mapper" - "go-humas-be/app/module/ppid_datas/repository" - "go-humas-be/app/module/ppid_datas/request" - "go-humas-be/app/module/ppid_datas/response" - userLevelsRepository "go-humas-be/app/module/user_levels/repository" - userRoleLevelDetailsRepository "go-humas-be/app/module/user_role_level_details/repository" - usersRepository "go-humas-be/app/module/users/repository" - "go-humas-be/utils/paginator" - utilSvc "go-humas-be/utils/service" - "strconv" - "strings" - "time" -) - -// PpidDatasService -type ppidDatasService struct { - Repo repository.PpidDatasRepository - PpidDataCategoriesRepo ppidDataCategoriesRepository.PpidDataCategoriesRepository - PpidDataFilesRepo ppidDataFilesRepository.PpidDataFilesRepository - UsersRepo usersRepository.UsersRepository - UserLevelsRepo userLevelsRepository.UserLevelsRepository - userRoleLevelDetailsRepo userRoleLevelDetailsRepository.UserRoleLevelDetailsRepository - Log zerolog.Logger -} - -// PpidDatasService define interface of IPpidDatasService -type PpidDatasService interface { - All(req request.PpidDatasQueryRequest, authToken *string) (ppidDatas []*response.PpidDatasResponse, paging paginator.Pagination, err error) - Show(id string) (ppidDatas *response.PpidDatasResponse, err error) - Save(req request.PpidDatasCreateRequest, authToken string) (ppidDatas *entity.PpidDatas, err error) - Update(id uint, req request.PpidDatasUpdateRequest) (err error) - UpdateApprovalStatus(req requestPpidApproval.PpidDataApprovalHistoriesCreateRequest, authToken string) (err error) - UpdatePosition(req []request.PpidDatasUpdatePositionRequest) (err error) - Delete(id uint) error -} - -// NewPpidDatasService init PpidDatasService -func NewPpidDatasService( - repo repository.PpidDatasRepository, - ppidDataCategoriesRepo ppidDataCategoriesRepository.PpidDataCategoriesRepository, - ppidDataFilesRepo ppidDataFilesRepository.PpidDataFilesRepository, - usersRepo usersRepository.UsersRepository, - userLevelsRepo userLevelsRepository.UserLevelsRepository, - userRoleLevelDetailsRepo userRoleLevelDetailsRepository.UserRoleLevelDetailsRepository, - log zerolog.Logger, -) PpidDatasService { - - return &ppidDatasService{ - Repo: repo, - PpidDataCategoriesRepo: ppidDataCategoriesRepo, - PpidDataFilesRepo: ppidDataFilesRepo, - UsersRepo: usersRepo, - UserLevelsRepo: userLevelsRepo, - userRoleLevelDetailsRepo: userRoleLevelDetailsRepo, - Log: log, - } -} - -// All implement interface of PpidDatasService -func (_i *ppidDatasService) All(req request.PpidDatasQueryRequest, authToken *string) (ppidDatass []*response.PpidDatasResponse, paging paginator.Pagination, err error) { - - var user *entity.Users - if authToken != nil && *authToken != "" { - user = utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, *authToken) - req.UserId = &user.ID - req.UserRoleId = &user.UserRoleId - req.UserLevelId = &user.UserLevelId - } - results, paging, err := _i.Repo.GetAll(req) - if err != nil { - return - } - - for _, result := range results { - ppidDatass = append(ppidDatass, mapper.PpidDatasResponseMapper(_i.Log, _i.PpidDataCategoriesRepo, _i.PpidDataFilesRepo, _i.UsersRepo, result)) - } - - return -} - -func (_i *ppidDatasService) Show(id string) (ppidDatas *response.PpidDatasResponse, err error) { - - var result *entity.PpidDatas - - if utilSvc.IsNumeric(id) { - idInt, _ := strconv.Atoi(id) - result, err = _i.Repo.FindOne(uint(idInt)) - if err != nil { - return nil, err - } - } else { - result, err = _i.Repo.FindOneUsingSlug(id) - if err != nil { - return nil, err - } - } - - return mapper.PpidDatasResponseMapper(_i.Log, _i.PpidDataCategoriesRepo, _i.PpidDataFilesRepo, _i.UsersRepo, result), nil -} - -func (_i *ppidDatasService) Save(req request.PpidDatasCreateRequest, authToken string) (ppidDatas *entity.PpidDatas, err error) { - _i.Log.Info().Interface("data", req).Msg("") - newReq := req.ToEntity() - - createdBy := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) - newReq.CreatedById = &createdBy.ID - newReq.LevelGroupId = &createdBy.UserLevelId - - userLevels, err := _i.UserLevelsRepo.FindOne(uint(createdBy.UserLevelId)) - if err != nil { - return nil, err - } - newReq.Group = userLevels.Group - - lastPpidData, _ := _i.Repo.FindOneLastPosition() - lastPosition := lastPpidData.Position - *lastPosition += 1 - newReq.Position = lastPosition - - return _i.Repo.Create(newReq) -} - -func (_i *ppidDatasService) Update(id uint, req request.PpidDatasUpdateRequest) (err error) { - _i.Log.Info().Interface("data", req).Msg("") - return _i.Repo.Update(id, req.ToEntity()) -} - -func (_i *ppidDatasService) UpdatePosition(req []request.PpidDatasUpdatePositionRequest) (err error) { - _i.Log.Info().Interface("data", req).Msg("") - - var entityReq []*entity.PpidDatas - for _, reqItem := range req { - entityReq = append(entityReq, reqItem.ToEntity()) - } - - return _i.Repo.UpdateAll(entityReq) -} - -func (_i *ppidDatasService) UpdateApprovalStatus(req requestPpidApproval.PpidDataApprovalHistoriesCreateRequest, authToken string) (err error) { - _i.Log.Info().Interface("data", req).Msg("") - ppidData, err := _i.Repo.FindOne(req.PpidDataId) - if err != nil { - return err - } - - if req.ApprovalStatusId == 1 { - ppidData.NeedApprovalFromUserRole = nil - ppidData.NeedApprovalFromUserLevel = nil - ppidData.BackApprovalToUserRole = nil - ppidData.BackApprovalToUserLevel = nil - } - - approvalBy := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) - if approvalBy != nil { - approvalByUserLevel, _ := _i.UserLevelsRepo.FindOne(uint(approvalBy.UserLevelId)) - approvalByParentLevel, _ := _i.UserLevelsRepo.FindOne(uint(approvalByUserLevel.ParentLevelId)) - - _i.Log.Info().Interface("== findUserLevel ==", approvalByUserLevel).Msg("") - _i.Log.Info().Interface("== findUserParentLevel ==", approvalByParentLevel).Msg("") - if approvalByUserLevel != nil { - ppidData.ApprovalStatusId = req.ApprovalStatusId - if req.ApprovalStatusId == 1 { - if approvalByUserLevel.LevelNumber == 1 { - isPublish := true - publishLevel := 1 - timeNow := time.Now() - ppidData.IsPublish = &isPublish - ppidData.PublishLevel = &publishLevel - ppidData.PublishedAt = &timeNow - ppidData.ApprovalStatusId = req.ApprovalStatusId - ppidData.NeedApprovalFromUserRole = nil - ppidData.NeedApprovalFromUserLevel = nil - } else if approvalByUserLevel.LevelNumber > 1 { - isPublish := true - publishLevel := 2 - timeNow := time.Now() - ppidData.IsPublish = &isPublish - ppidData.PublishLevel = &publishLevel - ppidData.PublishedAt = &timeNow - - needApprovalFromUserLevel := strconv.FormatUint(uint64(approvalByParentLevel.ID), 10) - ppidData.NeedApprovalFromUserLevel = &needApprovalFromUserLevel - - findUserRoles, _ := _i.userRoleLevelDetailsRepo.FindByUserLevels(approvalByParentLevel.ID) - var needApprovalFromUserRole []string - for _, role := range findUserRoles { - roleId := strconv.FormatUint(uint64(role.UserRoleId), 10) - needApprovalFromUserRole = append(needApprovalFromUserRole, roleId) - } - needApprovalFromUserRoleStr := strings.Join(needApprovalFromUserRole, ":") - *ppidData.NeedApprovalFromUserRole = ":" + needApprovalFromUserRoleStr + ":" - } - } else if req.ApprovalStatusId == 2 { - createdBy, _ := _i.UsersRepo.FindOne(*ppidData.CreatedById) - if createdBy != nil { - backApprovalFromUserRole := strconv.FormatUint(uint64(createdBy.UserRoleId), 10) - ppidData.BackApprovalToUserRole = &backApprovalFromUserRole - - needApprovalFromUserLevel := strconv.FormatUint(uint64(createdBy.UserLevelId), 10) - ppidData.BackApprovalToUserLevel = &needApprovalFromUserLevel - } - } else { - isPublish := false - ppidData.IsPublish = &isPublish - ppidData.PublishLevel = nil - ppidData.PublishedAt = nil - ppidData.ApprovalStatusId = req.ApprovalStatusId - ppidData.NeedApprovalFromUserRole = nil - ppidData.NeedApprovalFromUserLevel = nil - } - } - } - - return _i.Repo.Update(req.PpidDataId, ppidData) -} - -func (_i *ppidDatasService) 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/module/request_for_information_items/controller/controller.go b/app/module/request_for_information_items/controller/controller.go deleted file mode 100644 index e0a2ae5..0000000 --- a/app/module/request_for_information_items/controller/controller.go +++ /dev/null @@ -1,16 +0,0 @@ -package controller - -import ( - "github.com/rs/zerolog" - "go-humas-be/app/module/request_for_information_items/service" -) - -type Controller struct { - RequestForInformationItems RequestForInformationItemsController -} - -func NewController(RequestForInformationItemsService service.RequestForInformationItemsService, log zerolog.Logger) *Controller { - return &Controller{ - RequestForInformationItems: NewRequestForInformationItemsController(RequestForInformationItemsService, log), - } -} diff --git a/app/module/request_for_information_items/controller/request_for_information_items.controller.go b/app/module/request_for_information_items/controller/request_for_information_items.controller.go deleted file mode 100644 index 798779d..0000000 --- a/app/module/request_for_information_items/controller/request_for_information_items.controller.go +++ /dev/null @@ -1,194 +0,0 @@ -package controller - -import ( - "github.com/gofiber/fiber/v2" - "github.com/rs/zerolog" - "go-humas-be/app/module/request_for_information_items/request" - "go-humas-be/app/module/request_for_information_items/service" - "go-humas-be/utils/paginator" - utilRes "go-humas-be/utils/response" - utilVal "go-humas-be/utils/validator" - "strconv" -) - -type requestForInformationItemsController struct { - requestForInformationItemsService service.RequestForInformationItemsService - Log zerolog.Logger -} - -type RequestForInformationItemsController 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 NewRequestForInformationItemsController(requestForInformationItemsService service.RequestForInformationItemsService, log zerolog.Logger) RequestForInformationItemsController { - return &requestForInformationItemsController{ - requestForInformationItemsService: requestForInformationItemsService, - Log: log, - } -} - -// All get all RequestForInformationItems -// @Summary Get all RequestForInformationItems -// @Description API for getting all RequestForInformationItems -// @Tags RequestForInformationItems -// @Security Bearer -// @Param req query request.RequestForInformationItemsQueryRequest 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-items [get] -func (_i *requestForInformationItemsController) All(c *fiber.Ctx) error { - paginate, err := paginator.Paginate(c) - if err != nil { - return err - } - - reqContext := request.RequestForInformationItemsQueryRequestContext{ - RequestForInformationId: c.Query("requestForInformationId"), - RequestedInfo: c.Query("requestedInfo"), - DetailedInfo: c.Query("detailedInfo"), - Reason: c.Query("reason"), - StatusId: c.Query("statusId"), - } - req := reqContext.ToParamRequest() - req.Pagination = paginate - - requestForInformationItemsData, paging, err := _i.requestForInformationItemsService.All(req) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"RequestForInformationItems list successfully retrieved"}, - Data: requestForInformationItemsData, - Meta: paging, - }) -} - -// Show get one RequestForInformationItems -// @Summary Get one RequestForInformationItems -// @Description API for getting one RequestForInformationItems -// @Tags RequestForInformationItems -// @Security Bearer -// @Param id path int true "RequestForInformationItems 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-items/{id} [get] -func (_i *requestForInformationItemsController) Show(c *fiber.Ctx) error { - id, err := strconv.ParseUint(c.Params("id"), 10, 0) - if err != nil { - return err - } - - requestForInformationItemsData, err := _i.requestForInformationItemsService.Show(uint(id)) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"RequestForInformationItems successfully retrieved"}, - Data: requestForInformationItemsData, - }) -} - -// Save create RequestForInformationItems -// @Summary Create RequestForInformationItems -// @Description API for create RequestForInformationItems -// @Tags RequestForInformationItems -// @Security Bearer -// @Param payload body request.RequestForInformationItemsCreateRequest 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-items [post] -func (_i *requestForInformationItemsController) Save(c *fiber.Ctx) error { - req := new(request.RequestForInformationItemsCreateRequest) - if err := utilVal.ParseAndValidate(c, req); err != nil { - return err - } - - authToken := c.Get("Authorization") - dataResult, err := _i.requestForInformationItemsService.Save(*req, authToken) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"RequestForInformationItems successfully created"}, - Data: dataResult, - }) -} - -// Update update RequestForInformationItems -// @Summary update RequestForInformationItems -// @Description API for update RequestForInformationItems -// @Tags RequestForInformationItems -// @Security Bearer -// @Param payload body request.RequestForInformationItemsUpdateRequest true "Required payload" -// @Param id path int true "RequestForInformationItems 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-items/{id} [put] -func (_i *requestForInformationItemsController) Update(c *fiber.Ctx) error { - id, err := strconv.ParseUint(c.Params("id"), 10, 0) - if err != nil { - return err - } - - req := new(request.RequestForInformationItemsUpdateRequest) - if err := utilVal.ParseAndValidate(c, req); err != nil { - return err - } - - err = _i.requestForInformationItemsService.Update(uint(id), *req) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"RequestForInformationItems successfully updated"}, - }) -} - -// Delete delete RequestForInformationItems -// @Summary delete RequestForInformationItems -// @Description API for delete RequestForInformationItems -// @Tags RequestForInformationItems -// @Security Bearer -// @Param id path int true "RequestForInformationItems 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-items/{id} [delete] -func (_i *requestForInformationItemsController) Delete(c *fiber.Ctx) error { - id, err := strconv.ParseUint(c.Params("id"), 10, 0) - if err != nil { - return err - } - - err = _i.requestForInformationItemsService.Delete(uint(id)) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"RequestForInformationItems successfully deleted"}, - }) -} diff --git a/app/module/request_for_information_items/mapper/request_for_information_items.mapper.go b/app/module/request_for_information_items/mapper/request_for_information_items.mapper.go deleted file mode 100644 index 6c9a420..0000000 --- a/app/module/request_for_information_items/mapper/request_for_information_items.mapper.go +++ /dev/null @@ -1,23 +0,0 @@ -package mapper - -import ( - "go-humas-be/app/database/entity" - res "go-humas-be/app/module/request_for_information_items/response" -) - -func RequestForInformationItemsResponseMapper(requestForInformationItemsReq *entity.RequestForInformationItems) (requestForInformationItemsRes *res.RequestForInformationItemsResponse) { - if requestForInformationItemsReq != nil { - requestForInformationItemsRes = &res.RequestForInformationItemsResponse{ - ID: requestForInformationItemsReq.ID, - RequestForInformationId: requestForInformationItemsReq.RequestForInformationId, - RequestedInfo: requestForInformationItemsReq.RequestedInfo, - DetailedInfo: requestForInformationItemsReq.DetailedInfo, - Reason: requestForInformationItemsReq.Reason, - StatusId: requestForInformationItemsReq.StatusId, - IsActive: requestForInformationItemsReq.IsActive, - CreatedAt: requestForInformationItemsReq.CreatedAt, - UpdatedAt: requestForInformationItemsReq.UpdatedAt, - } - } - return requestForInformationItemsRes -} diff --git a/app/module/request_for_information_items/repository/request_for_information_items.repository.go b/app/module/request_for_information_items/repository/request_for_information_items.repository.go deleted file mode 100644 index 42bc5bd..0000000 --- a/app/module/request_for_information_items/repository/request_for_information_items.repository.go +++ /dev/null @@ -1,103 +0,0 @@ -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_items/request" - "go-humas-be/utils/paginator" - "strings" -) - -type requestForInformationItemsRepository struct { - DB *database.Database - Log zerolog.Logger -} - -// RequestForInformationItemsRepository define interface of IRequestForInformationItemsRepository -type RequestForInformationItemsRepository interface { - GetAll(req request.RequestForInformationItemsQueryRequest) (requestForInformationItemss []*entity.RequestForInformationItems, paging paginator.Pagination, err error) - FindOne(id uint) (requestForInformationItems *entity.RequestForInformationItems, err error) - Create(requestForInformationItems *entity.RequestForInformationItems) (requestForInformationItemsReturn *entity.RequestForInformationItems, err error) - Update(id uint, requestForInformationItems *entity.RequestForInformationItems) (err error) - Delete(id uint) (err error) -} - -func NewRequestForInformationItemsRepository(db *database.Database, logger zerolog.Logger) RequestForInformationItemsRepository { - return &requestForInformationItemsRepository{ - DB: db, - Log: logger, - } -} - -// implement interface of IRequestForInformationItemsRepository -func (_i *requestForInformationItemsRepository) GetAll(req request.RequestForInformationItemsQueryRequest) (requestForInformationItemss []*entity.RequestForInformationItems, paging paginator.Pagination, err error) { - var count int64 - - query := _i.DB.DB.Model(&entity.RequestForInformationItems{}) - query = query.Where("is_active = ?", true) - - if req.RequestForInformationId != nil { - query = query.Where("request_for_information_id = ?", req.RequestForInformationId) - } - if req.RequestedInfo != nil && *req.RequestedInfo != "" { - requestedInfo := strings.ToLower(*req.RequestedInfo) - query = query.Where("LOWER(requested_info) LIKE ?", "%"+strings.ToLower(requestedInfo)+"%") - } - if req.DetailedInfo != nil && *req.DetailedInfo != "" { - detailedInfo := strings.ToLower(*req.DetailedInfo) - query = query.Where("LOWER(detailed_info) LIKE ?", "%"+strings.ToLower(detailedInfo)+"%") - } - if req.Reason != nil && *req.Reason != "" { - reason := strings.ToLower(*req.Reason) - query = query.Where("LOWER(reason) LIKE ?", "%"+strings.ToLower(reason)+"%") - } - 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(&requestForInformationItemss).Error - if err != nil { - return - } - - paging = *req.Pagination - - return -} - -func (_i *requestForInformationItemsRepository) FindOne(id uint) (requestForInformationItems *entity.RequestForInformationItems, err error) { - if err := _i.DB.DB.First(&requestForInformationItems, id).Error; err != nil { - return nil, err - } - - return requestForInformationItems, nil -} - -func (_i *requestForInformationItemsRepository) Create(requestForInformationItems *entity.RequestForInformationItems) (requestForInformationItemsReturn *entity.RequestForInformationItems, err error) { - result := _i.DB.DB.Create(requestForInformationItems) - return requestForInformationItems, result.Error -} - -func (_i *requestForInformationItemsRepository) Update(id uint, requestForInformationItems *entity.RequestForInformationItems) (err error) { - return _i.DB.DB.Model(&entity.RequestForInformationItems{}). - Where(&entity.RequestForInformationItems{ID: id}). - Updates(requestForInformationItems).Error -} - -func (_i *requestForInformationItemsRepository) Delete(id uint) error { - return _i.DB.DB.Delete(&entity.RequestForInformationItems{}, id).Error -} diff --git a/app/module/request_for_information_items/request/request_for_information_items.request.go b/app/module/request_for_information_items/request/request_for_information_items.request.go deleted file mode 100644 index 42e38a8..0000000 --- a/app/module/request_for_information_items/request/request_for_information_items.request.go +++ /dev/null @@ -1,97 +0,0 @@ -package request - -import ( - "go-humas-be/app/database/entity" - "go-humas-be/utils/paginator" - "strconv" - "time" -) - -type RequestForInformationItemsGeneric interface { - ToEntity() -} - -type RequestForInformationItemsQueryRequest struct { - RequestForInformationId *int `json:"requestForInformationId"` - RequestedInfo *string `json:"requestedInfo"` - DetailedInfo *string `json:"detailedInfo"` - Reason *string `json:"reason"` - StatusId *int `json:"statusId"` - Pagination *paginator.Pagination `json:"pagination"` -} - -type RequestForInformationItemsCreateRequest struct { - RequestForInformationId int `json:"requestForInformationId" validate:"required"` - RequestedInfo string `json:"requestedInfo" validate:"required"` - DetailedInfo string `json:"detailedInfo" validate:"required"` - Reason string `json:"reason" validate:"required"` - StatusId int `json:"statusId" validate:"required"` -} - -func (req RequestForInformationItemsCreateRequest) ToEntity() *entity.RequestForInformationItems { - return &entity.RequestForInformationItems{ - RequestForInformationId: req.RequestForInformationId, - RequestedInfo: req.RequestedInfo, - DetailedInfo: req.DetailedInfo, - Reason: req.Reason, - StatusId: req.StatusId, - IsActive: func() *bool { b := true; return &b }(), - } -} - -type RequestForInformationItemsUpdateRequest struct { - ID uint `json:"id" validate:"required"` - RequestForInformationId int `json:"requestForInformationId" validate:"required"` - RequestedInfo string `json:"requestedInfo" validate:"required"` - DetailedInfo string `json:"detailedInfo" validate:"required"` - Reason string `json:"reason" validate:"required"` - StatusId int `json:"statusId" validate:"required"` -} - -func (req RequestForInformationItemsUpdateRequest) ToEntity() *entity.RequestForInformationItems { - return &entity.RequestForInformationItems{ - ID: req.ID, - RequestForInformationId: req.RequestForInformationId, - RequestedInfo: req.RequestedInfo, - DetailedInfo: req.DetailedInfo, - Reason: req.Reason, - StatusId: req.StatusId, - UpdatedAt: time.Now(), - } -} - -type RequestForInformationItemsQueryRequestContext struct { - RequestForInformationId string `json:"requestForInformationId"` - RequestedInfo string `json:"requestedInfo"` - DetailedInfo string `json:"detailedInfo"` - Reason string `json:"reason"` - StatusId string `json:"statusId"` -} - -func (req RequestForInformationItemsQueryRequestContext) ToParamRequest() RequestForInformationItemsQueryRequest { - var request RequestForInformationItemsQueryRequest - - if requestForInformationIdStr := req.RequestForInformationId; requestForInformationIdStr != "" { - requestForInformationId, err := strconv.Atoi(requestForInformationIdStr) - if err == nil { - request.RequestForInformationId = &requestForInformationId - } - } - if requestedInfo := req.RequestedInfo; requestedInfo != "" { - request.RequestedInfo = &requestedInfo - } - if detailedInfo := req.DetailedInfo; detailedInfo != "" { - request.DetailedInfo = &detailedInfo - } - if reason := req.Reason; reason != "" { - request.Reason = &reason - } - 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_items/request_for_information_items.module.go b/app/module/request_for_information_items/request_for_information_items.module.go deleted file mode 100644 index 0a628e0..0000000 --- a/app/module/request_for_information_items/request_for_information_items.module.go +++ /dev/null @@ -1,53 +0,0 @@ -package request_for_information_items - -import ( - "github.com/gofiber/fiber/v2" - "go-humas-be/app/module/request_for_information_items/controller" - "go-humas-be/app/module/request_for_information_items/repository" - "go-humas-be/app/module/request_for_information_items/service" - "go.uber.org/fx" -) - -// struct of RequestForInformationItemsRouter -type RequestForInformationItemsRouter struct { - App fiber.Router - Controller *controller.Controller -} - -// register bulky of RequestForInformationItems module -var NewRequestForInformationItemsModule = fx.Options( - // register repository of RequestForInformationItems module - fx.Provide(repository.NewRequestForInformationItemsRepository), - - // register service of RequestForInformationItems module - fx.Provide(service.NewRequestForInformationItemsService), - - // register controller of RequestForInformationItems module - fx.Provide(controller.NewController), - - // register router of RequestForInformationItems module - fx.Provide(NewRequestForInformationItemsRouter), -) - -// init RequestForInformationItemsRouter -func NewRequestForInformationItemsRouter(fiber *fiber.App, controller *controller.Controller) *RequestForInformationItemsRouter { - return &RequestForInformationItemsRouter{ - App: fiber, - Controller: controller, - } -} - -// register routes of RequestForInformationItems module -func (_i *RequestForInformationItemsRouter) RegisterRequestForInformationItemsRoutes() { - // define controllers - requestForInformationItemsController := _i.Controller.RequestForInformationItems - - // define routes - _i.App.Route("/request-for-information-items", func(router fiber.Router) { - router.Get("/", requestForInformationItemsController.All) - router.Get("/:id", requestForInformationItemsController.Show) - router.Post("/", requestForInformationItemsController.Save) - router.Put("/:id", requestForInformationItemsController.Update) - router.Delete("/:id", requestForInformationItemsController.Delete) - }) -} diff --git a/app/module/request_for_information_items/response/request_for_information_items.response.go b/app/module/request_for_information_items/response/request_for_information_items.response.go deleted file mode 100644 index 01d3b5d..0000000 --- a/app/module/request_for_information_items/response/request_for_information_items.response.go +++ /dev/null @@ -1,15 +0,0 @@ -package response - -import "time" - -type RequestForInformationItemsResponse struct { - ID uint `json:"id"` - RequestForInformationId int `json:"requestForInformationId"` - RequestedInfo string `json:"requestedInfo"` - DetailedInfo string `json:"detailedInfo"` - Reason string `json:"reason"` - StatusId int `json:"statusId"` - IsActive *bool `json:"isActive"` - CreatedAt time.Time `json:"createdAt"` - UpdatedAt time.Time `json:"updatedAt"` -} diff --git a/app/module/request_for_information_items/service/request_for_information_items.service.go b/app/module/request_for_information_items/service/request_for_information_items.service.go deleted file mode 100644 index 4709ac9..0000000 --- a/app/module/request_for_information_items/service/request_for_information_items.service.go +++ /dev/null @@ -1,85 +0,0 @@ -package service - -import ( - "github.com/rs/zerolog" - "go-humas-be/app/database/entity" - "go-humas-be/app/module/request_for_information_items/mapper" - "go-humas-be/app/module/request_for_information_items/repository" - "go-humas-be/app/module/request_for_information_items/request" - "go-humas-be/app/module/request_for_information_items/response" - usersRepository "go-humas-be/app/module/users/repository" - "go-humas-be/utils/paginator" -) - -// RequestForInformationItemsService -type requestForInformationItemsService struct { - Repo repository.RequestForInformationItemsRepository - UsersRepo usersRepository.UsersRepository - Log zerolog.Logger -} - -// RequestForInformationItemsService define interface of IRequestForInformationItemsService -type RequestForInformationItemsService interface { - All(req request.RequestForInformationItemsQueryRequest) (requestForInformationItems []*response.RequestForInformationItemsResponse, paging paginator.Pagination, err error) - Show(id uint) (requestForInformationItems *response.RequestForInformationItemsResponse, err error) - Save(req request.RequestForInformationItemsCreateRequest, authToken string) (requestForInformationItems *entity.RequestForInformationItems, err error) - Update(id uint, req request.RequestForInformationItemsUpdateRequest) (err error) - Delete(id uint) error -} - -// NewRequestForInformationItemsService init RequestForInformationItemsService -func NewRequestForInformationItemsService(repo repository.RequestForInformationItemsRepository, log zerolog.Logger, usersRepo usersRepository.UsersRepository) RequestForInformationItemsService { - - return &requestForInformationItemsService{ - Repo: repo, - Log: log, - UsersRepo: usersRepo, - } -} - -// All implement interface of RequestForInformationItemsService -func (_i *requestForInformationItemsService) All(req request.RequestForInformationItemsQueryRequest) (requestForInformationItemss []*response.RequestForInformationItemsResponse, paging paginator.Pagination, err error) { - results, paging, err := _i.Repo.GetAll(req) - if err != nil { - return - } - - for _, result := range results { - requestForInformationItemss = append(requestForInformationItemss, mapper.RequestForInformationItemsResponseMapper(result)) - } - - return -} - -func (_i *requestForInformationItemsService) Show(id uint) (requestForInformationItems *response.RequestForInformationItemsResponse, err error) { - result, err := _i.Repo.FindOne(id) - if err != nil { - return nil, err - } - - return mapper.RequestForInformationItemsResponseMapper(result), nil -} - -func (_i *requestForInformationItemsService) Save(req request.RequestForInformationItemsCreateRequest, authToken string) (requestForInformationItems *entity.RequestForInformationItems, err error) { - _i.Log.Info().Interface("data", req).Msg("") - - newReq := req.ToEntity() - - return _i.Repo.Create(newReq) -} - -func (_i *requestForInformationItemsService) Update(id uint, req request.RequestForInformationItemsUpdateRequest) (err error) { - _i.Log.Info().Interface("data", req).Msg("") - return _i.Repo.Update(id, req.ToEntity()) -} - -func (_i *requestForInformationItemsService) 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/module/request_for_information_objection/controller/controller.go b/app/module/request_for_information_objection/controller/controller.go deleted file mode 100644 index ff04155..0000000 --- a/app/module/request_for_information_objection/controller/controller.go +++ /dev/null @@ -1,16 +0,0 @@ -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 deleted file mode 100644 index c76132c..0000000 --- a/app/module/request_for_information_objection/controller/request_for_information_objection.controller.go +++ /dev/null @@ -1,198 +0,0 @@ -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{ - RequestForInformationItemId: c.Query("requestForInformationItemId"), - DocumentName: c.Query("documentName"), - MainReason: c.Query("mainReason"), - SecondaryReason: c.Query("secondaryReason"), - CreatedById: c.Query("createdById"), - StatusId: c.Query("statusId"), - } - 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 deleted file mode 100644 index 6fdeb97..0000000 --- a/app/module/request_for_information_objection/mapper/request_for_information_objection.mapper.go +++ /dev/null @@ -1,24 +0,0 @@ -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, - RequestForInformationItemId: requestForInformationObjectionReq.RequestForInformationItemId, - 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 deleted file mode 100644 index a91b7fb..0000000 --- a/app/module/request_for_information_objection/repository/request_for_information_objection.repository.go +++ /dev/null @@ -1,106 +0,0 @@ -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.RequestForInformationItemId != nil { - query = query.Where("request_for_information_item_id = ?", req.RequestForInformationItemId) - } - 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 deleted file mode 100644 index f6af144..0000000 --- a/app/module/request_for_information_objection/request/request_for_information_objection.request.go +++ /dev/null @@ -1,106 +0,0 @@ -package request - -import ( - "go-humas-be/app/database/entity" - "go-humas-be/utils/paginator" - "strconv" - "time" -) - -type RequestForInformationObjectionGeneric interface { - ToEntity() -} - -type RequestForInformationObjectionQueryRequest struct { - RequestForInformationItemId *uint `json:"requestForInformationItemId"` - DocumentName *string `json:"documentName"` - MainReason *string `json:"mainReason"` - SecondaryReason *string `json:"secondaryReason"` - CreatedById *int `json:"createdById"` - StatusId *int `json:"statusId"` - Pagination *paginator.Pagination `json:"pagination"` -} - -type RequestForInformationObjectionCreateRequest struct { - RequestForInformationItemId uint `json:"requestForInformationItemId" validate:"required"` - DocumentName string `json:"documentName" validate:"required"` - MainReason string `json:"mainReason" validate:"required"` - SecondaryReason string `json:"secondaryReason" validate:"required"` - StatusId int `json:"statusId" validate:"required"` -} - -func (req RequestForInformationObjectionCreateRequest) ToEntity() *entity.RequestForInformationObjection { - return &entity.RequestForInformationObjection{ - RequestForInformationItemId: req.RequestForInformationItemId, - 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"` - RequestForInformationItemId uint `json:"requestForInformationItemId" validate:"required"` - DocumentName string `json:"documentName" validate:"required"` - MainReason string `json:"mainReason" validate:"required"` - SecondaryReason string `json:"secondaryReason" validate:"required"` - StatusId int `json:"statusId" validate:"required"` -} - -func (req RequestForInformationObjectionUpdateRequest) ToEntity() *entity.RequestForInformationObjection { - return &entity.RequestForInformationObjection{ - ID: req.ID, - RequestForInformationItemId: req.RequestForInformationItemId, - DocumentName: req.DocumentName, - MainReason: req.MainReason, - SecondaryReason: req.SecondaryReason, - StatusId: req.StatusId, - UpdatedAt: time.Now(), - } -} - -type RequestForInformationObjectionQueryRequestContext struct { - RequestForInformationItemId string `json:"requestForInformationItemId"` - DocumentName string `json:"documentName"` - MainReason string `json:"mainReason"` - SecondaryReason string `json:"secondaryReason"` - CreatedById string `json:"createdById"` - StatusId string `json:"statusId"` -} - -func (req RequestForInformationObjectionQueryRequestContext) ToParamRequest() RequestForInformationObjectionQueryRequest { - var request RequestForInformationObjectionQueryRequest - - if requestForInformationIdStr := req.RequestForInformationItemId; requestForInformationIdStr != "" { - requestForInformationId, err := strconv.Atoi(requestForInformationIdStr) - if err == nil { - requestForInformationIdUint := uint(requestForInformationId) - request.RequestForInformationItemId = &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 { - request.CreatedById = &createdById - } - } - 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 deleted file mode 100644 index 68a0962..0000000 --- a/app/module/request_for_information_objection/request_for_information_objection.module.go +++ /dev/null @@ -1,53 +0,0 @@ -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 deleted file mode 100644 index 6f26fb9..0000000 --- a/app/module/request_for_information_objection/response/request_for_information_objection.response.go +++ /dev/null @@ -1,16 +0,0 @@ -package response - -import "time" - -type RequestForInformationObjectionResponse struct { - ID uint `json:"id"` - RequestForInformationItemId uint `json:"requestForInformationItemId"` - DocumentName string `json:"documentName"` - MainReason string `json:"mainReason"` - SecondaryReason string `json:"secondaryReason"` - CreatedById uint `json:"createdById"` - StatusId int `json:"statusId"` - IsActive *bool `json:"isActive"` - CreatedAt time.Time `json:"createdAt"` - UpdatedAt time.Time `json:"updatedAt"` -} 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 deleted file mode 100644 index cd4309e..0000000 --- a/app/module/request_for_information_objection/service/request_for_information_objection.service.go +++ /dev/null @@ -1,90 +0,0 @@ -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/module/request_for_information_objection_replies/controller/controller.go b/app/module/request_for_information_objection_replies/controller/controller.go deleted file mode 100644 index 68f2523..0000000 --- a/app/module/request_for_information_objection_replies/controller/controller.go +++ /dev/null @@ -1,16 +0,0 @@ -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), - } -} diff --git a/app/module/request_for_information_objection_replies/controller/request_for_information_objection_replies.controller.go b/app/module/request_for_information_objection_replies/controller/request_for_information_objection_replies.controller.go deleted file mode 100644 index cc506d3..0000000 --- a/app/module/request_for_information_objection_replies/controller/request_for_information_objection_replies.controller.go +++ /dev/null @@ -1,193 +0,0 @@ -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 ) -// @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"}, - }) -} diff --git a/app/module/request_for_information_objection_replies/mapper/request_for_information_objection_replies.mapper.go b/app/module/request_for_information_objection_replies/mapper/request_for_information_objection_replies.mapper.go deleted file mode 100644 index 1ba20ba..0000000 --- a/app/module/request_for_information_objection_replies/mapper/request_for_information_objection_replies.mapper.go +++ /dev/null @@ -1,22 +0,0 @@ -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 -} diff --git a/app/module/request_for_information_objection_replies/repository/request_for_information_objection_replies.repository.go b/app/module/request_for_information_objection_replies/repository/request_for_information_objection_replies.repository.go deleted file mode 100644 index 9b9135d..0000000 --- a/app/module/request_for_information_objection_replies/repository/request_for_information_objection_replies.repository.go +++ /dev/null @@ -1,98 +0,0 @@ -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 -} diff --git a/app/module/request_for_information_objection_replies/request/request_for_information_objection_replies.request.go b/app/module/request_for_information_objection_replies/request/request_for_information_objection_replies.request.go deleted file mode 100644 index 632e6f5..0000000 --- a/app/module/request_for_information_objection_replies/request/request_for_information_objection_replies.request.go +++ /dev/null @@ -1,89 +0,0 @@ -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 -} diff --git a/app/module/request_for_information_objection_replies/request_for_information_objection_replies.module.go b/app/module/request_for_information_objection_replies/request_for_information_objection_replies.module.go deleted file mode 100644 index 5d33a16..0000000 --- a/app/module/request_for_information_objection_replies/request_for_information_objection_replies.module.go +++ /dev/null @@ -1,53 +0,0 @@ -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) - }) -} diff --git a/app/module/request_for_information_objection_replies/response/request_for_information_objection_replies.response.go b/app/module/request_for_information_objection_replies/response/request_for_information_objection_replies.response.go deleted file mode 100644 index 3dc6c5c..0000000 --- a/app/module/request_for_information_objection_replies/response/request_for_information_objection_replies.response.go +++ /dev/null @@ -1,14 +0,0 @@ -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"` -} diff --git a/app/module/request_for_information_objection_replies/service/request_for_information_objection_replies.service.go b/app/module/request_for_information_objection_replies/service/request_for_information_objection_replies.service.go deleted file mode 100644 index 6cac856..0000000 --- a/app/module/request_for_information_objection_replies/service/request_for_information_objection_replies.service.go +++ /dev/null @@ -1,90 +0,0 @@ -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) -} diff --git a/app/module/request_for_information_replies/controller/controller.go b/app/module/request_for_information_replies/controller/controller.go deleted file mode 100644 index 26b181f..0000000 --- a/app/module/request_for_information_replies/controller/controller.go +++ /dev/null @@ -1,16 +0,0 @@ -package controller - -import ( - "github.com/rs/zerolog" - "go-humas-be/app/module/request_for_information_replies/service" -) - -type Controller struct { - RequestForInformationReplies RequestForInformationRepliesController -} - -func NewController(RequestForInformationRepliesService service.RequestForInformationRepliesService, log zerolog.Logger) *Controller { - return &Controller{ - RequestForInformationReplies: NewRequestForInformationRepliesController(RequestForInformationRepliesService, log), - } -} diff --git a/app/module/request_for_information_replies/controller/request_for_information_replies.controller.go b/app/module/request_for_information_replies/controller/request_for_information_replies.controller.go deleted file mode 100644 index 1d38aad..0000000 --- a/app/module/request_for_information_replies/controller/request_for_information_replies.controller.go +++ /dev/null @@ -1,195 +0,0 @@ -package controller - -import ( - "github.com/gofiber/fiber/v2" - "github.com/rs/zerolog" - "go-humas-be/app/module/request_for_information_replies/request" - "go-humas-be/app/module/request_for_information_replies/service" - "go-humas-be/utils/paginator" - utilRes "go-humas-be/utils/response" - utilVal "go-humas-be/utils/validator" - "strconv" -) - -type requestForInformationRepliesController struct { - requestForInformationRepliesService service.RequestForInformationRepliesService - Log zerolog.Logger -} - -type RequestForInformationRepliesController 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 NewRequestForInformationRepliesController(requestForInformationRepliesService service.RequestForInformationRepliesService, log zerolog.Logger) RequestForInformationRepliesController { - return &requestForInformationRepliesController{ - requestForInformationRepliesService: requestForInformationRepliesService, - Log: log, - } -} - -// All get all RequestForInformationReplies -// @Summary Get all RequestForInformationReplies -// @Description API for getting all RequestForInformationReplies -// @Tags RequestForInformationReplies -// @Security Bearer -// @Param req query request.RequestForInformationRepliesQueryRequest 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-replies [get] -func (_i *requestForInformationRepliesController) All(c *fiber.Ctx) error { - paginate, err := paginator.Paginate(c) - if err != nil { - return err - } - - reqContext := request.RequestForInformationRepliesQueryRequestContext{ - RequestForInformationItemId: c.Query("requestForInformationItemId"), - FileUrl: c.Query("fileUrl"), - Response: c.Query("response"), - StatusId: c.Query("statusId"), - } - req := reqContext.ToParamRequest() - req.Pagination = paginate - - requestForInformationRepliesData, paging, err := _i.requestForInformationRepliesService.All(req) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"RequestForInformationReplies list successfully retrieved"}, - Data: requestForInformationRepliesData, - Meta: paging, - }) -} - -// Show get one RequestForInformationReplies -// @Summary Get one RequestForInformationReplies -// @Description API for getting one RequestForInformationReplies -// @Tags RequestForInformationReplies -// @Security Bearer -// @Param id path int true "RequestForInformationReplies 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-replies/{id} [get] -func (_i *requestForInformationRepliesController) Show(c *fiber.Ctx) error { - id, err := strconv.ParseUint(c.Params("id"), 10, 0) - if err != nil { - return err - } - - requestForInformationRepliesData, err := _i.requestForInformationRepliesService.Show(uint(id)) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"RequestForInformationReplies successfully retrieved"}, - Data: requestForInformationRepliesData, - }) -} - -// Save create RequestForInformationReplies -// @Summary Create RequestForInformationReplies -// @Description API for create RequestForInformationReplies -// @Tags RequestForInformationReplies -// @Security Bearer -// @Param Authorization header string true "Insert your access token" default(Bearer ) -// @Param payload body request.RequestForInformationRepliesCreateRequest 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-replies [post] -func (_i *requestForInformationRepliesController) Save(c *fiber.Ctx) error { - req := new(request.RequestForInformationRepliesCreateRequest) - if err := utilVal.ParseAndValidate(c, req); err != nil { - return err - } - - authToken := c.Get("Authorization") - dataResult, err := _i.requestForInformationRepliesService.Save(*req, authToken) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"RequestForInformationReplies successfully created"}, - Data: dataResult, - }) -} - -// Update update RequestForInformationReplies -// @Summary update RequestForInformationReplies -// @Description API for update RequestForInformationReplies -// @Tags RequestForInformationReplies -// @Security Bearer -// @Param Authorization header string true "Insert your access token" default(Bearer ) -// @Param payload body request.RequestForInformationRepliesUpdateRequest true "Required payload" -// @Param id path int true "RequestForInformationReplies 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-replies/{id} [put] -func (_i *requestForInformationRepliesController) Update(c *fiber.Ctx) error { - id, err := strconv.ParseUint(c.Params("id"), 10, 0) - if err != nil { - return err - } - - req := new(request.RequestForInformationRepliesUpdateRequest) - if err := utilVal.ParseAndValidate(c, req); err != nil { - return err - } - - err = _i.requestForInformationRepliesService.Update(uint(id), *req) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"RequestForInformationReplies successfully updated"}, - }) -} - -// Delete delete RequestForInformationReplies -// @Summary delete RequestForInformationReplies -// @Description API for delete RequestForInformationReplies -// @Tags RequestForInformationReplies -// @Security Bearer -// @Param id path int true "RequestForInformationReplies 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-replies/{id} [delete] -func (_i *requestForInformationRepliesController) Delete(c *fiber.Ctx) error { - id, err := strconv.ParseUint(c.Params("id"), 10, 0) - if err != nil { - return err - } - - err = _i.requestForInformationRepliesService.Delete(uint(id)) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"RequestForInformationReplies successfully deleted"}, - }) -} diff --git a/app/module/request_for_information_replies/mapper/request_for_information_replies.mapper.go b/app/module/request_for_information_replies/mapper/request_for_information_replies.mapper.go deleted file mode 100644 index 9d6ca53..0000000 --- a/app/module/request_for_information_replies/mapper/request_for_information_replies.mapper.go +++ /dev/null @@ -1,23 +0,0 @@ -package mapper - -import ( - "go-humas-be/app/database/entity" - res "go-humas-be/app/module/request_for_information_replies/response" -) - -func RequestForInformationRepliesResponseMapper(requestForInformationRepliesReq *entity.RequestForInformationReplies) (requestForInformationRepliesRes *res.RequestForInformationRepliesResponse) { - if requestForInformationRepliesReq != nil { - requestForInformationRepliesRes = &res.RequestForInformationRepliesResponse{ - ID: requestForInformationRepliesReq.ID, - RequestForInformationItemId: requestForInformationRepliesReq.RequestForInformationItemId, - FileUrl: requestForInformationRepliesReq.FileUrl, - Response: requestForInformationRepliesReq.Response, - StatusId: requestForInformationRepliesReq.StatusId, - CreatedById: requestForInformationRepliesReq.CreatedById, - IsActive: requestForInformationRepliesReq.IsActive, - CreatedAt: requestForInformationRepliesReq.CreatedAt, - UpdatedAt: requestForInformationRepliesReq.UpdatedAt, - } - } - return requestForInformationRepliesRes -} diff --git a/app/module/request_for_information_replies/repository/request_for_information_replies.repository.go b/app/module/request_for_information_replies/repository/request_for_information_replies.repository.go deleted file mode 100644 index 1f559bb..0000000 --- a/app/module/request_for_information_replies/repository/request_for_information_replies.repository.go +++ /dev/null @@ -1,99 +0,0 @@ -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_replies/request" - "go-humas-be/utils/paginator" - "strings" -) - -type requestForInformationRepliesRepository struct { - DB *database.Database - Log zerolog.Logger -} - -// RequestForInformationRepliesRepository define interface of IRequestForInformationRepliesRepository -type RequestForInformationRepliesRepository interface { - GetAll(req request.RequestForInformationRepliesQueryRequest) (requestForInformationRepliess []*entity.RequestForInformationReplies, paging paginator.Pagination, err error) - FindOne(id uint) (requestForInformationReplies *entity.RequestForInformationReplies, err error) - Create(requestForInformationReplies *entity.RequestForInformationReplies) (requestForInformationRepliesReturn *entity.RequestForInformationReplies, err error) - Update(id uint, requestForInformationReplies *entity.RequestForInformationReplies) (err error) - Delete(id uint) (err error) -} - -func NewRequestForInformationRepliesRepository(db *database.Database, logger zerolog.Logger) RequestForInformationRepliesRepository { - return &requestForInformationRepliesRepository{ - DB: db, - Log: logger, - } -} - -// implement interface of IRequestForInformationRepliesRepository -func (_i *requestForInformationRepliesRepository) GetAll(req request.RequestForInformationRepliesQueryRequest) (requestForInformationRepliess []*entity.RequestForInformationReplies, paging paginator.Pagination, err error) { - var count int64 - - query := _i.DB.DB.Model(&entity.RequestForInformationReplies{}) - query = query.Where("is_active = ?", true) - - if req.RequestForInformationItemId != nil { - query = query.Where("request_for_information_item_id = ?", req.RequestForInformationItemId) - } - if req.FileUrl != nil && *req.FileUrl != "" { - fileUrl := strings.ToLower(*req.FileUrl) - query = query.Where("LOWER(file_url) LIKE ?", "%"+strings.ToLower(fileUrl)+"%") - } - 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) - } - 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(&requestForInformationRepliess).Error - if err != nil { - return - } - - paging = *req.Pagination - - return -} - -func (_i *requestForInformationRepliesRepository) FindOne(id uint) (requestForInformationReplies *entity.RequestForInformationReplies, err error) { - if err := _i.DB.DB.First(&requestForInformationReplies, id).Error; err != nil { - return nil, err - } - - return requestForInformationReplies, nil -} - -func (_i *requestForInformationRepliesRepository) Create(requestForInformationReplies *entity.RequestForInformationReplies) (requestForInformationRepliesReturn *entity.RequestForInformationReplies, err error) { - result := _i.DB.DB.Create(requestForInformationReplies) - return requestForInformationReplies, result.Error -} - -func (_i *requestForInformationRepliesRepository) Update(id uint, requestForInformationReplies *entity.RequestForInformationReplies) (err error) { - return _i.DB.DB.Model(&entity.RequestForInformationReplies{}). - Where(&entity.RequestForInformationReplies{ID: id}). - Updates(requestForInformationReplies).Error -} - -func (_i *requestForInformationRepliesRepository) Delete(id uint) error { - return _i.DB.DB.Delete(&entity.RequestForInformationReplies{}, id).Error -} diff --git a/app/module/request_for_information_replies/request/request_for_information_replies.request.go b/app/module/request_for_information_replies/request/request_for_information_replies.request.go deleted file mode 100644 index f164541..0000000 --- a/app/module/request_for_information_replies/request/request_for_information_replies.request.go +++ /dev/null @@ -1,96 +0,0 @@ -package request - -import ( - "go-humas-be/app/database/entity" - "go-humas-be/utils/paginator" - "strconv" - "time" -) - -type RequestForInformationRepliesGeneric interface { - ToEntity() -} - -type RequestForInformationRepliesQueryRequest struct { - RequestForInformationItemId *int `json:"requestForInformationItemId"` - FileUrl *string `json:"fileUrl"` - Response *string `json:"response"` - StatusId *int `json:"statusId"` - CreatedById *int `json:"createdById"` - Pagination *paginator.Pagination `json:"pagination"` -} - -type RequestForInformationRepliesCreateRequest struct { - RequestForInformationItemId int `json:"requestForInformationItemId" validate:"required"` - FileUrl string `json:"fileUrl" validate:"required"` - Response string `json:"response" validate:"required"` - StatusId int `json:"statusId" validate:"required"` -} - -func (req RequestForInformationRepliesCreateRequest) ToEntity() *entity.RequestForInformationReplies { - return &entity.RequestForInformationReplies{ - RequestForInformationItemId: req.RequestForInformationItemId, - FileUrl: req.FileUrl, - Response: req.Response, - StatusId: req.StatusId, - IsActive: func() *bool { b := true; return &b }(), - } -} - -type RequestForInformationRepliesUpdateRequest struct { - ID uint `json:"id" validate:"required"` - RequestForInformationItemId int `json:"requestForInformationItemId" validate:"required"` - FileUrl string `json:"fileUrl" validate:"required"` - Response string `json:"response" validate:"required"` - StatusId int `json:"statusId" validate:"required"` -} - -func (req RequestForInformationRepliesUpdateRequest) ToEntity() *entity.RequestForInformationReplies { - return &entity.RequestForInformationReplies{ - ID: req.ID, - RequestForInformationItemId: req.RequestForInformationItemId, - FileUrl: req.FileUrl, - Response: req.Response, - StatusId: req.StatusId, - UpdatedAt: time.Now(), - } -} - -type RequestForInformationRepliesQueryRequestContext struct { - RequestForInformationItemId string `json:"requestForInformationItemId"` - FileUrl string `json:"fileUrl"` - Response string `json:"response"` - StatusId string `json:"statusId"` - CreatedById string `json:"createdById"` -} - -func (req RequestForInformationRepliesQueryRequestContext) ToParamRequest() RequestForInformationRepliesQueryRequest { - var request RequestForInformationRepliesQueryRequest - - if requestForInformationItemIdStr := req.RequestForInformationItemId; requestForInformationItemIdStr != "" { - requestForInformationItemId, err := strconv.Atoi(requestForInformationItemIdStr) - if err == nil { - request.RequestForInformationItemId = &requestForInformationItemId - } - } - if fileUrl := req.FileUrl; fileUrl != "" { - request.FileUrl = &fileUrl - } - 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 -} diff --git a/app/module/request_for_information_replies/request_for_information_replies.module.go b/app/module/request_for_information_replies/request_for_information_replies.module.go deleted file mode 100644 index 5aff4ea..0000000 --- a/app/module/request_for_information_replies/request_for_information_replies.module.go +++ /dev/null @@ -1,53 +0,0 @@ -package request_for_information_replies - -import ( - "github.com/gofiber/fiber/v2" - "go-humas-be/app/module/request_for_information_replies/controller" - "go-humas-be/app/module/request_for_information_replies/repository" - "go-humas-be/app/module/request_for_information_replies/service" - "go.uber.org/fx" -) - -// struct of RequestForInformationRepliesRouter -type RequestForInformationRepliesRouter struct { - App fiber.Router - Controller *controller.Controller -} - -// register bulky of RequestForInformationReplies module -var NewRequestForInformationRepliesModule = fx.Options( - // register repository of RequestForInformationReplies module - fx.Provide(repository.NewRequestForInformationRepliesRepository), - - // register service of RequestForInformationReplies module - fx.Provide(service.NewRequestForInformationRepliesService), - - // register controller of RequestForInformationReplies module - fx.Provide(controller.NewController), - - // register router of RequestForInformationReplies module - fx.Provide(NewRequestForInformationRepliesRouter), -) - -// init RequestForInformationRepliesRouter -func NewRequestForInformationRepliesRouter(fiber *fiber.App, controller *controller.Controller) *RequestForInformationRepliesRouter { - return &RequestForInformationRepliesRouter{ - App: fiber, - Controller: controller, - } -} - -// register routes of RequestForInformationReplies module -func (_i *RequestForInformationRepliesRouter) RegisterRequestForInformationRepliesRoutes() { - // define controllers - requestForInformationRepliesController := _i.Controller.RequestForInformationReplies - - // define routes - _i.App.Route("/request-for-information-replies", func(router fiber.Router) { - router.Get("/", requestForInformationRepliesController.All) - router.Get("/:id", requestForInformationRepliesController.Show) - router.Post("/", requestForInformationRepliesController.Save) - router.Put("/:id", requestForInformationRepliesController.Update) - router.Delete("/:id", requestForInformationRepliesController.Delete) - }) -} diff --git a/app/module/request_for_information_replies/response/request_for_information_replies.response.go b/app/module/request_for_information_replies/response/request_for_information_replies.response.go deleted file mode 100644 index 777b596..0000000 --- a/app/module/request_for_information_replies/response/request_for_information_replies.response.go +++ /dev/null @@ -1,15 +0,0 @@ -package response - -import "time" - -type RequestForInformationRepliesResponse struct { - ID uint `json:"id"` - RequestForInformationItemId int `json:"requestForInformationItemId"` - FileUrl string `json:"fileUrl"` - 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"` -} diff --git a/app/module/request_for_information_replies/service/request_for_information_replies.service.go b/app/module/request_for_information_replies/service/request_for_information_replies.service.go deleted file mode 100644 index 31cae0e..0000000 --- a/app/module/request_for_information_replies/service/request_for_information_replies.service.go +++ /dev/null @@ -1,90 +0,0 @@ -package service - -import ( - "github.com/rs/zerolog" - "go-humas-be/app/database/entity" - "go-humas-be/app/module/request_for_information_replies/mapper" - "go-humas-be/app/module/request_for_information_replies/repository" - "go-humas-be/app/module/request_for_information_replies/request" - "go-humas-be/app/module/request_for_information_replies/response" - usersRepository "go-humas-be/app/module/users/repository" - "go-humas-be/utils/paginator" - - utilSvc "go-humas-be/utils/service" -) - -// RequestForInformationRepliesService -type requestForInformationRepliesService struct { - Repo repository.RequestForInformationRepliesRepository - UsersRepo usersRepository.UsersRepository - Log zerolog.Logger -} - -// RequestForInformationRepliesService define interface of IRequestForInformationRepliesService -type RequestForInformationRepliesService interface { - All(req request.RequestForInformationRepliesQueryRequest) (requestForInformationReplies []*response.RequestForInformationRepliesResponse, paging paginator.Pagination, err error) - Show(id uint) (requestForInformationReplies *response.RequestForInformationRepliesResponse, err error) - Save(req request.RequestForInformationRepliesCreateRequest, authToken string) (requestForInformationReplies *entity.RequestForInformationReplies, err error) - Update(id uint, req request.RequestForInformationRepliesUpdateRequest) (err error) - Delete(id uint) error -} - -// NewRequestForInformationRepliesService init RequestForInformationRepliesService -func NewRequestForInformationRepliesService(repo repository.RequestForInformationRepliesRepository, log zerolog.Logger, usersRepo usersRepository.UsersRepository) RequestForInformationRepliesService { - - return &requestForInformationRepliesService{ - Repo: repo, - Log: log, - UsersRepo: usersRepo, - } -} - -// All implement interface of RequestForInformationRepliesService -func (_i *requestForInformationRepliesService) All(req request.RequestForInformationRepliesQueryRequest) (requestForInformationRepliess []*response.RequestForInformationRepliesResponse, paging paginator.Pagination, err error) { - results, paging, err := _i.Repo.GetAll(req) - if err != nil { - return - } - - for _, result := range results { - requestForInformationRepliess = append(requestForInformationRepliess, mapper.RequestForInformationRepliesResponseMapper(result)) - } - - return -} - -func (_i *requestForInformationRepliesService) Show(id uint) (requestForInformationReplies *response.RequestForInformationRepliesResponse, err error) { - result, err := _i.Repo.FindOne(id) - if err != nil { - return nil, err - } - - return mapper.RequestForInformationRepliesResponseMapper(result), nil -} - -func (_i *requestForInformationRepliesService) Save(req request.RequestForInformationRepliesCreateRequest, authToken string) (requestForInformationReplies *entity.RequestForInformationReplies, 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 *requestForInformationRepliesService) Update(id uint, req request.RequestForInformationRepliesUpdateRequest) (err error) { - _i.Log.Info().Interface("data", req).Msg("") - return _i.Repo.Update(id, req.ToEntity()) -} - -func (_i *requestForInformationRepliesService) 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/module/request_for_informations/controller/controller.go b/app/module/request_for_informations/controller/controller.go deleted file mode 100644 index ac79afc..0000000 --- a/app/module/request_for_informations/controller/controller.go +++ /dev/null @@ -1,16 +0,0 @@ -package controller - -import ( - "github.com/rs/zerolog" - "go-humas-be/app/module/request_for_informations/service" -) - -type Controller struct { - RequestForInformations RequestForInformationsController -} - -func NewController(RequestForInformationsService service.RequestForInformationsService, log zerolog.Logger) *Controller { - return &Controller{ - RequestForInformations: NewRequestForInformationsController(RequestForInformationsService, log), - } -} diff --git a/app/module/request_for_informations/controller/request_for_informations.controller.go b/app/module/request_for_informations/controller/request_for_informations.controller.go deleted file mode 100644 index 1714d23..0000000 --- a/app/module/request_for_informations/controller/request_for_informations.controller.go +++ /dev/null @@ -1,197 +0,0 @@ -package controller - -import ( - "github.com/gofiber/fiber/v2" - "github.com/rs/zerolog" - "go-humas-be/app/module/request_for_informations/request" - "go-humas-be/app/module/request_for_informations/service" - "go-humas-be/utils/paginator" - utilRes "go-humas-be/utils/response" - utilVal "go-humas-be/utils/validator" - "strconv" -) - -type requestForInformationsController struct { - requestForInformationsService service.RequestForInformationsService - Log zerolog.Logger -} - -type RequestForInformationsController 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 NewRequestForInformationsController(requestForInformationsService service.RequestForInformationsService, log zerolog.Logger) RequestForInformationsController { - return &requestForInformationsController{ - requestForInformationsService: requestForInformationsService, - Log: log, - } -} - -// All get all RequestForInformations -// @Summary Get all RequestForInformations -// @Description API for getting all RequestForInformations -// @Tags RequestForInformations -// @Security Bearer -// @Param req query request.RequestForInformationsQueryRequest 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-informations [get] -func (_i *requestForInformationsController) All(c *fiber.Ctx) error { - paginate, err := paginator.Paginate(c) - if err != nil { - return err - } - - reqContext := request.RequestForInformationsQueryRequestContext{ - TicketNumber: c.Query("ticketNumber"), - HowToGetInfo: c.Query("howToGetInfo"), - HowToGetFiles: c.Query("howToGetFiles"), - NextAction: c.Query("nextAction"), - CreatedById: c.Query("createdById"), - StatusId: c.Query("statusId"), - } - req := reqContext.ToParamRequest() - req.Pagination = paginate - - requestForInformationsData, paging, err := _i.requestForInformationsService.All(req) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"RequestForInformations list successfully retrieved"}, - Data: requestForInformationsData, - Meta: paging, - }) -} - -// Show get one RequestForInformations -// @Summary Get one RequestForInformations -// @Description API for getting one RequestForInformations -// @Tags RequestForInformations -// @Security Bearer -// @Param id path int true "RequestForInformations ID" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /request-for-informations/{id} [get] -func (_i *requestForInformationsController) Show(c *fiber.Ctx) error { - id, err := strconv.ParseUint(c.Params("id"), 10, 0) - if err != nil { - return err - } - - requestForInformationsData, err := _i.requestForInformationsService.Show(uint(id)) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"RequestForInformations successfully retrieved"}, - Data: requestForInformationsData, - }) -} - -// Save create RequestForInformations -// @Summary Create RequestForInformations -// @Description API for create RequestForInformations -// @Tags RequestForInformations -// @Security Bearer -// @Param Authorization header string true "Insert your access token" default(Bearer ) -// @Param payload body request.RequestForInformationsCreateRequest 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-informations [post] -func (_i *requestForInformationsController) Save(c *fiber.Ctx) error { - req := new(request.RequestForInformationsCreateRequest) - if err := utilVal.ParseAndValidate(c, req); err != nil { - return err - } - - authToken := c.Get("Authorization") - dataResult, err := _i.requestForInformationsService.Save(*req, authToken) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"RequestForInformations successfully created"}, - Data: dataResult, - }) -} - -// Update update RequestForInformations -// @Summary update RequestForInformations -// @Description API for update RequestForInformations -// @Tags RequestForInformations -// @Security Bearer -// @Param Authorization header string true "Insert your access token" default(Bearer ) -// @Param payload body request.RequestForInformationsUpdateRequest true "Required payload" -// @Param id path int true "RequestForInformations ID" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /request-for-informations/{id} [put] -func (_i *requestForInformationsController) Update(c *fiber.Ctx) error { - id, err := strconv.ParseUint(c.Params("id"), 10, 0) - if err != nil { - return err - } - - req := new(request.RequestForInformationsUpdateRequest) - if err := utilVal.ParseAndValidate(c, req); err != nil { - return err - } - - err = _i.requestForInformationsService.Update(uint(id), *req) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"RequestForInformations successfully updated"}, - }) -} - -// Delete delete RequestForInformations -// @Summary delete RequestForInformations -// @Description API for delete RequestForInformations -// @Tags RequestForInformations -// @Security Bearer -// @Param id path int true "RequestForInformations ID" -// @Success 200 {object} response.Response -// @Failure 400 {object} response.BadRequestError -// @Failure 401 {object} response.UnauthorizedError -// @Failure 500 {object} response.InternalServerError -// @Router /request-for-informations/{id} [delete] -func (_i *requestForInformationsController) Delete(c *fiber.Ctx) error { - id, err := strconv.ParseUint(c.Params("id"), 10, 0) - if err != nil { - return err - } - - err = _i.requestForInformationsService.Delete(uint(id)) - if err != nil { - return err - } - - return utilRes.Resp(c, utilRes.Response{ - Success: true, - Messages: utilRes.Messages{"RequestForInformations successfully deleted"}, - }) -} diff --git a/app/module/request_for_informations/mapper/request_for_informations.mapper.go b/app/module/request_for_informations/mapper/request_for_informations.mapper.go deleted file mode 100644 index 1d37b68..0000000 --- a/app/module/request_for_informations/mapper/request_for_informations.mapper.go +++ /dev/null @@ -1,24 +0,0 @@ -package mapper - -import ( - "go-humas-be/app/database/entity" - res "go-humas-be/app/module/request_for_informations/response" -) - -func RequestForInformationsResponseMapper(requestForInformationsReq *entity.RequestForInformations) (requestForInformationsRes *res.RequestForInformationsResponse) { - if requestForInformationsReq != nil { - requestForInformationsRes = &res.RequestForInformationsResponse{ - ID: requestForInformationsReq.ID, - TicketNumber: requestForInformationsReq.TicketNumber, - HowToGetInfo: requestForInformationsReq.HowToGetInfo, - HowToGetFiles: requestForInformationsReq.HowToGetFiles, - NextAction: requestForInformationsReq.NextAction, - CreatedById: requestForInformationsReq.CreatedById, - StatusId: requestForInformationsReq.StatusId, - IsActive: requestForInformationsReq.IsActive, - CreatedAt: requestForInformationsReq.CreatedAt, - UpdatedAt: requestForInformationsReq.UpdatedAt, - } - } - return requestForInformationsRes -} diff --git a/app/module/request_for_informations/repository/request_for_informations.repository.go b/app/module/request_for_informations/repository/request_for_informations.repository.go deleted file mode 100644 index b89781d..0000000 --- a/app/module/request_for_informations/repository/request_for_informations.repository.go +++ /dev/null @@ -1,112 +0,0 @@ -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_informations/request" - "go-humas-be/utils/paginator" - "strings" - "time" -) - -type requestForInformationsRepository struct { - DB *database.Database - Log zerolog.Logger -} - -// RequestForInformationsRepository define interface of IRequestForInformationsRepository -type RequestForInformationsRepository interface { - GetAll(req request.RequestForInformationsQueryRequest) (requestForInformationss []*entity.RequestForInformations, paging paginator.Pagination, err error) - FindOne(id uint) (requestForInformations *entity.RequestForInformations, err error) - Create(requestForInformations *entity.RequestForInformations) (requestForInformationsReturn *entity.RequestForInformations, err error) - Update(id uint, requestForInformations *entity.RequestForInformations) (err error) - Delete(id uint) (err error) -} - -func NewRequestForInformationsRepository(db *database.Database, logger zerolog.Logger) RequestForInformationsRepository { - return &requestForInformationsRepository{ - DB: db, - Log: logger, - } -} - -// implement interface of IRequestForInformationsRepository -func (_i *requestForInformationsRepository) GetAll(req request.RequestForInformationsQueryRequest) (requestForInformationss []*entity.RequestForInformations, paging paginator.Pagination, err error) { - var count int64 - - query := _i.DB.DB.Model(&entity.RequestForInformations{}) - query = query.Where("is_active = ?", true) - - _i.Log.Info().Str("timestamp", time.Now(). - Format(time.RFC3339)).Str("Service:Create", "PpidData:Create"). - Interface("Request : ", req).Msg("") - - if req.TicketNumber != nil && *req.TicketNumber != "" { - ticketNumber := strings.ToLower(*req.TicketNumber) - query = query.Where("LOWER(ticket_number) LIKE ?", "%"+strings.ToLower(ticketNumber)+"%") - } - if req.HowToGetInfo != nil && *req.HowToGetInfo != "" { - howToGetInfo := strings.ToLower(*req.HowToGetInfo) - query = query.Where("LOWER(how_to_get_info) LIKE ?", "%"+strings.ToLower(howToGetInfo)+"%") - } - if req.HowToGetFiles != nil && *req.HowToGetFiles != "" { - howToGetFiles := strings.ToLower(*req.HowToGetFiles) - query = query.Where("LOWER(how_to_get_files) LIKE ?", "%"+strings.ToLower(howToGetFiles)+"%") - } - if req.NextAction != nil && *req.NextAction != "" { - nextAction := strings.ToLower(*req.NextAction) - query = query.Where("LOWER(next_action) LIKE ?", "%"+strings.ToLower(nextAction)+"%") - } - 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(&requestForInformationss).Error - if err != nil { - return - } - - paging = *req.Pagination - - return -} - -func (_i *requestForInformationsRepository) FindOne(id uint) (requestForInformations *entity.RequestForInformations, err error) { - if err := _i.DB.DB.First(&requestForInformations, id).Error; err != nil { - return nil, err - } - - return requestForInformations, nil -} - -func (_i *requestForInformationsRepository) Create(requestForInformations *entity.RequestForInformations) (requestForInformationsReturn *entity.RequestForInformations, err error) { - result := _i.DB.DB.Create(requestForInformations) - return requestForInformations, result.Error -} - -func (_i *requestForInformationsRepository) Update(id uint, requestForInformations *entity.RequestForInformations) (err error) { - return _i.DB.DB.Model(&entity.RequestForInformations{}). - Where(&entity.RequestForInformations{ID: id}). - Updates(requestForInformations).Error -} - -func (_i *requestForInformationsRepository) Delete(id uint) error { - return _i.DB.DB.Delete(&entity.RequestForInformations{}, id).Error -} diff --git a/app/module/request_for_informations/request/request_for_informations.request.go b/app/module/request_for_informations/request/request_for_informations.request.go deleted file mode 100644 index da964ea..0000000 --- a/app/module/request_for_informations/request/request_for_informations.request.go +++ /dev/null @@ -1,102 +0,0 @@ -package request - -import ( - "go-humas-be/app/database/entity" - "go-humas-be/utils/paginator" - "strconv" - "time" -) - -type RequestForInformationsGeneric interface { - ToEntity() -} - -type RequestForInformationsQueryRequest struct { - TicketNumber *string `json:"ticketNumber"` - HowToGetInfo *string `json:"howToGetInfo"` - HowToGetFiles *string `json:"howToGetFiles"` - NextAction *string `json:"nextAction"` - CreatedById *int `json:"createdById"` - StatusId *int `json:"statusId"` - Pagination *paginator.Pagination `json:"pagination"` -} - -type RequestForInformationsCreateRequest struct { - TicketNumber string `json:"ticketNumber" validate:"required"` - HowToGetInfo string `json:"howToGetInfo" validate:"required"` - HowToGetFiles string `json:"howToGetFiles" validate:"required"` - NextAction string `json:"nextAction" validate:"required"` - StatusId int `json:"statusId" validate:"required"` -} - -func (req RequestForInformationsCreateRequest) ToEntity() *entity.RequestForInformations { - return &entity.RequestForInformations{ - TicketNumber: req.TicketNumber, - HowToGetInfo: req.HowToGetInfo, - HowToGetFiles: req.HowToGetFiles, - NextAction: req.NextAction, - StatusId: req.StatusId, - IsActive: func() *bool { b := true; return &b }(), - } -} - -type RequestForInformationsUpdateRequest struct { - ID uint `json:"id" validate:"required"` - TicketNumber string `json:"ticketNumber" validate:"required"` - HowToGetInfo string `json:"howToGetInfo" validate:"required"` - HowToGetFiles string `json:"howToGetFiles" validate:"required"` - NextAction string `json:"nextAction" validate:"required"` - StatusId int `json:"statusId" validate:"required"` -} - -func (req RequestForInformationsUpdateRequest) ToEntity() *entity.RequestForInformations { - return &entity.RequestForInformations{ - ID: req.ID, - TicketNumber: req.TicketNumber, - HowToGetInfo: req.HowToGetInfo, - HowToGetFiles: req.HowToGetFiles, - NextAction: req.NextAction, - StatusId: req.StatusId, - UpdatedAt: time.Now(), - } -} - -type RequestForInformationsQueryRequestContext struct { - TicketNumber string `json:"ticketNumber"` - HowToGetInfo string `json:"howToGetInfo"` - HowToGetFiles string `json:"howToGetFiles"` - NextAction string `json:"nextAction"` - CreatedById string `json:"createdById"` - StatusId string `json:"statusId"` -} - -func (req RequestForInformationsQueryRequestContext) ToParamRequest() RequestForInformationsQueryRequest { - var request RequestForInformationsQueryRequest - - if ticketNumber := req.TicketNumber; ticketNumber != "" { - request.TicketNumber = &ticketNumber - } - if howToGetInfo := req.HowToGetInfo; howToGetInfo != "" { - request.HowToGetInfo = &howToGetInfo - } - if howToGetFiles := req.HowToGetFiles; howToGetFiles != "" { - request.HowToGetFiles = &howToGetFiles - } - if nextAction := req.NextAction; nextAction != "" { - request.NextAction = &nextAction - } - if createdByIdStr := req.CreatedById; createdByIdStr != "" { - createdById, err := strconv.Atoi(createdByIdStr) - if err == nil { - request.CreatedById = &createdById - } - } - 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_informations/request_for_informations.module.go b/app/module/request_for_informations/request_for_informations.module.go deleted file mode 100644 index fe058bc..0000000 --- a/app/module/request_for_informations/request_for_informations.module.go +++ /dev/null @@ -1,53 +0,0 @@ -package request_for_informations - -import ( - "github.com/gofiber/fiber/v2" - "go-humas-be/app/module/request_for_informations/controller" - "go-humas-be/app/module/request_for_informations/repository" - "go-humas-be/app/module/request_for_informations/service" - "go.uber.org/fx" -) - -// struct of RequestForInformationsRouter -type RequestForInformationsRouter struct { - App fiber.Router - Controller *controller.Controller -} - -// register bulky of RequestForInformations module -var NewRequestForInformationsModule = fx.Options( - // register repository of RequestForInformations module - fx.Provide(repository.NewRequestForInformationsRepository), - - // register service of RequestForInformations module - fx.Provide(service.NewRequestForInformationsService), - - // register controller of RequestForInformations module - fx.Provide(controller.NewController), - - // register router of RequestForInformations module - fx.Provide(NewRequestForInformationsRouter), -) - -// init RequestForInformationsRouter -func NewRequestForInformationsRouter(fiber *fiber.App, controller *controller.Controller) *RequestForInformationsRouter { - return &RequestForInformationsRouter{ - App: fiber, - Controller: controller, - } -} - -// register routes of RequestForInformations module -func (_i *RequestForInformationsRouter) RegisterRequestForInformationsRoutes() { - // define controllers - requestForInformationsController := _i.Controller.RequestForInformations - - // define routes - _i.App.Route("/request-for-informations", func(router fiber.Router) { - router.Get("/", requestForInformationsController.All) - router.Get("/:id", requestForInformationsController.Show) - router.Post("/", requestForInformationsController.Save) - router.Put("/:id", requestForInformationsController.Update) - router.Delete("/:id", requestForInformationsController.Delete) - }) -} diff --git a/app/module/request_for_informations/response/request_for_informations.response.go b/app/module/request_for_informations/response/request_for_informations.response.go deleted file mode 100644 index b1fb726..0000000 --- a/app/module/request_for_informations/response/request_for_informations.response.go +++ /dev/null @@ -1,16 +0,0 @@ -package response - -import "time" - -type RequestForInformationsResponse struct { - ID uint `json:"id"` - TicketNumber string `json:"ticketNumber"` - HowToGetInfo string `json:"howToGetInfo"` - HowToGetFiles string `json:"howToGetFiles"` - NextAction string `json:"nextAction"` - CreatedById *uint `json:"createdById"` - StatusId int `json:"statusId"` - IsActive *bool `json:"isActive"` - CreatedAt time.Time `json:"createdAt"` - UpdatedAt time.Time `json:"updatedAt"` -} diff --git a/app/module/request_for_informations/service/request_for_informations.service.go b/app/module/request_for_informations/service/request_for_informations.service.go deleted file mode 100644 index d9054c1..0000000 --- a/app/module/request_for_informations/service/request_for_informations.service.go +++ /dev/null @@ -1,89 +0,0 @@ -package service - -import ( - "github.com/rs/zerolog" - "go-humas-be/app/database/entity" - "go-humas-be/app/module/request_for_informations/mapper" - "go-humas-be/app/module/request_for_informations/repository" - "go-humas-be/app/module/request_for_informations/request" - "go-humas-be/app/module/request_for_informations/response" - usersRepository "go-humas-be/app/module/users/repository" - "go-humas-be/utils/paginator" - utilSvc "go-humas-be/utils/service" -) - -// RequestForInformationsService -type requestForInformationsService struct { - Repo repository.RequestForInformationsRepository - UsersRepo usersRepository.UsersRepository - Log zerolog.Logger -} - -// RequestForInformationsService define interface of IRequestForInformationsService -type RequestForInformationsService interface { - All(req request.RequestForInformationsQueryRequest) (requestForInformations []*response.RequestForInformationsResponse, paging paginator.Pagination, err error) - Show(id uint) (requestForInformations *response.RequestForInformationsResponse, err error) - Save(req request.RequestForInformationsCreateRequest, authToken string) (requestForInformations *entity.RequestForInformations, err error) - Update(id uint, req request.RequestForInformationsUpdateRequest) (err error) - Delete(id uint) error -} - -// NewRequestForInformationsService init RequestForInformationsService -func NewRequestForInformationsService(repo repository.RequestForInformationsRepository, log zerolog.Logger, usersRepo usersRepository.UsersRepository) RequestForInformationsService { - - return &requestForInformationsService{ - Repo: repo, - Log: log, - UsersRepo: usersRepo, - } -} - -// All implement interface of RequestForInformationsService -func (_i *requestForInformationsService) All(req request.RequestForInformationsQueryRequest) (requestForInformationss []*response.RequestForInformationsResponse, paging paginator.Pagination, err error) { - results, paging, err := _i.Repo.GetAll(req) - if err != nil { - return - } - - for _, result := range results { - requestForInformationss = append(requestForInformationss, mapper.RequestForInformationsResponseMapper(result)) - } - - return -} - -func (_i *requestForInformationsService) Show(id uint) (requestForInformations *response.RequestForInformationsResponse, err error) { - result, err := _i.Repo.FindOne(id) - if err != nil { - return nil, err - } - - return mapper.RequestForInformationsResponseMapper(result), nil -} - -func (_i *requestForInformationsService) Save(req request.RequestForInformationsCreateRequest, authToken string) (requestForInformations *entity.RequestForInformations, 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 *requestForInformationsService) Update(id uint, req request.RequestForInformationsUpdateRequest) (err error) { - _i.Log.Info().Interface("data", req).Msg("") - return _i.Repo.Update(id, req.ToEntity()) -} - -func (_i *requestForInformationsService) 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 b7c9b7b..0818655 100644 --- a/app/router/api.go +++ b/app/router/api.go @@ -13,15 +13,7 @@ import ( "go-humas-be/app/module/magazines" "go-humas-be/app/module/master_menus" "go-humas-be/app/module/master_modules" - "go-humas-be/app/module/ppid_data_categories" - "go-humas-be/app/module/ppid_data_files" - "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_objection_replies" - "go-humas-be/app/module/request_for_information_replies" - "go-humas-be/app/module/request_for_informations" "go-humas-be/app/module/user_levels" "go-humas-be/app/module/user_role_accesses" "go-humas-be/app/module/user_roles" @@ -34,29 +26,21 @@ 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 - RequestForInformationObjectionRouter *request_for_information_objection.RequestForInformationObjectionRouter - RequestForInformationObjectionRepliesRouter *request_for_information_objection_replies.RequestForInformationObjectionRepliesRouter - 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 + ProvincesRouter *provinces.ProvincesRouter + UserLevelsRouter *user_levels.UserLevelsRouter + UserRoleAccessesRouter *user_role_accesses.UserRoleAccessesRouter + UserRolesRouter *user_roles.UserRolesRouter + UsersRouter *users.UsersRouter } func NewRouter( @@ -73,46 +57,30 @@ func NewRouter( magazinesRouter *magazines.MagazinesRouter, masterMenuRouter *master_menus.MasterMenusRouter, masterModuleRouter *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, - requestForInformationObjectionRepliesRouter *request_for_information_objection_replies.RequestForInformationObjectionRepliesRouter, 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, - RequestForInformationObjectionRouter: requestForInformationObjectionRouter, - RequestForInformationObjectionRepliesRouter: requestForInformationObjectionRepliesRouter, - 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, + ProvincesRouter: provincesRouter, + UserLevelsRouter: userLevelsRouter, + UserRoleAccessesRouter: userRoleAccessesRouter, + UserRolesRouter: userRolesRouter, + UsersRouter: usersRouter, } } @@ -137,15 +105,7 @@ func (r *Router) Register() { r.MagazineFilesRouter.RegisterMagazineFilesRoutes() r.MasterMenusRouter.RegisterMasterMenusRoutes() r.MasterModulesRouter.RegisterMasterModulesRoutes() - r.PpidDataCategoriesRouter.RegisterPpidDataCategoriesRoutes() - r.PpidDataFilesRouter.RegisterPpidDataFilesRoutes() - r.PpidDatasRouter.RegisterPpidDatasRoutes() r.ProvincesRouter.RegisterProvincesRoutes() - r.RequestForInformationsRouter.RegisterRequestForInformationsRoutes() - r.RequestForInformationItemsRouter.RegisterRequestForInformationItemsRoutes() - r.RequestForInformationRepliesRouter.RegisterRequestForInformationRepliesRoutes() - r.RequestForInformationObjectionRouter.RegisterRequestForInformationObjectionRoutes() - r.RequestForInformationObjectionRepliesRouter.RegisterRequestForInformationObjectionRepliesRoutes() r.UserLevelsRouter.RegisterUserLevelsRoutes() r.UserRoleAccessesRouter.RegisterUserRoleAccessesRoutes() r.UsersRouter.RegisterUsersRoutes() diff --git a/config/toml/config.toml b/config/toml/config.toml index e4b2273..40abbc6 100644 --- a/config/toml/config.toml +++ b/config/toml/config.toml @@ -4,7 +4,7 @@ name = "Fiber starter" host = "http://103.82.242.92" port = ":8800" domain = "https://103.82.242.92" -external-port = ":8888" +external-port = ":8802" idle-timeout = 5 # As seconds print-routes = false prefork = true diff --git a/docs/swagger/docs.go b/docs/swagger/docs.go index 50bb043..a43dfc3 100644 --- a/docs/swagger/docs.go +++ b/docs/swagger/docs.go @@ -3375,1708 +3375,6 @@ const docTemplate = `{ } } }, - "/ppid-data-approval-histories": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting all PpidDataApprovalHistories", - "tags": [ - "Task" - ], - "summary": "Get all PpidDataApprovalHistories", - "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 PpidDataApprovalHistories", - "tags": [ - "Task" - ], - "summary": "Create PpidDataApprovalHistories", - "parameters": [ - { - "type": "string", - "default": "Bearer \u003cAdd access token here\u003e", - "description": "Insert your access token", - "name": "Authorization", - "in": "header", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "404": { - "description": "Not Found", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "422": { - "description": "Unprocessable Entity", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.Response" - } - } - } - } - }, - "/ppid-data-approval-histories/ppid-data/:ppidDataId": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting one PpidDataApprovalHistories", - "tags": [ - "Task" - ], - "summary": "Get one PpidDataApprovalHistories", - "parameters": [ - { - "type": "integer", - "description": "PpidData ID", - "name": "ppidDataId", - "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" - } - } - } - } - }, - "/ppid-data-approval-histories/{id}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting one PpidDataApprovalHistories", - "tags": [ - "Task" - ], - "summary": "Get one PpidDataApprovalHistories", - "parameters": [ - { - "type": "integer", - "description": "PpidDataApprovalHistories 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 PpidDataApprovalHistories", - "tags": [ - "Task" - ], - "summary": "delete PpidDataApprovalHistories", - "parameters": [ - { - "type": "integer", - "description": "PpidDataApprovalHistories ID", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "404": { - "description": "Not Found", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "422": { - "description": "Unprocessable Entity", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.Response" - } - } - } - } - }, - "/ppid-data-categories": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting all PpidDataCategories", - "tags": [ - "PPID Categories" - ], - "summary": "Get all PpidDataCategories", - "parameters": [ - { - "type": "string", - "description": "Insert your access token", - "name": "Authorization", - "in": "header" - }, - { - "type": "string", - "name": "description", - "in": "query" - }, - { - "type": "string", - "name": "group", - "in": "query" - }, - { - "type": "boolean", - "name": "isOnlyTop", - "in": "query" - }, - { - "type": "boolean", - "name": "isPpidDataIncluded", - "in": "query" - }, - { - "type": "string", - "name": "levelGroup", - "in": "query" - }, - { - "type": "integer", - "name": "levelGroupId", - "in": "query" - }, - { - "type": "integer", - "name": "parentId", - "in": "query" - }, - { - "type": "string", - "name": "title", - "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 PpidDataCategories", - "tags": [ - "PPID Categories" - ], - "summary": "Create PpidDataCategories", - "parameters": [ - { - "type": "string", - "description": "Insert your access token", - "name": "Authorization", - "in": "header", - "required": true - }, - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.PpidDataCategoriesCreateRequest" - } - } - ], - "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" - } - } - } - } - }, - "/ppid-data-categories/position": { - "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for Update Position PpidDataCategories", - "tags": [ - "PPID Categories" - ], - "summary": "UpdatePosition PpidDataCategories", - "parameters": [ - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.PpidDataCategoriesUpdatePositionPayload" - } - } - ], - "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" - } - } - } - } - }, - "/ppid-data-categories/slug/{slug}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting one PpidDataCategories", - "tags": [ - "PPID Categories" - ], - "summary": "Get one PpidDataCategories", - "parameters": [ - { - "type": "string", - "description": "PpidDataCategories Slug", - "name": "slug", - "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" - } - } - } - } - }, - "/ppid-data-categories/thumbnail/viewer/{id}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for View Thumbnail of PpidDataCategories", - "tags": [ - "PPID Categories" - ], - "summary": "Viewer PpidDataCategories", - "parameters": [ - { - "type": "string", - "description": "PPID Categories 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" - } - } - } - } - }, - "/ppid-data-categories/thumbnail/{id}": { - "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for Upload PpidDataCategories Thumbnail", - "produces": [ - "application/json" - ], - "tags": [ - "PPID Categories" - ], - "summary": "Upload PpidDataCategories Thumbnail", - "parameters": [ - { - "type": "file", - "description": "Upload thumbnail", - "name": "files", - "in": "formData", - "required": true - }, - { - "type": "integer", - "description": "Ppid Data Category 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" - } - } - } - } - }, - "/ppid-data-categories/{id}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting one PpidDataCategories", - "tags": [ - "PPID Categories" - ], - "summary": "Get one PpidDataCategories", - "parameters": [ - { - "type": "integer", - "description": "PpidDataCategories 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 PpidDataCategories", - "tags": [ - "PPID Categories" - ], - "summary": "Update PpidDataCategories", - "parameters": [ - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.PpidDataCategoriesUpdateRequest" - } - }, - { - "type": "integer", - "description": "PpidDataCategories 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 PpidDataCategories", - "tags": [ - "PPID Categories" - ], - "summary": "Delete PpidDataCategories", - "parameters": [ - { - "type": "integer", - "description": "PpidDataCategories 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" - } - } - } - } - }, - "/ppid-data-files": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting all PpidDataFiles", - "tags": [ - "PPID Files" - ], - "summary": "Get all PpidDataFiles", - "parameters": [ - { - "type": "string", - "name": "description", - "in": "query" - }, - { - "type": "string", - "name": "fileType", - "in": "query" - }, - { - "type": "boolean", - "name": "isPublish", - "in": "query" - }, - { - "type": "integer", - "name": "position", - "in": "query" - }, - { - "type": "integer", - "name": "ppidDataId", - "in": "query" - }, - { - "type": "integer", - "name": "statusId", - "in": "query" - }, - { - "type": "string", - "name": "title", - "in": "query" - }, - { - "type": "string", - "name": "unit", - "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" - } - } - } - } - }, - "/ppid-data-files/update/position": { - "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for PpidDataFiles", - "tags": [ - "PPID Files" - ], - "summary": "updatePosition PpidDataFiles", - "parameters": [ - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.PpidDataFilesUpdatePositionPayload" - } - } - ], - "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" - } - } - } - } - }, - "/ppid-data-files/viewer/{filename}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for create PpidDataFiles", - "tags": [ - "PPID Files" - ], - "summary": "Create PpidDataFiles", - "parameters": [ - { - "type": "string", - "description": "Ppid Data Filename", - "name": "filename", - "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" - } - } - } - } - }, - "/ppid-data-files/{id}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting one PpidDataFiles", - "tags": [ - "PPID Files" - ], - "summary": "Get one PpidDataFiles", - "parameters": [ - { - "type": "integer", - "description": "PpidDataFiles 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 PpidDataFiles", - "tags": [ - "PPID Files" - ], - "summary": "update PpidDataFiles", - "parameters": [ - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.PpidDataFilesUpdateRequest" - } - }, - { - "type": "integer", - "description": "Ppid Data 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 PpidDataFiles", - "tags": [ - "PPID Files" - ], - "summary": "delete PpidDataFiles", - "parameters": [ - { - "type": "integer", - "description": "PpidDataFiles 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" - } - } - } - } - }, - "/ppid-data-files/{ppidDataId}": { - "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for create PpidDataFiles", - "produces": [ - "application/json" - ], - "tags": [ - "PPID Files" - ], - "summary": "Create PpidDataFiles", - "parameters": [ - { - "type": "string", - "description": "Titles", - "name": "titles", - "in": "formData" - }, - { - "type": "string", - "description": "Types", - "name": "types", - "in": "formData" - }, - { - "type": "string", - "description": "Positions", - "name": "positions", - "in": "formData" - }, - { - "type": "string", - "description": "Upload Url", - "name": "urls", - "in": "formData" - }, - { - "type": "file", - "description": "Upload File", - "name": "files", - "in": "formData" - }, - { - "type": "integer", - "description": "Ppid Data ID", - "name": "ppidDataId", - "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" - } - } - } - } - }, - "/ppid-datas": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting all PpidDatas", - "tags": [ - "PPID Data" - ], - "summary": "Get all PpidDatas", - "parameters": [ - { - "type": "string", - "default": "Bearer \u003cAdd access token here\u003e", - "description": "Insert your access token", - "name": "Authorization", - "in": "header" - }, - { - "type": "integer", - "name": "categoryId", - "in": "query" - }, - { - "type": "string", - "name": "description", - "in": "query" - }, - { - "type": "string", - "name": "group", - "in": "query" - }, - { - "type": "boolean", - "name": "isPublish", - "in": "query" - }, - { - "type": "integer", - "name": "levelGroupId", - "in": "query" - }, - { - "type": "integer", - "name": "statusId", - "in": "query" - }, - { - "type": "string", - "name": "title", - "in": "query" - }, - { - "type": "integer", - "name": "userId", - "in": "query" - }, - { - "type": "integer", - "name": "userLevelId", - "in": "query" - }, - { - "type": "integer", - "name": "userRoleId", - "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 PpidDatas", - "tags": [ - "PPID Data" - ], - "summary": "Create PpidDatas", - "parameters": [ - { - "type": "string", - "description": "Insert your access token", - "name": "Authorization", - "in": "header", - "required": true - }, - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.PpidDatasCreateRequest" - } - } - ], - "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" - } - } - } - } - }, - "/ppid-datas/approval": { - "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for UpdateApprovalStatus PpidDatas", - "tags": [ - "PPID Data" - ], - "summary": "UpdateApprovalStatus PpidDatas", - "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.PpidDataApprovalHistoriesCreateRequest" - } - } - ], - "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" - } - } - } - } - }, - "/ppid-datas/position": { - "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for Update Position PpidDatas", - "tags": [ - "PPID Data" - ], - "summary": "UpdatePosition PpidDatas", - "parameters": [ - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.PpidDatasUpdatePositionPayload" - } - } - ], - "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" - } - } - } - } - }, - "/ppid-datas/{id}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting one PpidDatas", - "tags": [ - "PPID Data" - ], - "summary": "Get one PpidDatas", - "parameters": [ - { - "type": "string", - "description": "PpidDatas [ ID / Slug ]", - "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 PpidDatas", - "tags": [ - "PPID Data" - ], - "summary": "update PpidDatas", - "parameters": [ - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.PpidDatasCreateRequest" - } - }, - { - "type": "integer", - "description": "PpidDatas 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 PpidDatas", - "tags": [ - "PPID Data" - ], - "summary": "delete PpidDatas", - "parameters": [ - { - "type": "integer", - "description": "PpidDatas 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" - } - } - } - } - }, "/provinces": { "get": { "security": [ @@ -5328,1607 +3626,6 @@ const docTemplate = `{ } } }, - "/request-for-information-items": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting all RequestForInformationItems", - "tags": [ - "RequestForInformationItems" - ], - "summary": "Get all RequestForInformationItems", - "parameters": [ - { - "type": "string", - "name": "detailedInfo", - "in": "query" - }, - { - "type": "string", - "name": "reason", - "in": "query" - }, - { - "type": "integer", - "name": "requestForInformationId", - "in": "query" - }, - { - "type": "string", - "name": "requestedInfo", - "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 RequestForInformationItems", - "tags": [ - "RequestForInformationItems" - ], - "summary": "Create RequestForInformationItems", - "parameters": [ - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.RequestForInformationItemsCreateRequest" - } - } - ], - "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-items/{id}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting one RequestForInformationItems", - "tags": [ - "RequestForInformationItems" - ], - "summary": "Get one RequestForInformationItems", - "parameters": [ - { - "type": "integer", - "description": "RequestForInformationItems 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 RequestForInformationItems", - "tags": [ - "RequestForInformationItems" - ], - "summary": "update RequestForInformationItems", - "parameters": [ - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.RequestForInformationItemsUpdateRequest" - } - }, - { - "type": "integer", - "description": "RequestForInformationItems 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 RequestForInformationItems", - "tags": [ - "RequestForInformationItems" - ], - "summary": "delete RequestForInformationItems", - "parameters": [ - { - "type": "integer", - "description": "RequestForInformationItems 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": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting all RequestForInformationObjection", - "tags": [ - "RequestForInformationObjection" - ], - "summary": "Get all RequestForInformationObjection", - "parameters": [ - { - "type": "integer", - "name": "createdById", - "in": "query" - }, - { - "type": "string", - "name": "documentName", - "in": "query" - }, - { - "type": "string", - "name": "mainReason", - "in": "query" - }, - { - "type": "integer", - "name": "requestForInformationItemId", - "in": "query" - }, - { - "type": "string", - "name": "secondaryReason", - "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 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-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}": { - "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": [ - { - "Bearer": [] - } - ], - "description": "API for getting all RequestForInformationReplies", - "tags": [ - "RequestForInformationReplies" - ], - "summary": "Get all RequestForInformationReplies", - "parameters": [ - { - "type": "integer", - "name": "createdById", - "in": "query" - }, - { - "type": "string", - "name": "fileUrl", - "in": "query" - }, - { - "type": "integer", - "name": "requestForInformationItemId", - "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 RequestForInformationReplies", - "tags": [ - "RequestForInformationReplies" - ], - "summary": "Create RequestForInformationReplies", - "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.RequestForInformationRepliesCreateRequest" - } - } - ], - "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/{id}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting one RequestForInformationReplies", - "tags": [ - "RequestForInformationReplies" - ], - "summary": "Get one RequestForInformationReplies", - "parameters": [ - { - "type": "integer", - "description": "RequestForInformationReplies 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 RequestForInformationReplies", - "tags": [ - "RequestForInformationReplies" - ], - "summary": "update RequestForInformationReplies", - "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.RequestForInformationRepliesUpdateRequest" - } - }, - { - "type": "integer", - "description": "RequestForInformationReplies 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 RequestForInformationReplies", - "tags": [ - "RequestForInformationReplies" - ], - "summary": "delete RequestForInformationReplies", - "parameters": [ - { - "type": "integer", - "description": "RequestForInformationReplies 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-informations": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting all RequestForInformations", - "tags": [ - "RequestForInformations" - ], - "summary": "Get all RequestForInformations", - "parameters": [ - { - "type": "integer", - "name": "createdById", - "in": "query" - }, - { - "type": "string", - "name": "howToGetFiles", - "in": "query" - }, - { - "type": "string", - "name": "howToGetInfo", - "in": "query" - }, - { - "type": "string", - "name": "nextAction", - "in": "query" - }, - { - "type": "integer", - "name": "statusId", - "in": "query" - }, - { - "type": "string", - "name": "ticketNumber", - "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 RequestForInformations", - "tags": [ - "RequestForInformations" - ], - "summary": "Create RequestForInformations", - "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.RequestForInformationsCreateRequest" - } - } - ], - "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-informations/{id}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting one RequestForInformations", - "tags": [ - "RequestForInformations" - ], - "summary": "Get one RequestForInformations", - "parameters": [ - { - "type": "integer", - "description": "RequestForInformations 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 RequestForInformations", - "tags": [ - "RequestForInformations" - ], - "summary": "update RequestForInformations", - "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.RequestForInformationsUpdateRequest" - } - }, - { - "type": "integer", - "description": "RequestForInformations 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 RequestForInformations", - "tags": [ - "RequestForInformations" - ], - "summary": "delete RequestForInformations", - "parameters": [ - { - "type": "integer", - "description": "RequestForInformations 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" - } - } - } - } - }, "/user-levels": { "get": { "security": [ @@ -8845,496 +5542,6 @@ const docTemplate = `{ } } }, - "request.PpidDataApprovalHistoriesCreateRequest": { - "type": "object", - "required": [ - "approvalStatusId", - "message", - "ppidDataId" - ], - "properties": { - "approvalAtLevel": { - "type": "integer" - }, - "approvalStatusId": { - "type": "integer" - }, - "message": { - "type": "string" - }, - "ppidDataId": { - "type": "integer" - } - } - }, - "request.PpidDataCategoriesCreateRequest": { - "type": "object", - "required": [ - "description", - "slug", - "title" - ], - "properties": { - "description": { - "type": "string" - }, - "parentId": { - "type": "integer" - }, - "slug": { - "type": "string" - }, - "title": { - "type": "string" - } - } - }, - "request.PpidDataCategoriesUpdatePositionPayload": { - "type": "object", - "properties": { - "positions": { - "type": "array", - "items": { - "$ref": "#/definitions/request.PpidDataCategoriesUpdatePositionRequest" - } - } - } - }, - "request.PpidDataCategoriesUpdatePositionRequest": { - "type": "object", - "required": [ - "id", - "position" - ], - "properties": { - "id": { - "type": "integer" - }, - "position": { - "type": "integer" - } - } - }, - "request.PpidDataCategoriesUpdateRequest": { - "type": "object", - "required": [ - "description", - "id", - "slug", - "title" - ], - "properties": { - "description": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "parentId": { - "type": "integer" - }, - "slug": { - "type": "string" - }, - "title": { - "type": "string" - } - } - }, - "request.PpidDataFilesUpdatePositionPayload": { - "type": "object", - "properties": { - "positions": { - "type": "array", - "items": { - "$ref": "#/definitions/request.PpidDataFilesUpdatePositionRequest" - } - } - } - }, - "request.PpidDataFilesUpdatePositionRequest": { - "type": "object", - "required": [ - "id", - "position" - ], - "properties": { - "id": { - "type": "integer" - }, - "position": { - "type": "integer" - } - } - }, - "request.PpidDataFilesUpdateRequest": { - "type": "object", - "required": [ - "id", - "ppidDataId" - ], - "properties": { - "createdById": { - "type": "integer" - }, - "filePath": { - "type": "string" - }, - "fileType": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "isPublish": { - "type": "boolean" - }, - "ppidDataId": { - "type": "integer" - }, - "publishedAt": { - "type": "string" - }, - "statusId": { - "type": "integer" - }, - "title": { - "type": "string" - } - } - }, - "request.PpidDatasCreateRequest": { - "type": "object", - "required": [ - "categoryId", - "description", - "slug", - "statusId", - "title" - ], - "properties": { - "categoryId": { - "type": "integer" - }, - "description": { - "type": "string" - }, - "group": { - "type": "string" - }, - "levelGroupId": { - "type": "integer" - }, - "slug": { - "type": "string" - }, - "statusId": { - "type": "integer" - }, - "title": { - "type": "string" - } - } - }, - "request.PpidDatasUpdatePositionPayload": { - "type": "object", - "properties": { - "positions": { - "type": "array", - "items": { - "$ref": "#/definitions/request.PpidDatasUpdatePositionRequest" - } - } - } - }, - "request.PpidDatasUpdatePositionRequest": { - "type": "object", - "required": [ - "id", - "position" - ], - "properties": { - "id": { - "type": "integer" - }, - "position": { - "type": "integer" - } - } - }, - "request.RequestForInformationItemsCreateRequest": { - "type": "object", - "required": [ - "detailedInfo", - "reason", - "requestForInformationId", - "requestedInfo", - "statusId" - ], - "properties": { - "detailedInfo": { - "type": "string" - }, - "reason": { - "type": "string" - }, - "requestForInformationId": { - "type": "integer" - }, - "requestedInfo": { - "type": "string" - }, - "statusId": { - "type": "integer" - } - } - }, - "request.RequestForInformationItemsUpdateRequest": { - "type": "object", - "required": [ - "detailedInfo", - "id", - "reason", - "requestForInformationId", - "requestedInfo", - "statusId" - ], - "properties": { - "detailedInfo": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "reason": { - "type": "string" - }, - "requestForInformationId": { - "type": "integer" - }, - "requestedInfo": { - "type": "string" - }, - "statusId": { - "type": "integer" - } - } - }, - "request.RequestForInformationObjectionCreateRequest": { - "type": "object", - "required": [ - "documentName", - "mainReason", - "requestForInformationItemId", - "secondaryReason", - "statusId" - ], - "properties": { - "documentName": { - "type": "string" - }, - "mainReason": { - "type": "string" - }, - "requestForInformationItemId": { - "type": "integer" - }, - "secondaryReason": { - "type": "string" - }, - "statusId": { - "type": "integer" - } - } - }, - "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": { - "type": "object", - "required": [ - "documentName", - "id", - "mainReason", - "requestForInformationItemId", - "secondaryReason", - "statusId" - ], - "properties": { - "documentName": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "mainReason": { - "type": "string" - }, - "requestForInformationItemId": { - "type": "integer" - }, - "secondaryReason": { - "type": "string" - }, - "statusId": { - "type": "integer" - } - } - }, - "request.RequestForInformationRepliesCreateRequest": { - "type": "object", - "required": [ - "fileUrl", - "requestForInformationItemId", - "response", - "statusId" - ], - "properties": { - "fileUrl": { - "type": "string" - }, - "requestForInformationItemId": { - "type": "integer" - }, - "response": { - "type": "string" - }, - "statusId": { - "type": "integer" - } - } - }, - "request.RequestForInformationRepliesUpdateRequest": { - "type": "object", - "required": [ - "fileUrl", - "id", - "requestForInformationItemId", - "response", - "statusId" - ], - "properties": { - "fileUrl": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "requestForInformationItemId": { - "type": "integer" - }, - "response": { - "type": "string" - }, - "statusId": { - "type": "integer" - } - } - }, - "request.RequestForInformationsCreateRequest": { - "type": "object", - "required": [ - "howToGetFiles", - "howToGetInfo", - "nextAction", - "statusId", - "ticketNumber" - ], - "properties": { - "howToGetFiles": { - "type": "string" - }, - "howToGetInfo": { - "type": "string" - }, - "nextAction": { - "type": "string" - }, - "statusId": { - "type": "integer" - }, - "ticketNumber": { - "type": "string" - } - } - }, - "request.RequestForInformationsUpdateRequest": { - "type": "object", - "required": [ - "howToGetFiles", - "howToGetInfo", - "id", - "nextAction", - "statusId", - "ticketNumber" - ], - "properties": { - "howToGetFiles": { - "type": "string" - }, - "howToGetInfo": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "nextAction": { - "type": "string" - }, - "statusId": { - "type": "integer" - }, - "ticketNumber": { - "type": "string" - } - } - }, "request.UserLevelsCreateRequest": { "type": "object", "required": [ diff --git a/docs/swagger/swagger.json b/docs/swagger/swagger.json index d4a3d51..e3b44d5 100644 --- a/docs/swagger/swagger.json +++ b/docs/swagger/swagger.json @@ -3364,1708 +3364,6 @@ } } }, - "/ppid-data-approval-histories": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting all PpidDataApprovalHistories", - "tags": [ - "Task" - ], - "summary": "Get all PpidDataApprovalHistories", - "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 PpidDataApprovalHistories", - "tags": [ - "Task" - ], - "summary": "Create PpidDataApprovalHistories", - "parameters": [ - { - "type": "string", - "default": "Bearer \u003cAdd access token here\u003e", - "description": "Insert your access token", - "name": "Authorization", - "in": "header", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "404": { - "description": "Not Found", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "422": { - "description": "Unprocessable Entity", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.Response" - } - } - } - } - }, - "/ppid-data-approval-histories/ppid-data/:ppidDataId": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting one PpidDataApprovalHistories", - "tags": [ - "Task" - ], - "summary": "Get one PpidDataApprovalHistories", - "parameters": [ - { - "type": "integer", - "description": "PpidData ID", - "name": "ppidDataId", - "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" - } - } - } - } - }, - "/ppid-data-approval-histories/{id}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting one PpidDataApprovalHistories", - "tags": [ - "Task" - ], - "summary": "Get one PpidDataApprovalHistories", - "parameters": [ - { - "type": "integer", - "description": "PpidDataApprovalHistories 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 PpidDataApprovalHistories", - "tags": [ - "Task" - ], - "summary": "delete PpidDataApprovalHistories", - "parameters": [ - { - "type": "integer", - "description": "PpidDataApprovalHistories ID", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "404": { - "description": "Not Found", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "422": { - "description": "Unprocessable Entity", - "schema": { - "$ref": "#/definitions/response.Response" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.Response" - } - } - } - } - }, - "/ppid-data-categories": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting all PpidDataCategories", - "tags": [ - "PPID Categories" - ], - "summary": "Get all PpidDataCategories", - "parameters": [ - { - "type": "string", - "description": "Insert your access token", - "name": "Authorization", - "in": "header" - }, - { - "type": "string", - "name": "description", - "in": "query" - }, - { - "type": "string", - "name": "group", - "in": "query" - }, - { - "type": "boolean", - "name": "isOnlyTop", - "in": "query" - }, - { - "type": "boolean", - "name": "isPpidDataIncluded", - "in": "query" - }, - { - "type": "string", - "name": "levelGroup", - "in": "query" - }, - { - "type": "integer", - "name": "levelGroupId", - "in": "query" - }, - { - "type": "integer", - "name": "parentId", - "in": "query" - }, - { - "type": "string", - "name": "title", - "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 PpidDataCategories", - "tags": [ - "PPID Categories" - ], - "summary": "Create PpidDataCategories", - "parameters": [ - { - "type": "string", - "description": "Insert your access token", - "name": "Authorization", - "in": "header", - "required": true - }, - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.PpidDataCategoriesCreateRequest" - } - } - ], - "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" - } - } - } - } - }, - "/ppid-data-categories/position": { - "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for Update Position PpidDataCategories", - "tags": [ - "PPID Categories" - ], - "summary": "UpdatePosition PpidDataCategories", - "parameters": [ - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.PpidDataCategoriesUpdatePositionPayload" - } - } - ], - "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" - } - } - } - } - }, - "/ppid-data-categories/slug/{slug}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting one PpidDataCategories", - "tags": [ - "PPID Categories" - ], - "summary": "Get one PpidDataCategories", - "parameters": [ - { - "type": "string", - "description": "PpidDataCategories Slug", - "name": "slug", - "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" - } - } - } - } - }, - "/ppid-data-categories/thumbnail/viewer/{id}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for View Thumbnail of PpidDataCategories", - "tags": [ - "PPID Categories" - ], - "summary": "Viewer PpidDataCategories", - "parameters": [ - { - "type": "string", - "description": "PPID Categories 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" - } - } - } - } - }, - "/ppid-data-categories/thumbnail/{id}": { - "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for Upload PpidDataCategories Thumbnail", - "produces": [ - "application/json" - ], - "tags": [ - "PPID Categories" - ], - "summary": "Upload PpidDataCategories Thumbnail", - "parameters": [ - { - "type": "file", - "description": "Upload thumbnail", - "name": "files", - "in": "formData", - "required": true - }, - { - "type": "integer", - "description": "Ppid Data Category 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" - } - } - } - } - }, - "/ppid-data-categories/{id}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting one PpidDataCategories", - "tags": [ - "PPID Categories" - ], - "summary": "Get one PpidDataCategories", - "parameters": [ - { - "type": "integer", - "description": "PpidDataCategories 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 PpidDataCategories", - "tags": [ - "PPID Categories" - ], - "summary": "Update PpidDataCategories", - "parameters": [ - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.PpidDataCategoriesUpdateRequest" - } - }, - { - "type": "integer", - "description": "PpidDataCategories 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 PpidDataCategories", - "tags": [ - "PPID Categories" - ], - "summary": "Delete PpidDataCategories", - "parameters": [ - { - "type": "integer", - "description": "PpidDataCategories 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" - } - } - } - } - }, - "/ppid-data-files": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting all PpidDataFiles", - "tags": [ - "PPID Files" - ], - "summary": "Get all PpidDataFiles", - "parameters": [ - { - "type": "string", - "name": "description", - "in": "query" - }, - { - "type": "string", - "name": "fileType", - "in": "query" - }, - { - "type": "boolean", - "name": "isPublish", - "in": "query" - }, - { - "type": "integer", - "name": "position", - "in": "query" - }, - { - "type": "integer", - "name": "ppidDataId", - "in": "query" - }, - { - "type": "integer", - "name": "statusId", - "in": "query" - }, - { - "type": "string", - "name": "title", - "in": "query" - }, - { - "type": "string", - "name": "unit", - "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" - } - } - } - } - }, - "/ppid-data-files/update/position": { - "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for PpidDataFiles", - "tags": [ - "PPID Files" - ], - "summary": "updatePosition PpidDataFiles", - "parameters": [ - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.PpidDataFilesUpdatePositionPayload" - } - } - ], - "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" - } - } - } - } - }, - "/ppid-data-files/viewer/{filename}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for create PpidDataFiles", - "tags": [ - "PPID Files" - ], - "summary": "Create PpidDataFiles", - "parameters": [ - { - "type": "string", - "description": "Ppid Data Filename", - "name": "filename", - "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" - } - } - } - } - }, - "/ppid-data-files/{id}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting one PpidDataFiles", - "tags": [ - "PPID Files" - ], - "summary": "Get one PpidDataFiles", - "parameters": [ - { - "type": "integer", - "description": "PpidDataFiles 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 PpidDataFiles", - "tags": [ - "PPID Files" - ], - "summary": "update PpidDataFiles", - "parameters": [ - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.PpidDataFilesUpdateRequest" - } - }, - { - "type": "integer", - "description": "Ppid Data 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 PpidDataFiles", - "tags": [ - "PPID Files" - ], - "summary": "delete PpidDataFiles", - "parameters": [ - { - "type": "integer", - "description": "PpidDataFiles 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" - } - } - } - } - }, - "/ppid-data-files/{ppidDataId}": { - "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for create PpidDataFiles", - "produces": [ - "application/json" - ], - "tags": [ - "PPID Files" - ], - "summary": "Create PpidDataFiles", - "parameters": [ - { - "type": "string", - "description": "Titles", - "name": "titles", - "in": "formData" - }, - { - "type": "string", - "description": "Types", - "name": "types", - "in": "formData" - }, - { - "type": "string", - "description": "Positions", - "name": "positions", - "in": "formData" - }, - { - "type": "string", - "description": "Upload Url", - "name": "urls", - "in": "formData" - }, - { - "type": "file", - "description": "Upload File", - "name": "files", - "in": "formData" - }, - { - "type": "integer", - "description": "Ppid Data ID", - "name": "ppidDataId", - "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" - } - } - } - } - }, - "/ppid-datas": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting all PpidDatas", - "tags": [ - "PPID Data" - ], - "summary": "Get all PpidDatas", - "parameters": [ - { - "type": "string", - "default": "Bearer \u003cAdd access token here\u003e", - "description": "Insert your access token", - "name": "Authorization", - "in": "header" - }, - { - "type": "integer", - "name": "categoryId", - "in": "query" - }, - { - "type": "string", - "name": "description", - "in": "query" - }, - { - "type": "string", - "name": "group", - "in": "query" - }, - { - "type": "boolean", - "name": "isPublish", - "in": "query" - }, - { - "type": "integer", - "name": "levelGroupId", - "in": "query" - }, - { - "type": "integer", - "name": "statusId", - "in": "query" - }, - { - "type": "string", - "name": "title", - "in": "query" - }, - { - "type": "integer", - "name": "userId", - "in": "query" - }, - { - "type": "integer", - "name": "userLevelId", - "in": "query" - }, - { - "type": "integer", - "name": "userRoleId", - "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 PpidDatas", - "tags": [ - "PPID Data" - ], - "summary": "Create PpidDatas", - "parameters": [ - { - "type": "string", - "description": "Insert your access token", - "name": "Authorization", - "in": "header", - "required": true - }, - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.PpidDatasCreateRequest" - } - } - ], - "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" - } - } - } - } - }, - "/ppid-datas/approval": { - "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for UpdateApprovalStatus PpidDatas", - "tags": [ - "PPID Data" - ], - "summary": "UpdateApprovalStatus PpidDatas", - "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.PpidDataApprovalHistoriesCreateRequest" - } - } - ], - "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" - } - } - } - } - }, - "/ppid-datas/position": { - "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for Update Position PpidDatas", - "tags": [ - "PPID Data" - ], - "summary": "UpdatePosition PpidDatas", - "parameters": [ - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.PpidDatasUpdatePositionPayload" - } - } - ], - "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" - } - } - } - } - }, - "/ppid-datas/{id}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting one PpidDatas", - "tags": [ - "PPID Data" - ], - "summary": "Get one PpidDatas", - "parameters": [ - { - "type": "string", - "description": "PpidDatas [ ID / Slug ]", - "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 PpidDatas", - "tags": [ - "PPID Data" - ], - "summary": "update PpidDatas", - "parameters": [ - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.PpidDatasCreateRequest" - } - }, - { - "type": "integer", - "description": "PpidDatas 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 PpidDatas", - "tags": [ - "PPID Data" - ], - "summary": "delete PpidDatas", - "parameters": [ - { - "type": "integer", - "description": "PpidDatas 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" - } - } - } - } - }, "/provinces": { "get": { "security": [ @@ -5317,1607 +3615,6 @@ } } }, - "/request-for-information-items": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting all RequestForInformationItems", - "tags": [ - "RequestForInformationItems" - ], - "summary": "Get all RequestForInformationItems", - "parameters": [ - { - "type": "string", - "name": "detailedInfo", - "in": "query" - }, - { - "type": "string", - "name": "reason", - "in": "query" - }, - { - "type": "integer", - "name": "requestForInformationId", - "in": "query" - }, - { - "type": "string", - "name": "requestedInfo", - "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 RequestForInformationItems", - "tags": [ - "RequestForInformationItems" - ], - "summary": "Create RequestForInformationItems", - "parameters": [ - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.RequestForInformationItemsCreateRequest" - } - } - ], - "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-items/{id}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting one RequestForInformationItems", - "tags": [ - "RequestForInformationItems" - ], - "summary": "Get one RequestForInformationItems", - "parameters": [ - { - "type": "integer", - "description": "RequestForInformationItems 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 RequestForInformationItems", - "tags": [ - "RequestForInformationItems" - ], - "summary": "update RequestForInformationItems", - "parameters": [ - { - "description": "Required payload", - "name": "payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.RequestForInformationItemsUpdateRequest" - } - }, - { - "type": "integer", - "description": "RequestForInformationItems 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 RequestForInformationItems", - "tags": [ - "RequestForInformationItems" - ], - "summary": "delete RequestForInformationItems", - "parameters": [ - { - "type": "integer", - "description": "RequestForInformationItems 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": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting all RequestForInformationObjection", - "tags": [ - "RequestForInformationObjection" - ], - "summary": "Get all RequestForInformationObjection", - "parameters": [ - { - "type": "integer", - "name": "createdById", - "in": "query" - }, - { - "type": "string", - "name": "documentName", - "in": "query" - }, - { - "type": "string", - "name": "mainReason", - "in": "query" - }, - { - "type": "integer", - "name": "requestForInformationItemId", - "in": "query" - }, - { - "type": "string", - "name": "secondaryReason", - "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 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-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}": { - "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": [ - { - "Bearer": [] - } - ], - "description": "API for getting all RequestForInformationReplies", - "tags": [ - "RequestForInformationReplies" - ], - "summary": "Get all RequestForInformationReplies", - "parameters": [ - { - "type": "integer", - "name": "createdById", - "in": "query" - }, - { - "type": "string", - "name": "fileUrl", - "in": "query" - }, - { - "type": "integer", - "name": "requestForInformationItemId", - "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 RequestForInformationReplies", - "tags": [ - "RequestForInformationReplies" - ], - "summary": "Create RequestForInformationReplies", - "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.RequestForInformationRepliesCreateRequest" - } - } - ], - "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/{id}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting one RequestForInformationReplies", - "tags": [ - "RequestForInformationReplies" - ], - "summary": "Get one RequestForInformationReplies", - "parameters": [ - { - "type": "integer", - "description": "RequestForInformationReplies 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 RequestForInformationReplies", - "tags": [ - "RequestForInformationReplies" - ], - "summary": "update RequestForInformationReplies", - "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.RequestForInformationRepliesUpdateRequest" - } - }, - { - "type": "integer", - "description": "RequestForInformationReplies 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 RequestForInformationReplies", - "tags": [ - "RequestForInformationReplies" - ], - "summary": "delete RequestForInformationReplies", - "parameters": [ - { - "type": "integer", - "description": "RequestForInformationReplies 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-informations": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting all RequestForInformations", - "tags": [ - "RequestForInformations" - ], - "summary": "Get all RequestForInformations", - "parameters": [ - { - "type": "integer", - "name": "createdById", - "in": "query" - }, - { - "type": "string", - "name": "howToGetFiles", - "in": "query" - }, - { - "type": "string", - "name": "howToGetInfo", - "in": "query" - }, - { - "type": "string", - "name": "nextAction", - "in": "query" - }, - { - "type": "integer", - "name": "statusId", - "in": "query" - }, - { - "type": "string", - "name": "ticketNumber", - "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 RequestForInformations", - "tags": [ - "RequestForInformations" - ], - "summary": "Create RequestForInformations", - "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.RequestForInformationsCreateRequest" - } - } - ], - "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-informations/{id}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "API for getting one RequestForInformations", - "tags": [ - "RequestForInformations" - ], - "summary": "Get one RequestForInformations", - "parameters": [ - { - "type": "integer", - "description": "RequestForInformations 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 RequestForInformations", - "tags": [ - "RequestForInformations" - ], - "summary": "update RequestForInformations", - "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.RequestForInformationsUpdateRequest" - } - }, - { - "type": "integer", - "description": "RequestForInformations 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 RequestForInformations", - "tags": [ - "RequestForInformations" - ], - "summary": "delete RequestForInformations", - "parameters": [ - { - "type": "integer", - "description": "RequestForInformations 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" - } - } - } - } - }, "/user-levels": { "get": { "security": [ @@ -8834,496 +5531,6 @@ } } }, - "request.PpidDataApprovalHistoriesCreateRequest": { - "type": "object", - "required": [ - "approvalStatusId", - "message", - "ppidDataId" - ], - "properties": { - "approvalAtLevel": { - "type": "integer" - }, - "approvalStatusId": { - "type": "integer" - }, - "message": { - "type": "string" - }, - "ppidDataId": { - "type": "integer" - } - } - }, - "request.PpidDataCategoriesCreateRequest": { - "type": "object", - "required": [ - "description", - "slug", - "title" - ], - "properties": { - "description": { - "type": "string" - }, - "parentId": { - "type": "integer" - }, - "slug": { - "type": "string" - }, - "title": { - "type": "string" - } - } - }, - "request.PpidDataCategoriesUpdatePositionPayload": { - "type": "object", - "properties": { - "positions": { - "type": "array", - "items": { - "$ref": "#/definitions/request.PpidDataCategoriesUpdatePositionRequest" - } - } - } - }, - "request.PpidDataCategoriesUpdatePositionRequest": { - "type": "object", - "required": [ - "id", - "position" - ], - "properties": { - "id": { - "type": "integer" - }, - "position": { - "type": "integer" - } - } - }, - "request.PpidDataCategoriesUpdateRequest": { - "type": "object", - "required": [ - "description", - "id", - "slug", - "title" - ], - "properties": { - "description": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "parentId": { - "type": "integer" - }, - "slug": { - "type": "string" - }, - "title": { - "type": "string" - } - } - }, - "request.PpidDataFilesUpdatePositionPayload": { - "type": "object", - "properties": { - "positions": { - "type": "array", - "items": { - "$ref": "#/definitions/request.PpidDataFilesUpdatePositionRequest" - } - } - } - }, - "request.PpidDataFilesUpdatePositionRequest": { - "type": "object", - "required": [ - "id", - "position" - ], - "properties": { - "id": { - "type": "integer" - }, - "position": { - "type": "integer" - } - } - }, - "request.PpidDataFilesUpdateRequest": { - "type": "object", - "required": [ - "id", - "ppidDataId" - ], - "properties": { - "createdById": { - "type": "integer" - }, - "filePath": { - "type": "string" - }, - "fileType": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "isPublish": { - "type": "boolean" - }, - "ppidDataId": { - "type": "integer" - }, - "publishedAt": { - "type": "string" - }, - "statusId": { - "type": "integer" - }, - "title": { - "type": "string" - } - } - }, - "request.PpidDatasCreateRequest": { - "type": "object", - "required": [ - "categoryId", - "description", - "slug", - "statusId", - "title" - ], - "properties": { - "categoryId": { - "type": "integer" - }, - "description": { - "type": "string" - }, - "group": { - "type": "string" - }, - "levelGroupId": { - "type": "integer" - }, - "slug": { - "type": "string" - }, - "statusId": { - "type": "integer" - }, - "title": { - "type": "string" - } - } - }, - "request.PpidDatasUpdatePositionPayload": { - "type": "object", - "properties": { - "positions": { - "type": "array", - "items": { - "$ref": "#/definitions/request.PpidDatasUpdatePositionRequest" - } - } - } - }, - "request.PpidDatasUpdatePositionRequest": { - "type": "object", - "required": [ - "id", - "position" - ], - "properties": { - "id": { - "type": "integer" - }, - "position": { - "type": "integer" - } - } - }, - "request.RequestForInformationItemsCreateRequest": { - "type": "object", - "required": [ - "detailedInfo", - "reason", - "requestForInformationId", - "requestedInfo", - "statusId" - ], - "properties": { - "detailedInfo": { - "type": "string" - }, - "reason": { - "type": "string" - }, - "requestForInformationId": { - "type": "integer" - }, - "requestedInfo": { - "type": "string" - }, - "statusId": { - "type": "integer" - } - } - }, - "request.RequestForInformationItemsUpdateRequest": { - "type": "object", - "required": [ - "detailedInfo", - "id", - "reason", - "requestForInformationId", - "requestedInfo", - "statusId" - ], - "properties": { - "detailedInfo": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "reason": { - "type": "string" - }, - "requestForInformationId": { - "type": "integer" - }, - "requestedInfo": { - "type": "string" - }, - "statusId": { - "type": "integer" - } - } - }, - "request.RequestForInformationObjectionCreateRequest": { - "type": "object", - "required": [ - "documentName", - "mainReason", - "requestForInformationItemId", - "secondaryReason", - "statusId" - ], - "properties": { - "documentName": { - "type": "string" - }, - "mainReason": { - "type": "string" - }, - "requestForInformationItemId": { - "type": "integer" - }, - "secondaryReason": { - "type": "string" - }, - "statusId": { - "type": "integer" - } - } - }, - "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": { - "type": "object", - "required": [ - "documentName", - "id", - "mainReason", - "requestForInformationItemId", - "secondaryReason", - "statusId" - ], - "properties": { - "documentName": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "mainReason": { - "type": "string" - }, - "requestForInformationItemId": { - "type": "integer" - }, - "secondaryReason": { - "type": "string" - }, - "statusId": { - "type": "integer" - } - } - }, - "request.RequestForInformationRepliesCreateRequest": { - "type": "object", - "required": [ - "fileUrl", - "requestForInformationItemId", - "response", - "statusId" - ], - "properties": { - "fileUrl": { - "type": "string" - }, - "requestForInformationItemId": { - "type": "integer" - }, - "response": { - "type": "string" - }, - "statusId": { - "type": "integer" - } - } - }, - "request.RequestForInformationRepliesUpdateRequest": { - "type": "object", - "required": [ - "fileUrl", - "id", - "requestForInformationItemId", - "response", - "statusId" - ], - "properties": { - "fileUrl": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "requestForInformationItemId": { - "type": "integer" - }, - "response": { - "type": "string" - }, - "statusId": { - "type": "integer" - } - } - }, - "request.RequestForInformationsCreateRequest": { - "type": "object", - "required": [ - "howToGetFiles", - "howToGetInfo", - "nextAction", - "statusId", - "ticketNumber" - ], - "properties": { - "howToGetFiles": { - "type": "string" - }, - "howToGetInfo": { - "type": "string" - }, - "nextAction": { - "type": "string" - }, - "statusId": { - "type": "integer" - }, - "ticketNumber": { - "type": "string" - } - } - }, - "request.RequestForInformationsUpdateRequest": { - "type": "object", - "required": [ - "howToGetFiles", - "howToGetInfo", - "id", - "nextAction", - "statusId", - "ticketNumber" - ], - "properties": { - "howToGetFiles": { - "type": "string" - }, - "howToGetInfo": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "nextAction": { - "type": "string" - }, - "statusId": { - "type": "integer" - }, - "ticketNumber": { - "type": "string" - } - } - }, "request.UserLevelsCreateRequest": { "type": "object", "required": [ diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index b26afc8..782d80b 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -223,344 +223,6 @@ definitions: - pathUrl - statusId type: object - request.PpidDataApprovalHistoriesCreateRequest: - properties: - approvalAtLevel: - type: integer - approvalStatusId: - type: integer - message: - type: string - ppidDataId: - type: integer - required: - - approvalStatusId - - message - - ppidDataId - type: object - request.PpidDataCategoriesCreateRequest: - properties: - description: - type: string - parentId: - type: integer - slug: - type: string - title: - type: string - required: - - description - - slug - - title - type: object - request.PpidDataCategoriesUpdatePositionPayload: - properties: - positions: - items: - $ref: '#/definitions/request.PpidDataCategoriesUpdatePositionRequest' - type: array - type: object - request.PpidDataCategoriesUpdatePositionRequest: - properties: - id: - type: integer - position: - type: integer - required: - - id - - position - type: object - request.PpidDataCategoriesUpdateRequest: - properties: - description: - type: string - id: - type: integer - parentId: - type: integer - slug: - type: string - title: - type: string - required: - - description - - id - - slug - - title - type: object - request.PpidDataFilesUpdatePositionPayload: - properties: - positions: - items: - $ref: '#/definitions/request.PpidDataFilesUpdatePositionRequest' - type: array - type: object - request.PpidDataFilesUpdatePositionRequest: - properties: - id: - type: integer - position: - type: integer - required: - - id - - position - type: object - request.PpidDataFilesUpdateRequest: - properties: - createdById: - type: integer - filePath: - type: string - fileType: - type: string - id: - type: integer - isPublish: - type: boolean - ppidDataId: - type: integer - publishedAt: - type: string - statusId: - type: integer - title: - type: string - required: - - id - - ppidDataId - type: object - request.PpidDatasCreateRequest: - properties: - categoryId: - type: integer - description: - type: string - group: - type: string - levelGroupId: - type: integer - slug: - type: string - statusId: - type: integer - title: - type: string - required: - - categoryId - - description - - slug - - statusId - - title - type: object - request.PpidDatasUpdatePositionPayload: - properties: - positions: - items: - $ref: '#/definitions/request.PpidDatasUpdatePositionRequest' - type: array - type: object - request.PpidDatasUpdatePositionRequest: - properties: - id: - type: integer - position: - type: integer - required: - - id - - position - type: object - request.RequestForInformationItemsCreateRequest: - properties: - detailedInfo: - type: string - reason: - type: string - requestForInformationId: - type: integer - requestedInfo: - type: string - statusId: - type: integer - required: - - detailedInfo - - reason - - requestForInformationId - - requestedInfo - - statusId - type: object - request.RequestForInformationItemsUpdateRequest: - properties: - detailedInfo: - type: string - id: - type: integer - reason: - type: string - requestForInformationId: - type: integer - requestedInfo: - type: string - statusId: - type: integer - required: - - detailedInfo - - id - - reason - - requestForInformationId - - requestedInfo - - statusId - type: object - request.RequestForInformationObjectionCreateRequest: - properties: - documentName: - type: string - mainReason: - type: string - requestForInformationItemId: - type: integer - secondaryReason: - type: string - statusId: - type: integer - required: - - documentName - - mainReason - - requestForInformationItemId - - secondaryReason - - statusId - 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: - properties: - documentName: - type: string - id: - type: integer - mainReason: - type: string - requestForInformationItemId: - type: integer - secondaryReason: - type: string - statusId: - type: integer - required: - - documentName - - id - - mainReason - - requestForInformationItemId - - secondaryReason - - statusId - type: object - request.RequestForInformationRepliesCreateRequest: - properties: - fileUrl: - type: string - requestForInformationItemId: - type: integer - response: - type: string - statusId: - type: integer - required: - - fileUrl - - requestForInformationItemId - - response - - statusId - type: object - request.RequestForInformationRepliesUpdateRequest: - properties: - fileUrl: - type: string - id: - type: integer - requestForInformationItemId: - type: integer - response: - type: string - statusId: - type: integer - required: - - fileUrl - - id - - requestForInformationItemId - - response - - statusId - type: object - request.RequestForInformationsCreateRequest: - properties: - howToGetFiles: - type: string - howToGetInfo: - type: string - nextAction: - type: string - statusId: - type: integer - ticketNumber: - type: string - required: - - howToGetFiles - - howToGetInfo - - nextAction - - statusId - - ticketNumber - type: object - request.RequestForInformationsUpdateRequest: - properties: - howToGetFiles: - type: string - howToGetInfo: - type: string - id: - type: integer - nextAction: - type: string - statusId: - type: integer - ticketNumber: - type: string - required: - - howToGetFiles - - howToGetInfo - - id - - nextAction - - statusId - - ticketNumber - type: object request.UserLevelsCreateRequest: properties: aliasName: @@ -3000,1080 +2662,6 @@ paths: summary: Update MasterStatuses tags: - Untags - /ppid-data-approval-histories: - get: - description: API for getting all PpidDataApprovalHistories - 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 PpidDataApprovalHistories - tags: - - Task - post: - description: API for create PpidDataApprovalHistories - parameters: - - default: Bearer - description: Insert your access token - in: header - name: Authorization - required: true - type: string - responses: - "200": - description: OK - schema: - $ref: '#/definitions/response.Response' - "401": - description: Unauthorized - schema: - $ref: '#/definitions/response.Response' - "404": - description: Not Found - schema: - $ref: '#/definitions/response.Response' - "422": - description: Unprocessable Entity - schema: - $ref: '#/definitions/response.Response' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/response.Response' - security: - - Bearer: [] - summary: Create PpidDataApprovalHistories - tags: - - Task - /ppid-data-approval-histories/{id}: - delete: - description: API for delete PpidDataApprovalHistories - parameters: - - description: PpidDataApprovalHistories ID - in: path - name: id - required: true - type: integer - responses: - "200": - description: OK - schema: - $ref: '#/definitions/response.Response' - "401": - description: Unauthorized - schema: - $ref: '#/definitions/response.Response' - "404": - description: Not Found - schema: - $ref: '#/definitions/response.Response' - "422": - description: Unprocessable Entity - schema: - $ref: '#/definitions/response.Response' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/response.Response' - security: - - Bearer: [] - summary: delete PpidDataApprovalHistories - tags: - - Task - get: - description: API for getting one PpidDataApprovalHistories - parameters: - - description: PpidDataApprovalHistories 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 PpidDataApprovalHistories - tags: - - Task - /ppid-data-approval-histories/ppid-data/:ppidDataId: - get: - description: API for getting one PpidDataApprovalHistories - parameters: - - description: PpidData ID - in: path - name: ppidDataId - 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 PpidDataApprovalHistories - tags: - - Task - /ppid-data-categories: - get: - description: API for getting all PpidDataCategories - parameters: - - description: Insert your access token - in: header - name: Authorization - type: string - - in: query - name: description - type: string - - in: query - name: group - type: string - - in: query - name: isOnlyTop - type: boolean - - in: query - name: isPpidDataIncluded - type: boolean - - in: query - name: levelGroup - type: string - - in: query - name: levelGroupId - type: integer - - in: query - name: parentId - type: integer - - in: query - name: title - type: string - - 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 PpidDataCategories - tags: - - PPID Categories - post: - description: API for create PpidDataCategories - parameters: - - 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.PpidDataCategoriesCreateRequest' - 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 PpidDataCategories - tags: - - PPID Categories - /ppid-data-categories/{id}: - delete: - description: API for delete PpidDataCategories - parameters: - - description: PpidDataCategories 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 PpidDataCategories - tags: - - PPID Categories - get: - description: API for getting one PpidDataCategories - parameters: - - description: PpidDataCategories 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 PpidDataCategories - tags: - - PPID Categories - put: - description: API for update PpidDataCategories - parameters: - - description: Required payload - in: body - name: payload - required: true - schema: - $ref: '#/definitions/request.PpidDataCategoriesUpdateRequest' - - description: PpidDataCategories 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 PpidDataCategories - tags: - - PPID Categories - /ppid-data-categories/position: - post: - description: API for Update Position PpidDataCategories - parameters: - - description: Required payload - in: body - name: payload - required: true - schema: - $ref: '#/definitions/request.PpidDataCategoriesUpdatePositionPayload' - 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: UpdatePosition PpidDataCategories - tags: - - PPID Categories - /ppid-data-categories/slug/{slug}: - get: - description: API for getting one PpidDataCategories - parameters: - - description: PpidDataCategories Slug - in: path - name: slug - required: true - type: string - 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 PpidDataCategories - tags: - - PPID Categories - /ppid-data-categories/thumbnail/{id}: - post: - description: API for Upload PpidDataCategories Thumbnail - parameters: - - description: Upload thumbnail - in: formData - name: files - required: true - type: file - - description: Ppid Data Category ID - in: path - name: id - required: true - type: integer - produces: - - application/json - 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: Upload PpidDataCategories Thumbnail - tags: - - PPID Categories - /ppid-data-categories/thumbnail/viewer/{id}: - get: - description: API for View Thumbnail of PpidDataCategories - parameters: - - description: PPID Categories ID - in: path - name: id - required: true - type: string - 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: Viewer PpidDataCategories - tags: - - PPID Categories - /ppid-data-files: - get: - description: API for getting all PpidDataFiles - parameters: - - in: query - name: description - type: string - - in: query - name: fileType - type: string - - in: query - name: isPublish - type: boolean - - in: query - name: position - type: integer - - in: query - name: ppidDataId - type: integer - - in: query - name: statusId - type: integer - - in: query - name: title - type: string - - in: query - name: unit - type: string - - 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 PpidDataFiles - tags: - - PPID Files - /ppid-data-files/{id}: - delete: - description: API for delete PpidDataFiles - parameters: - - description: PpidDataFiles 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 PpidDataFiles - tags: - - PPID Files - get: - description: API for getting one PpidDataFiles - parameters: - - description: PpidDataFiles 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 PpidDataFiles - tags: - - PPID Files - put: - description: API for update PpidDataFiles - parameters: - - description: Required payload - in: body - name: payload - required: true - schema: - $ref: '#/definitions/request.PpidDataFilesUpdateRequest' - - description: Ppid Data 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 PpidDataFiles - tags: - - PPID Files - /ppid-data-files/{ppidDataId}: - post: - description: API for create PpidDataFiles - parameters: - - description: Titles - in: formData - name: titles - type: string - - description: Types - in: formData - name: types - type: string - - description: Positions - in: formData - name: positions - type: string - - description: Upload Url - in: formData - name: urls - type: string - - description: Upload File - in: formData - name: files - type: file - - description: Ppid Data ID - in: path - name: ppidDataId - required: true - type: integer - produces: - - application/json - 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 PpidDataFiles - tags: - - PPID Files - /ppid-data-files/update/position: - post: - description: API for PpidDataFiles - parameters: - - description: Required payload - in: body - name: payload - required: true - schema: - $ref: '#/definitions/request.PpidDataFilesUpdatePositionPayload' - 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: updatePosition PpidDataFiles - tags: - - PPID Files - /ppid-data-files/viewer/{filename}: - get: - description: API for create PpidDataFiles - parameters: - - description: Ppid Data Filename - in: path - name: filename - required: true - type: string - 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 PpidDataFiles - tags: - - PPID Files - /ppid-datas: - get: - description: API for getting all PpidDatas - parameters: - - default: Bearer - description: Insert your access token - in: header - name: Authorization - type: string - - in: query - name: categoryId - type: integer - - in: query - name: description - type: string - - in: query - name: group - type: string - - in: query - name: isPublish - type: boolean - - in: query - name: levelGroupId - type: integer - - in: query - name: statusId - type: integer - - in: query - name: title - type: string - - in: query - name: userId - type: integer - - in: query - name: userLevelId - type: integer - - in: query - name: userRoleId - 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 PpidDatas - tags: - - PPID Data - post: - description: API for create PpidDatas - parameters: - - 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.PpidDatasCreateRequest' - 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 PpidDatas - tags: - - PPID Data - /ppid-datas/{id}: - delete: - description: API for delete PpidDatas - parameters: - - description: PpidDatas 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 PpidDatas - tags: - - PPID Data - get: - description: API for getting one PpidDatas - parameters: - - description: PpidDatas [ ID / Slug ] - in: path - name: id - required: true - type: string - 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 PpidDatas - tags: - - PPID Data - put: - description: API for update PpidDatas - parameters: - - description: Required payload - in: body - name: payload - required: true - schema: - $ref: '#/definitions/request.PpidDatasCreateRequest' - - description: PpidDatas 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 PpidDatas - tags: - - PPID Data - /ppid-datas/approval: - post: - description: API for UpdateApprovalStatus PpidDatas - 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.PpidDataApprovalHistoriesCreateRequest' - 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: UpdateApprovalStatus PpidDatas - tags: - - PPID Data - /ppid-datas/position: - post: - description: API for Update Position PpidDatas - parameters: - - description: Required payload - in: body - name: payload - required: true - schema: - $ref: '#/definitions/request.PpidDatasUpdatePositionPayload' - 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: UpdatePosition PpidDatas - tags: - - PPID Data /provinces: get: description: API for getting all Provinces @@ -4234,1016 +2822,6 @@ paths: summary: Update Provinces tags: - Untags - /request-for-information-items: - get: - description: API for getting all RequestForInformationItems - parameters: - - in: query - name: detailedInfo - type: string - - in: query - name: reason - type: string - - in: query - name: requestForInformationId - type: integer - - in: query - name: requestedInfo - 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 RequestForInformationItems - tags: - - RequestForInformationItems - post: - description: API for create RequestForInformationItems - parameters: - - description: Required payload - in: body - name: payload - required: true - schema: - $ref: '#/definitions/request.RequestForInformationItemsCreateRequest' - 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 RequestForInformationItems - tags: - - RequestForInformationItems - /request-for-information-items/{id}: - delete: - description: API for delete RequestForInformationItems - parameters: - - description: RequestForInformationItems 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 RequestForInformationItems - tags: - - RequestForInformationItems - get: - description: API for getting one RequestForInformationItems - parameters: - - description: RequestForInformationItems 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 RequestForInformationItems - tags: - - RequestForInformationItems - put: - description: API for update RequestForInformationItems - parameters: - - description: Required payload - in: body - name: payload - required: true - schema: - $ref: '#/definitions/request.RequestForInformationItemsUpdateRequest' - - description: RequestForInformationItems 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 RequestForInformationItems - tags: - - RequestForInformationItems - /request-for-information-objection: - get: - description: API for getting all RequestForInformationObjection - parameters: - - in: query - name: createdById - type: integer - - in: query - name: documentName - type: string - - in: query - name: mainReason - type: string - - in: query - name: requestForInformationItemId - type: integer - - in: query - name: secondaryReason - 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 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-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 - 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}: - 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 - parameters: - - in: query - name: createdById - type: integer - - in: query - name: fileUrl - type: string - - in: query - name: requestForInformationItemId - 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 RequestForInformationReplies - tags: - - RequestForInformationReplies - post: - description: API for create RequestForInformationReplies - 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.RequestForInformationRepliesCreateRequest' - 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 RequestForInformationReplies - tags: - - RequestForInformationReplies - /request-for-information-replies/{id}: - delete: - description: API for delete RequestForInformationReplies - parameters: - - description: RequestForInformationReplies 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 RequestForInformationReplies - tags: - - RequestForInformationReplies - get: - description: API for getting one RequestForInformationReplies - parameters: - - description: RequestForInformationReplies 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 RequestForInformationReplies - tags: - - RequestForInformationReplies - put: - description: API for update RequestForInformationReplies - 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.RequestForInformationRepliesUpdateRequest' - - description: RequestForInformationReplies 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 RequestForInformationReplies - tags: - - RequestForInformationReplies - /request-for-informations: - get: - description: API for getting all RequestForInformations - parameters: - - in: query - name: createdById - type: integer - - in: query - name: howToGetFiles - type: string - - in: query - name: howToGetInfo - type: string - - in: query - name: nextAction - type: string - - in: query - name: statusId - type: integer - - in: query - name: ticketNumber - type: string - - 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 RequestForInformations - tags: - - RequestForInformations - post: - description: API for create RequestForInformations - 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.RequestForInformationsCreateRequest' - 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 RequestForInformations - tags: - - RequestForInformations - /request-for-informations/{id}: - delete: - description: API for delete RequestForInformations - parameters: - - description: RequestForInformations 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 RequestForInformations - tags: - - RequestForInformations - get: - description: API for getting one RequestForInformations - parameters: - - description: RequestForInformations 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 RequestForInformations - tags: - - RequestForInformations - put: - description: API for update RequestForInformations - 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.RequestForInformationsUpdateRequest' - - description: RequestForInformations 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 RequestForInformations - tags: - - RequestForInformations /user-levels: get: description: API for getting all UserLevels diff --git a/main.go b/main.go index ea2e939..5300658 100644 --- a/main.go +++ b/main.go @@ -14,16 +14,7 @@ import ( "go-humas-be/app/module/magazines" "go-humas-be/app/module/master_menus" "go-humas-be/app/module/master_modules" - "go-humas-be/app/module/ppid_data_approval_histories" - "go-humas-be/app/module/ppid_data_categories" - "go-humas-be/app/module/ppid_data_files" - "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_objection_replies" - "go-humas-be/app/module/request_for_information_replies" - "go-humas-be/app/module/request_for_informations" "go-humas-be/app/module/user_levels" "go-humas-be/app/module/user_role_accesses" "go-humas-be/app/module/user_role_level_details" @@ -68,21 +59,12 @@ func main() { magazine_files.NewMagazineFilesModule, master_menus.NewMasterMenusModule, master_modules.NewMasterModulesModule, - ppid_data_files.NewPpidDataFilesModule, - ppid_data_categories.NewPpidDataCategoriesModule, - ppid_data_approval_histories.NewPpidDataApprovalHistoriesModule, - ppid_datas.NewPpidDatasModule, provinces.NewProvincesModule, user_levels.NewUserLevelsModule, user_roles.NewUserRolesModule, user_role_accesses.NewUserRoleAccessesModule, users.NewUsersModule, user_role_level_details.NewUserRoleLevelDetailsModule, - request_for_informations.NewRequestForInformationsModule, - request_for_information_items.NewRequestForInformationItemsModule, - request_for_information_replies.NewRequestForInformationRepliesModule, - request_for_information_objection.NewRequestForInformationObjectionModule, - request_for_information_objection_replies.NewRequestForInformationObjectionRepliesModule, // start aplication fx.Invoke(webserver.Start),