From 3edbd8b193c85dbe95a69ac347ef77868e5f05c1 Mon Sep 17 00:00:00 2001 From: renaldybrada Date: Mon, 2 Feb 2026 09:24:11 +0700 Subject: [PATCH] dokumentasi antrian operasi --- docs/docs.go | 438 +++++++++++++++++- docs/swagger.json | 438 +++++++++++++++++- docs/swagger.yaml | 284 +++++++++++- internal/domain/antrian_operasi/handler.go | 14 + internal/domain/reference/dokter/handler.go | 6 +- internal/domain/reference/kategori/handler.go | 15 +- internal/domain/reference/kategori/model.go | 2 +- .../domain/reference/spesialis/handler.go | 31 +- .../domain/reference/spesialis/repository.go | 2 + internal/shared/baseResponse.go | 2 +- 10 files changed, 1222 insertions(+), 10 deletions(-) diff --git a/docs/docs.go b/docs/docs.go index 31be9af..ed38ae3 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -15,12 +15,84 @@ const docTemplate = `{ "host": "{{.Host}}", "basePath": "{{.BasePath}}", "paths": { + "/antrian-operasi/": { + "get": { + "tags": [ + "Antrian Operasi" + ], + "summary": "Get List Antrian Operasi", + "parameters": [ + { + "type": "string", + "description": "Search Keyword", + "name": "search", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/antrianoperasi.PasienOperasi" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/shared.BaseErrorResponse" + } + } + } + }, + "post": { + "tags": [ + "Antrian Operasi" + ], + "summary": "Create Antrian Operasi", + "parameters": [ + { + "description": "Create Pasien Operasi", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/antrianoperasi.CreatePasienOperasiRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/shared.BaseResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/shared.BaseErrorResponse" + } + } + } + } + }, "/dokter/": { "get": { "tags": [ - "dokter" + "Dokter" ], "summary": "Get List Dokter", + "parameters": [ + { + "type": "string", + "description": "Search keyword", + "name": "search", + "in": "query" + } + ], "responses": { "200": { "description": "OK", @@ -39,9 +111,295 @@ const docTemplate = `{ } } } + }, + "/kategori/": { + "get": { + "tags": [ + "Kategori Operasi" + ], + "summary": "Get List Kategori Operasi", + "parameters": [ + { + "type": "string", + "description": "Search keyword", + "name": "search", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/kategori.KategoriOperasiModel" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/shared.BaseErrorResponse" + } + } + } + } + }, + "/spesialis/": { + "get": { + "tags": [ + "Spesialis" + ], + "summary": "Get List Spesialis", + "parameters": [ + { + "type": "string", + "description": "Search keyword", + "name": "search", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/spesialis.SpesialisModel" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/shared.BaseErrorResponse" + } + } + } + } + }, + "/sub-spesialis/": { + "get": { + "tags": [ + "Spesialis" + ], + "summary": "Get List Sub Spesialis", + "parameters": [ + { + "type": "string", + "description": "Search keyword", + "name": "search", + "in": "query" + }, + { + "type": "integer", + "description": "Filter by Id Spesialis", + "name": "id_spesialis", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/spesialis.SubSpesialisModel" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/shared.BaseErrorResponse" + } + } + } + } } }, "definitions": { + "antrianoperasi.CreatePasienOperasiRequest": { + "type": "object", + "properties": { + "diagnosisItems": { + "type": "array", + "items": { + "$ref": "#/definitions/antrianoperasi.DiagnosisItemRequest" + } + }, + "dokterPelaksanaItems": { + "type": "array", + "items": { + "$ref": "#/definitions/antrianoperasi.DokterPelaksanaItemRequest" + } + }, + "formData": { + "$ref": "#/definitions/antrianoperasi.FormDataRequest" + }, + "rencanaOperasiData": { + "$ref": "#/definitions/antrianoperasi.RencanaOperasiRequest" + }, + "statusPasienData": { + "$ref": "#/definitions/antrianoperasi.StatusPasienRequest" + }, + "tindakanItems": { + "type": "array", + "items": { + "$ref": "#/definitions/antrianoperasi.TindakanItemRequest" + } + } + } + }, + "antrianoperasi.DiagnosisItemRequest": { + "type": "object", + "properties": { + "diagnosa": { + "type": "string" + }, + "jenisDiagnosa": { + "type": "string" + }, + "kodeDiagnosa": { + "type": "string" + } + } + }, + "antrianoperasi.DokterPelaksanaItemRequest": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "nama": { + "type": "string" + }, + "nip": { + "type": "string" + }, + "satuan_kerja": { + "type": "string" + } + } + }, + "antrianoperasi.FormDataRequest": { + "type": "object", + "properties": { + "alamat": { + "type": "string" + }, + "jenisKelamin": { + "type": "string" + }, + "namaPasien": { + "type": "string" + }, + "noKtp": { + "type": "string" + }, + "noRekamMedis": { + "type": "string" + }, + "nomorTelepon": { + "type": "array", + "items": { + "type": "string" + } + }, + "tanggalLahir": { + "type": "string" + }, + "umur": { + "type": "string" + } + } + }, + "antrianoperasi.PasienOperasi": { + "type": "object", + "properties": { + "diagnosa": { + "type": "string" + }, + "id": { + "type": "string" + }, + "kategori": { + "type": "string" + }, + "kodeDiagnosa": { + "type": "string" + }, + "namaPasien": { + "type": "string" + }, + "noKtp": { + "type": "string" + }, + "noRekamMedis": { + "type": "string" + }, + "spesialis": { + "type": "string" + }, + "subSpesialis": { + "type": "string" + }, + "tglDaftar": { + "type": "string" + } + } + }, + "antrianoperasi.RencanaOperasiRequest": { + "type": "object", + "properties": { + "kategoriOperasi": { + "type": "integer" + }, + "keterangan": { + "type": "string" + }, + "rencanaOperasi": { + "type": "string" + }, + "spesialis": { + "type": "integer" + }, + "subSpesialis": { + "type": "integer" + }, + "tanggalDaftar": { + "type": "string" + } + } + }, + "antrianoperasi.StatusPasienRequest": { + "type": "object", + "properties": { + "keteranganStatus": { + "type": "string" + }, + "statusOperasi": { + "type": "string" + }, + "tanggalSelesai": { + "type": "string" + } + } + }, + "antrianoperasi.TindakanItemRequest": { + "type": "object", + "properties": { + "kodeTindakan": { + "type": "string" + }, + "tindakan": { + "type": "string" + }, + "tindakanTambahan": { + "type": "string" + } + } + }, "dokter.DokterResponse": { "type": "object", "properties": { @@ -62,6 +420,30 @@ const docTemplate = `{ } } }, + "kategori.KategoriOperasiModel": { + "type": "object", + "properties": { + "date_created": { + "type": "string" + }, + "date_updated": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "kategori": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "draft", + "published" + ] + } + } + }, "shared.BaseErrorResponse": { "type": "object", "properties": { @@ -81,6 +463,60 @@ const docTemplate = `{ "type": "boolean" } } + }, + "shared.BaseResponse": { + "type": "object", + "properties": { + "code": { + "type": "integer" + }, + "data": { + "type": "object" + }, + "message": { + "type": "string" + }, + "success": { + "type": "boolean" + } + } + }, + "spesialis.SpesialisModel": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "kode": { + "type": "string" + }, + "spesialis": { + "type": "string" + } + } + }, + "spesialis.SubSpesialisModel": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "id_spesialis": { + "type": "integer" + }, + "kode": { + "type": "string" + }, + "kode_spesialis": { + "type": "string" + }, + "spesialis": { + "type": "string" + }, + "sub_spesialis": { + "type": "string" + } + } } } }` diff --git a/docs/swagger.json b/docs/swagger.json index 7c72801..770639f 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -9,12 +9,84 @@ "host": "localhost:8080", "basePath": "/api", "paths": { + "/antrian-operasi/": { + "get": { + "tags": [ + "Antrian Operasi" + ], + "summary": "Get List Antrian Operasi", + "parameters": [ + { + "type": "string", + "description": "Search Keyword", + "name": "search", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/antrianoperasi.PasienOperasi" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/shared.BaseErrorResponse" + } + } + } + }, + "post": { + "tags": [ + "Antrian Operasi" + ], + "summary": "Create Antrian Operasi", + "parameters": [ + { + "description": "Create Pasien Operasi", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/antrianoperasi.CreatePasienOperasiRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/shared.BaseResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/shared.BaseErrorResponse" + } + } + } + } + }, "/dokter/": { "get": { "tags": [ - "dokter" + "Dokter" ], "summary": "Get List Dokter", + "parameters": [ + { + "type": "string", + "description": "Search keyword", + "name": "search", + "in": "query" + } + ], "responses": { "200": { "description": "OK", @@ -33,9 +105,295 @@ } } } + }, + "/kategori/": { + "get": { + "tags": [ + "Kategori Operasi" + ], + "summary": "Get List Kategori Operasi", + "parameters": [ + { + "type": "string", + "description": "Search keyword", + "name": "search", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/kategori.KategoriOperasiModel" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/shared.BaseErrorResponse" + } + } + } + } + }, + "/spesialis/": { + "get": { + "tags": [ + "Spesialis" + ], + "summary": "Get List Spesialis", + "parameters": [ + { + "type": "string", + "description": "Search keyword", + "name": "search", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/spesialis.SpesialisModel" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/shared.BaseErrorResponse" + } + } + } + } + }, + "/sub-spesialis/": { + "get": { + "tags": [ + "Spesialis" + ], + "summary": "Get List Sub Spesialis", + "parameters": [ + { + "type": "string", + "description": "Search keyword", + "name": "search", + "in": "query" + }, + { + "type": "integer", + "description": "Filter by Id Spesialis", + "name": "id_spesialis", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/spesialis.SubSpesialisModel" + } + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/shared.BaseErrorResponse" + } + } + } + } } }, "definitions": { + "antrianoperasi.CreatePasienOperasiRequest": { + "type": "object", + "properties": { + "diagnosisItems": { + "type": "array", + "items": { + "$ref": "#/definitions/antrianoperasi.DiagnosisItemRequest" + } + }, + "dokterPelaksanaItems": { + "type": "array", + "items": { + "$ref": "#/definitions/antrianoperasi.DokterPelaksanaItemRequest" + } + }, + "formData": { + "$ref": "#/definitions/antrianoperasi.FormDataRequest" + }, + "rencanaOperasiData": { + "$ref": "#/definitions/antrianoperasi.RencanaOperasiRequest" + }, + "statusPasienData": { + "$ref": "#/definitions/antrianoperasi.StatusPasienRequest" + }, + "tindakanItems": { + "type": "array", + "items": { + "$ref": "#/definitions/antrianoperasi.TindakanItemRequest" + } + } + } + }, + "antrianoperasi.DiagnosisItemRequest": { + "type": "object", + "properties": { + "diagnosa": { + "type": "string" + }, + "jenisDiagnosa": { + "type": "string" + }, + "kodeDiagnosa": { + "type": "string" + } + } + }, + "antrianoperasi.DokterPelaksanaItemRequest": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "nama": { + "type": "string" + }, + "nip": { + "type": "string" + }, + "satuan_kerja": { + "type": "string" + } + } + }, + "antrianoperasi.FormDataRequest": { + "type": "object", + "properties": { + "alamat": { + "type": "string" + }, + "jenisKelamin": { + "type": "string" + }, + "namaPasien": { + "type": "string" + }, + "noKtp": { + "type": "string" + }, + "noRekamMedis": { + "type": "string" + }, + "nomorTelepon": { + "type": "array", + "items": { + "type": "string" + } + }, + "tanggalLahir": { + "type": "string" + }, + "umur": { + "type": "string" + } + } + }, + "antrianoperasi.PasienOperasi": { + "type": "object", + "properties": { + "diagnosa": { + "type": "string" + }, + "id": { + "type": "string" + }, + "kategori": { + "type": "string" + }, + "kodeDiagnosa": { + "type": "string" + }, + "namaPasien": { + "type": "string" + }, + "noKtp": { + "type": "string" + }, + "noRekamMedis": { + "type": "string" + }, + "spesialis": { + "type": "string" + }, + "subSpesialis": { + "type": "string" + }, + "tglDaftar": { + "type": "string" + } + } + }, + "antrianoperasi.RencanaOperasiRequest": { + "type": "object", + "properties": { + "kategoriOperasi": { + "type": "integer" + }, + "keterangan": { + "type": "string" + }, + "rencanaOperasi": { + "type": "string" + }, + "spesialis": { + "type": "integer" + }, + "subSpesialis": { + "type": "integer" + }, + "tanggalDaftar": { + "type": "string" + } + } + }, + "antrianoperasi.StatusPasienRequest": { + "type": "object", + "properties": { + "keteranganStatus": { + "type": "string" + }, + "statusOperasi": { + "type": "string" + }, + "tanggalSelesai": { + "type": "string" + } + } + }, + "antrianoperasi.TindakanItemRequest": { + "type": "object", + "properties": { + "kodeTindakan": { + "type": "string" + }, + "tindakan": { + "type": "string" + }, + "tindakanTambahan": { + "type": "string" + } + } + }, "dokter.DokterResponse": { "type": "object", "properties": { @@ -56,6 +414,30 @@ } } }, + "kategori.KategoriOperasiModel": { + "type": "object", + "properties": { + "date_created": { + "type": "string" + }, + "date_updated": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "kategori": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "draft", + "published" + ] + } + } + }, "shared.BaseErrorResponse": { "type": "object", "properties": { @@ -75,6 +457,60 @@ "type": "boolean" } } + }, + "shared.BaseResponse": { + "type": "object", + "properties": { + "code": { + "type": "integer" + }, + "data": { + "type": "object" + }, + "message": { + "type": "string" + }, + "success": { + "type": "boolean" + } + } + }, + "spesialis.SpesialisModel": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "kode": { + "type": "string" + }, + "spesialis": { + "type": "string" + } + } + }, + "spesialis.SubSpesialisModel": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "id_spesialis": { + "type": "integer" + }, + "kode": { + "type": "string" + }, + "kode_spesialis": { + "type": "string" + }, + "spesialis": { + "type": "string" + }, + "sub_spesialis": { + "type": "string" + } + } } } } \ No newline at end of file diff --git a/docs/swagger.yaml b/docs/swagger.yaml index e00484e..df66577 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1,5 +1,123 @@ basePath: /api definitions: + antrianoperasi.CreatePasienOperasiRequest: + properties: + diagnosisItems: + items: + $ref: '#/definitions/antrianoperasi.DiagnosisItemRequest' + type: array + dokterPelaksanaItems: + items: + $ref: '#/definitions/antrianoperasi.DokterPelaksanaItemRequest' + type: array + formData: + $ref: '#/definitions/antrianoperasi.FormDataRequest' + rencanaOperasiData: + $ref: '#/definitions/antrianoperasi.RencanaOperasiRequest' + statusPasienData: + $ref: '#/definitions/antrianoperasi.StatusPasienRequest' + tindakanItems: + items: + $ref: '#/definitions/antrianoperasi.TindakanItemRequest' + type: array + type: object + antrianoperasi.DiagnosisItemRequest: + properties: + diagnosa: + type: string + jenisDiagnosa: + type: string + kodeDiagnosa: + type: string + type: object + antrianoperasi.DokterPelaksanaItemRequest: + properties: + id: + type: string + nama: + type: string + nip: + type: string + satuan_kerja: + type: string + type: object + antrianoperasi.FormDataRequest: + properties: + alamat: + type: string + jenisKelamin: + type: string + namaPasien: + type: string + noKtp: + type: string + noRekamMedis: + type: string + nomorTelepon: + items: + type: string + type: array + tanggalLahir: + type: string + umur: + type: string + type: object + antrianoperasi.PasienOperasi: + properties: + diagnosa: + type: string + id: + type: string + kategori: + type: string + kodeDiagnosa: + type: string + namaPasien: + type: string + noKtp: + type: string + noRekamMedis: + type: string + spesialis: + type: string + subSpesialis: + type: string + tglDaftar: + type: string + type: object + antrianoperasi.RencanaOperasiRequest: + properties: + kategoriOperasi: + type: integer + keterangan: + type: string + rencanaOperasi: + type: string + spesialis: + type: integer + subSpesialis: + type: integer + tanggalDaftar: + type: string + type: object + antrianoperasi.StatusPasienRequest: + properties: + keteranganStatus: + type: string + statusOperasi: + type: string + tanggalSelesai: + type: string + type: object + antrianoperasi.TindakanItemRequest: + properties: + kodeTindakan: + type: string + tindakan: + type: string + tindakanTambahan: + type: string + type: object dokter.DokterResponse: properties: hfis_code: @@ -13,6 +131,22 @@ definitions: nip: type: string type: object + kategori.KategoriOperasiModel: + properties: + date_created: + type: string + date_updated: + type: string + id: + type: integer + kategori: + type: string + status: + enum: + - draft + - published + type: string + type: object shared.BaseErrorResponse: properties: code: @@ -26,6 +160,41 @@ definitions: success: type: boolean type: object + shared.BaseResponse: + properties: + code: + type: integer + data: + type: object + message: + type: string + success: + type: boolean + type: object + spesialis.SpesialisModel: + properties: + id: + type: integer + kode: + type: string + spesialis: + type: string + type: object + spesialis.SubSpesialisModel: + properties: + id: + type: integer + id_spesialis: + type: integer + kode: + type: string + kode_spesialis: + type: string + spesialis: + type: string + sub_spesialis: + type: string + type: object host: localhost:8080 info: contact: {} @@ -33,8 +202,54 @@ info: title: Antrian Operasi API version: "1.0" paths: + /antrian-operasi/: + get: + parameters: + - description: Search Keyword + in: query + name: search + type: string + responses: + "200": + description: OK + schema: + items: + $ref: '#/definitions/antrianoperasi.PasienOperasi' + type: array + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/shared.BaseErrorResponse' + summary: Get List Antrian Operasi + tags: + - Antrian Operasi + post: + parameters: + - description: Create Pasien Operasi + in: body + name: body + required: true + schema: + $ref: '#/definitions/antrianoperasi.CreatePasienOperasiRequest' + responses: + "200": + description: OK + schema: + $ref: '#/definitions/shared.BaseResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/shared.BaseErrorResponse' + summary: Create Antrian Operasi + tags: + - Antrian Operasi /dokter/: get: + parameters: + - description: Search keyword + in: query + name: search + type: string responses: "200": description: OK @@ -48,5 +263,72 @@ paths: $ref: '#/definitions/shared.BaseErrorResponse' summary: Get List Dokter tags: - - dokter + - Dokter + /kategori/: + get: + parameters: + - description: Search keyword + in: query + name: search + type: string + responses: + "200": + description: OK + schema: + items: + $ref: '#/definitions/kategori.KategoriOperasiModel' + type: array + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/shared.BaseErrorResponse' + summary: Get List Kategori Operasi + tags: + - Kategori Operasi + /spesialis/: + get: + parameters: + - description: Search keyword + in: query + name: search + type: string + responses: + "200": + description: OK + schema: + items: + $ref: '#/definitions/spesialis.SpesialisModel' + type: array + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/shared.BaseErrorResponse' + summary: Get List Spesialis + tags: + - Spesialis + /sub-spesialis/: + get: + parameters: + - description: Search keyword + in: query + name: search + type: string + - description: Filter by Id Spesialis + in: query + name: id_spesialis + type: integer + responses: + "200": + description: OK + schema: + items: + $ref: '#/definitions/spesialis.SubSpesialisModel' + type: array + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/shared.BaseErrorResponse' + summary: Get List Sub Spesialis + tags: + - Spesialis swagger: "2.0" diff --git a/internal/domain/antrian_operasi/handler.go b/internal/domain/antrian_operasi/handler.go index 5504ef0..9a8c1b4 100644 --- a/internal/domain/antrian_operasi/handler.go +++ b/internal/domain/antrian_operasi/handler.go @@ -28,6 +28,13 @@ func NewAntrianOperasiHandler( } } +// CreateAntrianOperasi godoc +// @Summary Create Antrian Operasi +// @Tags Antrian Operasi +// @Param body body CreatePasienOperasiRequest true "Create Pasien Operasi" +// @Success 200 {object} shared.BaseResponse +// @Failure 500 {object} shared.BaseErrorResponse +// @Router /antrian-operasi/ [post] func (h AntrianOperasiHandler) CreateAntrianOperasi(c *gin.Context) { var req CreatePasienOperasiRequest // Binding format JSON @@ -69,6 +76,13 @@ func (h AntrianOperasiHandler) CreateAntrianOperasi(c *gin.Context) { c.JSON(201, shared.ToBaseResponse(res, true, 201, "success insert antrian operasi")) } +// ListAntrianOperasi godoc +// @Summary Get List Antrian Operasi +// @Tags Antrian Operasi +// @Param search query string false "Search Keyword" +// @Success 200 {object} []PasienOperasi +// @Failure 500 {object} shared.BaseErrorResponse +// @Router /antrian-operasi/ [get] func (h AntrianOperasiHandler) GetListAntrianOperasi(c *gin.Context) { res, err := h.repo.SearchableListAntrianOperasi(c) if err != nil { diff --git a/internal/domain/reference/dokter/handler.go b/internal/domain/reference/dokter/handler.go index 552f04e..bff9e3e 100644 --- a/internal/domain/reference/dokter/handler.go +++ b/internal/domain/reference/dokter/handler.go @@ -19,8 +19,9 @@ func NewDokterHandler(repo IDokterRepository) DokterHandler { // GetListDokter godoc // @Summary Get List Dokter -// @Tags dokter -// @Success 200 {shared.BaseResponse} []DokterResponse +// @Tags Dokter +// @Param search query string false "Search keyword" +// @Success 200 {object} []DokterResponse // @Failure 500 {object} shared.BaseErrorResponse // @Router /dokter/ [get] func (h DokterHandler) ListDokter(c *gin.Context) { @@ -34,6 +35,7 @@ func (h DokterHandler) ListDokter(c *gin.Context) { Message: err.Error(), } c.JSON(http.StatusInternalServerError, errorResponse) + return } response := baseResponse.ToBaseResponse( diff --git a/internal/domain/reference/kategori/handler.go b/internal/domain/reference/kategori/handler.go index dab266d..9865507 100644 --- a/internal/domain/reference/kategori/handler.go +++ b/internal/domain/reference/kategori/handler.go @@ -16,10 +16,23 @@ func NewKategoriHandler(repo IKategoriRepository) KategoriHandler { return KategoriHandler{repo} } +// ListKategoriOperasi godoc +// @Summary Get List Kategori Operasi +// @Tags Kategori Operasi +// @Param search query string false "Search keyword" +// @Success 200 {object} []KategoriOperasiModel +// @Failure 500 {object} shared.BaseErrorResponse +// @Router /kategori/ [get] func (h KategoriHandler) ListKategoriOperasi(c *gin.Context) { list, err := h.repo.SearchableListKategori(c) if err != nil { - c.JSON(http.StatusInternalServerError, err) + errorResponse := baseResponse.BaseErrorResponse{ + Success: false, + Code: 500, + Message: err.Error(), + } + c.JSON(http.StatusInternalServerError, errorResponse) + return } response := baseResponse.ToBaseResponse(list, true, 200, "success get kategori operasi") diff --git a/internal/domain/reference/kategori/model.go b/internal/domain/reference/kategori/model.go index 6c53093..876ec7c 100644 --- a/internal/domain/reference/kategori/model.go +++ b/internal/domain/reference/kategori/model.go @@ -10,5 +10,5 @@ type KategoriOperasiModel struct { Status string `json:"status" db:"status" validate:"oneof=draft published"` Kategori string `json:"kategori" db:"kategori"` DateCreated time.Time `json:"date_created" db:"date_created"` - DateUpdated sql.NullTime `json:"date_updated" db:"date_updated"` + DateUpdated sql.NullTime `json:"date_updated" db:"date_updated" swaggertype:"string"` } diff --git a/internal/domain/reference/spesialis/handler.go b/internal/domain/reference/spesialis/handler.go index f413881..d928243 100644 --- a/internal/domain/reference/spesialis/handler.go +++ b/internal/domain/reference/spesialis/handler.go @@ -16,10 +16,23 @@ func NewSpesialisHandler(repo ISpesialisRepository) SpesialisHandler { return SpesialisHandler{repo} } +// ListSpesialis godoc +// @Summary Get List Spesialis +// @Tags Spesialis +// @Param search query string false "Search keyword" +// @Success 200 {object} []SpesialisModel +// @Failure 500 {object} shared.BaseErrorResponse +// @Router /spesialis/ [get] func (h SpesialisHandler) ListSpesialis(c *gin.Context) { list, err := h.repo.SearchableListSpesialis(c) if err != nil { - c.JSON(http.StatusInternalServerError, err) + errorResponse := baseResponse.BaseErrorResponse{ + Success: false, + Code: 500, + Message: err.Error(), + } + c.JSON(http.StatusInternalServerError, errorResponse) + return } response := baseResponse.ToBaseResponse(list, true, 200, "success get list spesialis") @@ -27,10 +40,24 @@ func (h SpesialisHandler) ListSpesialis(c *gin.Context) { c.JSON(http.StatusOK, response) } +// ListSubSpesialis godoc +// @Summary Get List Sub Spesialis +// @Tags Spesialis +// @Param search query string false "Search keyword" +// @Param id_spesialis query int false "Filter by Id Spesialis" +// @Success 200 {object} []SubSpesialisModel +// @Failure 500 {object} shared.BaseErrorResponse +// @Router /sub-spesialis/ [get] func (h SpesialisHandler) ListSubSpesialis(c *gin.Context) { list, err := h.repo.SearchableListSubSpesialis(c) if err != nil { - c.JSON(http.StatusInternalServerError, err) + errorResponse := baseResponse.BaseErrorResponse{ + Success: false, + Code: 500, + Message: err.Error(), + } + c.JSON(http.StatusInternalServerError, errorResponse) + return } response := baseResponse.ToBaseResponse(list, true, 200, "success get list spesialis") diff --git a/internal/domain/reference/spesialis/repository.go b/internal/domain/reference/spesialis/repository.go index b435d16..fec566f 100644 --- a/internal/domain/reference/spesialis/repository.go +++ b/internal/domain/reference/spesialis/repository.go @@ -124,6 +124,8 @@ func (r spesialisRepo) SearchableListSubSpesialis(c *gin.Context) ([]SubSpesiali searchFilters := []queryUtils.DynamicFilter{ {Column: "dss.Kode", Operator: queryUtils.OpILike, Value: "%" + search + "%"}, {Column: "dss.Subspesialis", Operator: queryUtils.OpILike, Value: "%" + search + "%"}, + {Column: "ds.Kode", Operator: queryUtils.OpILike, Value: "%" + search + "%"}, + {Column: "ds.Spesialis", Operator: queryUtils.OpILike, Value: "%" + search + "%"}, } query.Filters = append(query.Filters, queryUtils.FilterGroup{Filters: searchFilters, LogicOp: "OR"}) } diff --git a/internal/shared/baseResponse.go b/internal/shared/baseResponse.go index 8d68b51..0c93785 100644 --- a/internal/shared/baseResponse.go +++ b/internal/shared/baseResponse.go @@ -11,7 +11,7 @@ type BaseResponse[T any] struct { Success bool `json:"success"` Code int `json:"code"` Message string `json:"message"` - Data T `json:"data"` + Data T `json:"data" swaggertype:"object"` } func ToBaseResponse[T any](data T, isSuccess bool, code int, message string) BaseResponse[T] {