From 16b8093e8c5e305784697254e386ad051c7e9a96 Mon Sep 17 00:00:00 2001 From: AMiR Date: Mon, 20 May 2024 21:07:44 +0330 Subject: [PATCH] "fix(niki):fixed some small bugs" --- Makefile | 5 ++++- docs/docs.go | 10 ---------- docs/swagger.json | 10 ---------- docs/swagger.yaml | 7 ------- param/admin/kind_box_req/accept.go | 2 +- param/admin/kind_box_req/assign_sender_agent.go | 2 +- param/admin/kind_box_req/deliver.go | 2 +- param/admin/kind_box_req/reject.go | 2 +- .../mysql/migration/1705244015_create_admins_table.sql | 2 +- 9 files changed, 9 insertions(+), 33 deletions(-) diff --git a/Makefile b/Makefile index f30ee83..9b6fe7a 100644 --- a/Makefile +++ b/Makefile @@ -24,4 +24,7 @@ run: go run main.go --migrate docker: - sudo docker compose up -d \ No newline at end of file + sudo docker compose up -d + +swagger: + swag init \ No newline at end of file diff --git a/docs/docs.go b/docs/docs.go index 8dc0080..103adc5 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -751,9 +751,6 @@ const docTemplate = `{ "adminkindboxreqparam.AssignSenderRequest": { "type": "object", "properties": { - "kind_box_req_id": { - "type": "integer" - }, "sender_agent_id": { "type": "integer" } @@ -770,9 +767,6 @@ const docTemplate = `{ "properties": { "count_accepted": { "type": "integer" - }, - "id": { - "type": "integer" } } }, @@ -819,10 +813,6 @@ const docTemplate = `{ "description": { "type": "string", "example": "description" - }, - "id": { - "type": "integer", - "example": 1 } } }, diff --git a/docs/swagger.json b/docs/swagger.json index 65e5bf8..1eff7ef 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -740,9 +740,6 @@ "adminkindboxreqparam.AssignSenderRequest": { "type": "object", "properties": { - "kind_box_req_id": { - "type": "integer" - }, "sender_agent_id": { "type": "integer" } @@ -759,9 +756,6 @@ "properties": { "count_accepted": { "type": "integer" - }, - "id": { - "type": "integer" } } }, @@ -808,10 +802,6 @@ "description": { "type": "string", "example": "description" - }, - "id": { - "type": "integer", - "example": 1 } } }, diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 3ca3877..890793f 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -44,8 +44,6 @@ definitions: type: object adminkindboxreqparam.AssignSenderRequest: properties: - kind_box_req_id: - type: integer sender_agent_id: type: integer type: object @@ -57,8 +55,6 @@ definitions: properties: count_accepted: type: integer - id: - type: integer type: object adminkindboxreqparam.KindBoxReqAcceptResponse: properties: @@ -89,9 +85,6 @@ definitions: description: example: description type: string - id: - example: 1 - type: integer type: object adminkindboxreqparam.KindBoxReqRejectResponse: properties: diff --git a/param/admin/kind_box_req/accept.go b/param/admin/kind_box_req/accept.go index df243e0..0598b49 100644 --- a/param/admin/kind_box_req/accept.go +++ b/param/admin/kind_box_req/accept.go @@ -7,7 +7,7 @@ import ( ) type KindBoxReqAcceptRequest struct { - ID uint `json:"id"` + ID uint `json:"-"` CountAccepted uint `json:"count_accepted"` } diff --git a/param/admin/kind_box_req/assign_sender_agent.go b/param/admin/kind_box_req/assign_sender_agent.go index b63144a..976e73c 100644 --- a/param/admin/kind_box_req/assign_sender_agent.go +++ b/param/admin/kind_box_req/assign_sender_agent.go @@ -1,7 +1,7 @@ package adminkindboxreqparam type AssignSenderRequest struct { - KindBoxReqID uint `json:"kind_box_req_id"` + KindBoxReqID uint `json:"-"` SenderAgentID uint `json:"sender_agent_id"` } diff --git a/param/admin/kind_box_req/deliver.go b/param/admin/kind_box_req/deliver.go index d1c1b91..8bd660f 100644 --- a/param/admin/kind_box_req/deliver.go +++ b/param/admin/kind_box_req/deliver.go @@ -1,7 +1,7 @@ package adminkindboxreqparam type DeliverKindBoxReqRequest struct { - KindBoxReqID uint `json:"kind_box_req_id"` + KindBoxReqID uint `json:"-"` } type DeliverKindBoxReqResponse struct{} diff --git a/param/admin/kind_box_req/reject.go b/param/admin/kind_box_req/reject.go index a438913..8d5a3d9 100644 --- a/param/admin/kind_box_req/reject.go +++ b/param/admin/kind_box_req/reject.go @@ -7,7 +7,7 @@ import ( ) type KindBoxReqRejectRequest struct { - ID uint `json:"id" example:"1"` + ID uint `json:"-"` Description string `json:"description" example:"description"` } diff --git a/repository/mysql/migration/1705244015_create_admins_table.sql b/repository/mysql/migration/1705244015_create_admins_table.sql index 7b6a853..15e8a29 100644 --- a/repository/mysql/migration/1705244015_create_admins_table.sql +++ b/repository/mysql/migration/1705244015_create_admins_table.sql @@ -5,7 +5,7 @@ CREATE TABLE `admins` ( `last_name` VARCHAR(191), `password` VARCHAR(191) NOT NULL, `phone_number` VARCHAR(191) NOT NULL UNIQUE, - `role` ENUM('super-admin','admin','agent') NOT NULL, -- default? + `role` ENUM('super-admin','admin','agent') NOT NULL DEFAULT 'admin', `description` TEXT, `email` VARCHAR(191) NOT NULL UNIQUE, `gender` ENUM('male','female'),