diff --git a/docs/docs.go b/docs/docs.go index c235495..91a4f1f 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -46,27 +46,75 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK", + "description": "Successful exchange", "schema": { - "$ref": "#/definitions/service_auth.ExchangeResult" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/service_auth.ExchangeResult" + } + } + } + ] } }, "400": { "description": "Invalid Input", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "401": { "description": "Unauthorized", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "500": { "description": "Internal Server Error", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } } } @@ -98,27 +146,75 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK", + "description": "Successful request", "schema": { - "$ref": "#/definitions/service_auth.MagicResult" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/service_auth.MagicResult" + } + } + } + ] } }, "400": { "description": "Invalid Input", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "403": { "description": "Turnstile Verification Failed", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "500": { "description": "Internal Server Error", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } } } @@ -131,6 +227,7 @@ const docTemplate = `{ "application/x-www-form-urlencoded" ], "produces": [ + "application/json", "text/html" ], "tags": [ @@ -176,19 +273,55 @@ const docTemplate = `{ "400": { "description": "Invalid Input / Client Not Found / URI Mismatch", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "403": { "description": "Invalid or Expired Verification Code", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "500": { "description": "Internal Server Error", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } } } @@ -220,27 +353,75 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK", + "description": "Successful rotation", "schema": { - "$ref": "#/definitions/service_auth.RefreshResult" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/service_auth.TokenResponse" + } + } + } + ] } }, "400": { "description": "Invalid Input", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "401": { "description": "Invalid Refresh Token", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "500": { "description": "Internal Server Error", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } } } @@ -272,27 +453,75 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK", + "description": "Successful token issuance", "schema": { - "$ref": "#/definitions/service_auth.TokenResult" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/service_auth.TokenResponse" + } + } + } + ] } }, "400": { "description": "Invalid Input", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "403": { "description": "Invalid or Expired Code", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "500": { "description": "Internal Server Error", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } } } @@ -322,9 +551,57 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK", + "description": "Successfully generated code", "schema": { - "$ref": "#/definitions/service_event.CheckinResult" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/service_event.CheckinResult" + } + } + } + ] + } + }, + "400": { + "description": "Invalid Input", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } } } @@ -354,9 +631,57 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK", + "description": "Current attendance status", "schema": { - "$ref": "#/definitions/service_event.CheckinQueryResult" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/service_event.CheckinQueryResult" + } + } + } + ] + } + }, + "400": { + "description": "Invalid Input", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] + } + }, + "404": { + "description": "Record Not Found", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } } } @@ -388,9 +713,39 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK", + "description": "Attendance marked successfully", "schema": { - "$ref": "#/definitions/service_event.CheckinSubmitResult" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] + } + }, + "400": { + "description": "Invalid Code or Input", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } } } @@ -420,27 +775,75 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK", + "description": "Successful retrieval", "schema": { - "$ref": "#/definitions/service_event.InfoResult" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/service_event.InfoResult" + } + } + } + ] } }, "400": { "description": "Invalid Input", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "404": { "description": "Event Not Found", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "500": { "description": "Internal Server Error", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } } } @@ -466,15 +869,39 @@ const docTemplate = `{ "summary": "Get Full User Table", "responses": { "200": { - "description": "OK", + "description": "Successful retrieval of full user table", "schema": { - "$ref": "#/definitions/service_user.UserTableResult" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/service_user.UserTableResult" + } + } + } + ] } }, "500": { "description": "Internal Server Error (Database Error)", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } } } @@ -500,27 +927,75 @@ const docTemplate = `{ "summary": "Get My User Information", "responses": { "200": { - "description": "OK", + "description": "Successful profile retrieval", "schema": { - "$ref": "#/definitions/service_user.UserInfoResult" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/service_user.UserInfoData" + } + } + } + ] } }, "403": { "description": "Missing User ID / Unauthorized", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "404": { "description": "User Not Found", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "500": { "description": "Internal Server Error (UUID Parse Failed)", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } } } @@ -528,7 +1003,7 @@ const docTemplate = `{ }, "/user/list": { "get": { - "description": "Fetches a list of users with support for pagination via limit and offset.", + "description": "Fetches a list of users with support for pagination via limit and offset. Data is sourced from the search engine for high performance.", "consumes": [ "application/json" ], @@ -556,21 +1031,60 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK", + "description": "Successful paginated list retrieval", "schema": { - "$ref": "#/definitions/service_user.UserListResult" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/data.UserSearchDoc" + } + } + } + } + ] } }, "400": { "description": "Invalid Input (Format Error)", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "500": { "description": "Internal Server Error (Search Engine or Missing Offset)", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } } } @@ -607,27 +1121,75 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK", + "description": "Successful profile update", "schema": { - "$ref": "#/definitions/service_user.UserInfoResult" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "400": { "description": "Invalid Input (Validation Failed)", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "403": { "description": "Missing User ID / Unauthorized", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "500": { "description": "Internal Server Error (Database Error / UUID Parse Failed)", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } } } @@ -793,17 +1355,6 @@ const docTemplate = `{ } } }, - "service_auth.RefreshResult": { - "type": "object", - "properties": { - "common": { - "$ref": "#/definitions/shared.CommonResult" - }, - "data": { - "$ref": "#/definitions/service_auth.TokenResponse" - } - } - }, "service_auth.TokenData": { "type": "object", "properties": { @@ -823,17 +1374,6 @@ const docTemplate = `{ } } }, - "service_auth.TokenResult": { - "type": "object", - "properties": { - "common": { - "$ref": "#/definitions/shared.CommonResult" - }, - "data": { - "$ref": "#/definitions/service_auth.TokenResponse" - } - } - }, "service_event.CheckinQueryResult": { "type": "object", "properties": { @@ -874,14 +1414,6 @@ const docTemplate = `{ } } }, - "service_event.CheckinSubmitResult": { - "type": "object", - "properties": { - "common": { - "$ref": "#/definitions/shared.CommonResult" - } - } - }, "service_event.InfoResult": { "type": "object", "properties": { @@ -936,31 +1468,6 @@ const docTemplate = `{ } } }, - "service_user.UserInfoResult": { - "type": "object", - "properties": { - "common": { - "$ref": "#/definitions/shared.CommonResult" - }, - "data": { - "$ref": "#/definitions/service_user.UserInfoData" - } - } - }, - "service_user.UserListResult": { - "type": "object", - "properties": { - "common": { - "$ref": "#/definitions/shared.CommonResult" - }, - "user_list": { - "type": "array", - "items": { - "$ref": "#/definitions/data.UserSearchDoc" - } - } - } - }, "service_user.UserTableResult": { "type": "object", "properties": { @@ -985,6 +1492,21 @@ const docTemplate = `{ "type": "integer" } } + }, + "utils.RespStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer" + }, + "data": {}, + "error_id": { + "type": "string" + }, + "status": { + "type": "string" + } + } } } }` diff --git a/docs/swagger.json b/docs/swagger.json index d3e5f8d..059f864 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -35,27 +35,75 @@ ], "responses": { "200": { - "description": "OK", + "description": "Successful exchange", "schema": { - "$ref": "#/definitions/service_auth.ExchangeResult" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/service_auth.ExchangeResult" + } + } + } + ] } }, "400": { "description": "Invalid Input", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "401": { "description": "Unauthorized", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "500": { "description": "Internal Server Error", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } } } @@ -87,27 +135,75 @@ ], "responses": { "200": { - "description": "OK", + "description": "Successful request", "schema": { - "$ref": "#/definitions/service_auth.MagicResult" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/service_auth.MagicResult" + } + } + } + ] } }, "400": { "description": "Invalid Input", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "403": { "description": "Turnstile Verification Failed", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "500": { "description": "Internal Server Error", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } } } @@ -120,6 +216,7 @@ "application/x-www-form-urlencoded" ], "produces": [ + "application/json", "text/html" ], "tags": [ @@ -165,19 +262,55 @@ "400": { "description": "Invalid Input / Client Not Found / URI Mismatch", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "403": { "description": "Invalid or Expired Verification Code", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "500": { "description": "Internal Server Error", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } } } @@ -209,27 +342,75 @@ ], "responses": { "200": { - "description": "OK", + "description": "Successful rotation", "schema": { - "$ref": "#/definitions/service_auth.RefreshResult" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/service_auth.TokenResponse" + } + } + } + ] } }, "400": { "description": "Invalid Input", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "401": { "description": "Invalid Refresh Token", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "500": { "description": "Internal Server Error", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } } } @@ -261,27 +442,75 @@ ], "responses": { "200": { - "description": "OK", + "description": "Successful token issuance", "schema": { - "$ref": "#/definitions/service_auth.TokenResult" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/service_auth.TokenResponse" + } + } + } + ] } }, "400": { "description": "Invalid Input", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "403": { "description": "Invalid or Expired Code", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "500": { "description": "Internal Server Error", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } } } @@ -311,9 +540,57 @@ ], "responses": { "200": { - "description": "OK", + "description": "Successfully generated code", "schema": { - "$ref": "#/definitions/service_event.CheckinResult" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/service_event.CheckinResult" + } + } + } + ] + } + }, + "400": { + "description": "Invalid Input", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } } } @@ -343,9 +620,57 @@ ], "responses": { "200": { - "description": "OK", + "description": "Current attendance status", "schema": { - "$ref": "#/definitions/service_event.CheckinQueryResult" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/service_event.CheckinQueryResult" + } + } + } + ] + } + }, + "400": { + "description": "Invalid Input", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] + } + }, + "404": { + "description": "Record Not Found", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } } } @@ -377,9 +702,39 @@ ], "responses": { "200": { - "description": "OK", + "description": "Attendance marked successfully", "schema": { - "$ref": "#/definitions/service_event.CheckinSubmitResult" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] + } + }, + "400": { + "description": "Invalid Code or Input", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } } } @@ -409,27 +764,75 @@ ], "responses": { "200": { - "description": "OK", + "description": "Successful retrieval", "schema": { - "$ref": "#/definitions/service_event.InfoResult" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/service_event.InfoResult" + } + } + } + ] } }, "400": { "description": "Invalid Input", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "404": { "description": "Event Not Found", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "500": { "description": "Internal Server Error", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } } } @@ -455,15 +858,39 @@ "summary": "Get Full User Table", "responses": { "200": { - "description": "OK", + "description": "Successful retrieval of full user table", "schema": { - "$ref": "#/definitions/service_user.UserTableResult" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/service_user.UserTableResult" + } + } + } + ] } }, "500": { "description": "Internal Server Error (Database Error)", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } } } @@ -489,27 +916,75 @@ "summary": "Get My User Information", "responses": { "200": { - "description": "OK", + "description": "Successful profile retrieval", "schema": { - "$ref": "#/definitions/service_user.UserInfoResult" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/service_user.UserInfoData" + } + } + } + ] } }, "403": { "description": "Missing User ID / Unauthorized", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "404": { "description": "User Not Found", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "500": { "description": "Internal Server Error (UUID Parse Failed)", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } } } @@ -517,7 +992,7 @@ }, "/user/list": { "get": { - "description": "Fetches a list of users with support for pagination via limit and offset.", + "description": "Fetches a list of users with support for pagination via limit and offset. Data is sourced from the search engine for high performance.", "consumes": [ "application/json" ], @@ -545,21 +1020,60 @@ ], "responses": { "200": { - "description": "OK", + "description": "Successful paginated list retrieval", "schema": { - "$ref": "#/definitions/service_user.UserListResult" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/data.UserSearchDoc" + } + } + } + } + ] } }, "400": { "description": "Invalid Input (Format Error)", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "500": { "description": "Internal Server Error (Search Engine or Missing Offset)", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } } } @@ -596,27 +1110,75 @@ ], "responses": { "200": { - "description": "OK", + "description": "Successful profile update", "schema": { - "$ref": "#/definitions/service_user.UserInfoResult" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "400": { "description": "Invalid Input (Validation Failed)", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "403": { "description": "Missing User ID / Unauthorized", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } }, "500": { "description": "Internal Server Error (Database Error / UUID Parse Failed)", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/utils.RespStatus" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object" + } + } + } + ] } } } @@ -782,17 +1344,6 @@ } } }, - "service_auth.RefreshResult": { - "type": "object", - "properties": { - "common": { - "$ref": "#/definitions/shared.CommonResult" - }, - "data": { - "$ref": "#/definitions/service_auth.TokenResponse" - } - } - }, "service_auth.TokenData": { "type": "object", "properties": { @@ -812,17 +1363,6 @@ } } }, - "service_auth.TokenResult": { - "type": "object", - "properties": { - "common": { - "$ref": "#/definitions/shared.CommonResult" - }, - "data": { - "$ref": "#/definitions/service_auth.TokenResponse" - } - } - }, "service_event.CheckinQueryResult": { "type": "object", "properties": { @@ -863,14 +1403,6 @@ } } }, - "service_event.CheckinSubmitResult": { - "type": "object", - "properties": { - "common": { - "$ref": "#/definitions/shared.CommonResult" - } - } - }, "service_event.InfoResult": { "type": "object", "properties": { @@ -925,31 +1457,6 @@ } } }, - "service_user.UserInfoResult": { - "type": "object", - "properties": { - "common": { - "$ref": "#/definitions/shared.CommonResult" - }, - "data": { - "$ref": "#/definitions/service_user.UserInfoData" - } - } - }, - "service_user.UserListResult": { - "type": "object", - "properties": { - "common": { - "$ref": "#/definitions/shared.CommonResult" - }, - "user_list": { - "type": "array", - "items": { - "$ref": "#/definitions/data.UserSearchDoc" - } - } - } - }, "service_user.UserTableResult": { "type": "object", "properties": { @@ -974,6 +1481,21 @@ "type": "integer" } } + }, + "utils.RespStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer" + }, + "data": {}, + "error_id": { + "type": "string" + }, + "status": { + "type": "string" + } + } } } } \ No newline at end of file diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 77f74d9..382a85b 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -102,13 +102,6 @@ definitions: refresh_token: type: string type: object - service_auth.RefreshResult: - properties: - common: - $ref: '#/definitions/shared.CommonResult' - data: - $ref: '#/definitions/service_auth.TokenResponse' - type: object service_auth.TokenData: properties: code: @@ -121,13 +114,6 @@ definitions: refresh_token: type: string type: object - service_auth.TokenResult: - properties: - common: - $ref: '#/definitions/shared.CommonResult' - data: - $ref: '#/definitions/service_auth.TokenResponse' - type: object service_event.CheckinQueryResult: properties: common: @@ -153,11 +139,6 @@ definitions: checkin_code: type: string type: object - service_event.CheckinSubmitResult: - properties: - common: - $ref: '#/definitions/shared.CommonResult' - type: object service_event.InfoResult: properties: common: @@ -193,22 +174,6 @@ definitions: username: type: string type: object - service_user.UserInfoResult: - properties: - common: - $ref: '#/definitions/shared.CommonResult' - data: - $ref: '#/definitions/service_user.UserInfoData' - type: object - service_user.UserListResult: - properties: - common: - $ref: '#/definitions/shared.CommonResult' - user_list: - items: - $ref: '#/definitions/data.UserSearchDoc' - type: array - type: object service_user.UserTableResult: properties: common: @@ -225,6 +190,16 @@ definitions: httpCode: type: integer type: object + utils.RespStatus: + properties: + code: + type: integer + data: {} + error_id: + type: string + status: + type: string + type: object info: contact: {} paths: @@ -245,21 +220,41 @@ paths: - application/json responses: "200": - description: OK + description: Successful exchange schema: - $ref: '#/definitions/service_auth.ExchangeResult' + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + $ref: '#/definitions/service_auth.ExchangeResult' + type: object "400": description: Invalid Input schema: - type: string + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object "401": description: Unauthorized schema: - type: string + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object "500": description: Internal Server Error schema: - type: string + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object security: - ApiKeyAuth: [] summary: Exchange Auth Code @@ -282,21 +277,41 @@ paths: - application/json responses: "200": - description: OK + description: Successful request schema: - $ref: '#/definitions/service_auth.MagicResult' + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + $ref: '#/definitions/service_auth.MagicResult' + type: object "400": description: Invalid Input schema: - type: string + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object "403": description: Turnstile Verification Failed schema: - type: string + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object "500": description: Internal Server Error schema: - type: string + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object summary: Request Magic Link tags: - Authentication @@ -328,6 +343,7 @@ paths: name: state type: string produces: + - application/json - text/html responses: "302": @@ -337,15 +353,30 @@ paths: "400": description: Invalid Input / Client Not Found / URI Mismatch schema: - type: string + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object "403": description: Invalid or Expired Verification Code schema: - type: string + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object "500": description: Internal Server Error schema: - type: string + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object summary: Handle Auth Callback and Redirect tags: - Authentication @@ -366,21 +397,41 @@ paths: - application/json responses: "200": - description: OK + description: Successful rotation schema: - $ref: '#/definitions/service_auth.RefreshResult' + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + $ref: '#/definitions/service_auth.TokenResponse' + type: object "400": description: Invalid Input schema: - type: string + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object "401": description: Invalid Refresh Token schema: - type: string + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object "500": description: Internal Server Error schema: - type: string + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object summary: Refresh Access Token tags: - Authentication @@ -401,21 +452,41 @@ paths: - application/json responses: "200": - description: OK + description: Successful token issuance schema: - $ref: '#/definitions/service_auth.TokenResult' + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + $ref: '#/definitions/service_auth.TokenResponse' + type: object "400": description: Invalid Input schema: - type: string + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object "403": description: Invalid or Expired Code schema: - type: string + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object "500": description: Internal Server Error schema: - type: string + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object summary: Exchange Code for Token tags: - Authentication @@ -435,9 +506,32 @@ paths: - application/json responses: "200": - description: OK + description: Successfully generated code schema: - $ref: '#/definitions/service_event.CheckinResult' + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + $ref: '#/definitions/service_event.CheckinResult' + type: object + "400": + description: Invalid Input + schema: + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object summary: Generate Check-in Code tags: - Event @@ -457,9 +551,32 @@ paths: - application/json responses: "200": - description: OK + description: Current attendance status schema: - $ref: '#/definitions/service_event.CheckinQueryResult' + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + $ref: '#/definitions/service_event.CheckinQueryResult' + type: object + "400": + description: Invalid Input + schema: + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object + "404": + description: Record Not Found + schema: + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object summary: Query Check-in Status tags: - Event @@ -479,9 +596,23 @@ paths: - application/json responses: "200": - description: OK + description: Attendance marked successfully schema: - $ref: '#/definitions/service_event.CheckinSubmitResult' + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object + "400": + description: Invalid Code or Input + schema: + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object summary: Submit Check-in Code tags: - Event @@ -501,21 +632,41 @@ paths: - application/json responses: "200": - description: OK + description: Successful retrieval schema: - $ref: '#/definitions/service_event.InfoResult' + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + $ref: '#/definitions/service_event.InfoResult' + type: object "400": description: Invalid Input schema: - type: string + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object "404": description: Event Not Found schema: - type: string + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object "500": description: Internal Server Error schema: - type: string + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object summary: Get Event Information tags: - Event @@ -529,13 +680,23 @@ paths: - application/json responses: "200": - description: OK + description: Successful retrieval of full user table schema: - $ref: '#/definitions/service_user.UserTableResult' + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + $ref: '#/definitions/service_user.UserTableResult' + type: object "500": description: Internal Server Error (Database Error) schema: - type: string + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object security: - ApiKeyAuth: [] summary: Get Full User Table @@ -551,21 +712,41 @@ paths: - application/json responses: "200": - description: OK + description: Successful profile retrieval schema: - $ref: '#/definitions/service_user.UserInfoResult' + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + $ref: '#/definitions/service_user.UserInfoData' + type: object "403": description: Missing User ID / Unauthorized schema: - type: string + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object "404": description: User Not Found schema: - type: string + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object "500": description: Internal Server Error (UUID Parse Failed) schema: - type: string + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object security: - ApiKeyAuth: [] summary: Get My User Information @@ -576,7 +757,7 @@ paths: consumes: - application/json description: Fetches a list of users with support for pagination via limit and - offset. + offset. Data is sourced from the search engine for high performance. parameters: - description: Maximum number of users to return (default 0) in: query @@ -591,17 +772,34 @@ paths: - application/json responses: "200": - description: OK + description: Successful paginated list retrieval schema: - $ref: '#/definitions/service_user.UserListResult' + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + items: + $ref: '#/definitions/data.UserSearchDoc' + type: array + type: object "400": description: Invalid Input (Format Error) schema: - type: string + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object "500": description: Internal Server Error (Search Engine or Missing Offset) schema: - type: string + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object summary: List Users tags: - User @@ -623,21 +821,41 @@ paths: - application/json responses: "200": - description: OK + description: Successful profile update schema: - $ref: '#/definitions/service_user.UserInfoResult' + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object "400": description: Invalid Input (Validation Failed) schema: - type: string + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object "403": description: Missing User ID / Unauthorized schema: - type: string + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object "500": description: Internal Server Error (Database Error / UUID Parse Failed) schema: - type: string + allOf: + - $ref: '#/definitions/utils.RespStatus' + - properties: + data: + type: object + type: object security: - ApiKeyAuth: [] summary: Update User Information