diff --git a/docs/docs.go b/docs/docs.go index 000db3a..867a527 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -15,6 +15,70 @@ const docTemplate = `{ "host": "{{.Host}}", "basePath": "{{.BasePath}}", "paths": { + "/access/eligible-menu": { + "get": { + "tags": [ + "Access Role" + ], + "summary": "Get Pages By Keycloak Id", + "parameters": [ + { + "type": "string", + "description": "Keycloak ID", + "name": "keycloak_id", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/shared.BaseResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/shared.BaseErrorResponse" + } + } + } + } + }, + "/access/sync-keycloak-role": { + "post": { + "tags": [ + "Access Role" + ], + "summary": "Sync Keycloak Role", + "parameters": [ + { + "description": "Sync Keycloak Role", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/access.SyncKeycloakRoleRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/shared.BaseResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/shared.BaseErrorResponse" + } + } + } + } + }, "/antrian-operasi/": { "get": { "tags": [ @@ -790,6 +854,31 @@ const docTemplate = `{ } }, "definitions": { + "access.SyncKeycloakRoleRequest": { + "type": "object", + "required": [ + "email", + "keycloak_id", + "name" + ], + "properties": { + "client_role": { + "type": "array", + "items": { + "type": "string" + } + }, + "email": { + "type": "string" + }, + "keycloak_id": { + "type": "string" + }, + "name": { + "type": "string" + } + } + }, "antrianoperasi.CreatePasienOperasiRequest": { "type": "object", "required": [ diff --git a/docs/swagger.json b/docs/swagger.json index 3b43b91..2af5663 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -9,6 +9,70 @@ "host": "localhost:8080", "basePath": "/api", "paths": { + "/access/eligible-menu": { + "get": { + "tags": [ + "Access Role" + ], + "summary": "Get Pages By Keycloak Id", + "parameters": [ + { + "type": "string", + "description": "Keycloak ID", + "name": "keycloak_id", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/shared.BaseResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/shared.BaseErrorResponse" + } + } + } + } + }, + "/access/sync-keycloak-role": { + "post": { + "tags": [ + "Access Role" + ], + "summary": "Sync Keycloak Role", + "parameters": [ + { + "description": "Sync Keycloak Role", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/access.SyncKeycloakRoleRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/shared.BaseResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/shared.BaseErrorResponse" + } + } + } + } + }, "/antrian-operasi/": { "get": { "tags": [ @@ -784,6 +848,31 @@ } }, "definitions": { + "access.SyncKeycloakRoleRequest": { + "type": "object", + "required": [ + "email", + "keycloak_id", + "name" + ], + "properties": { + "client_role": { + "type": "array", + "items": { + "type": "string" + } + }, + "email": { + "type": "string" + }, + "keycloak_id": { + "type": "string" + }, + "name": { + "type": "string" + } + } + }, "antrianoperasi.CreatePasienOperasiRequest": { "type": "object", "required": [ diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 8feccd3..3b62616 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1,5 +1,22 @@ basePath: /api definitions: + access.SyncKeycloakRoleRequest: + properties: + client_role: + items: + type: string + type: array + email: + type: string + keycloak_id: + type: string + name: + type: string + required: + - email + - keycloak_id + - name + type: object antrianoperasi.CreatePasienOperasiRequest: properties: diagnosisItems: @@ -432,6 +449,47 @@ info: title: Antrian Operasi API version: "1.0" paths: + /access/eligible-menu: + get: + parameters: + - description: Keycloak ID + in: query + name: keycloak_id + required: true + type: string + responses: + "200": + description: OK + schema: + $ref: '#/definitions/shared.BaseResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/shared.BaseErrorResponse' + summary: Get Pages By Keycloak Id + tags: + - Access Role + /access/sync-keycloak-role: + post: + parameters: + - description: Sync Keycloak Role + in: body + name: body + required: true + schema: + $ref: '#/definitions/access.SyncKeycloakRoleRequest' + responses: + "200": + description: OK + schema: + $ref: '#/definitions/shared.BaseResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/shared.BaseErrorResponse' + summary: Sync Keycloak Role + tags: + - Access Role /antrian-operasi/: get: parameters: diff --git a/internal/domain/access/handler.go b/internal/domain/access/handler.go index 28840b7..320f21f 100644 --- a/internal/domain/access/handler.go +++ b/internal/domain/access/handler.go @@ -14,6 +14,13 @@ func NewAccessHandler(repo IAccessRepository) AccessHandler { return AccessHandler{repo} } +// SyncKeycloakRole godoc +// @Summary Sync Keycloak Role +// @Tags Access Role +// @Param body body SyncKeycloakRoleRequest true "Sync Keycloak Role" +// @Success 200 {object} shared.BaseResponse +// @Failure 500 {object} shared.BaseErrorResponse +// @Router /access/sync-keycloak-role [post] func (h AccessHandler) SyncKeycloakRole(c *gin.Context) { var req SyncKeycloakRoleRequest @@ -68,6 +75,13 @@ func (h AccessHandler) SyncKeycloakRole(c *gin.Context) { }) } +// GetPageByKeycloakId godoc +// @Summary Get Pages By Keycloak Id +// @Tags Access Role +// @Param keycloak_id query string true "Keycloak ID" +// @Success 200 {object} shared.BaseResponse +// @Failure 500 {object} shared.BaseErrorResponse +// @Router /access/eligible-menu [get] func (h AccessHandler) GetPageByKeycloakId(c *gin.Context) { keycloakId := c.Query("keycloak_id")