diff --git a/README.md b/README.md index f44dfb7..4a9ba29 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,10 @@ ООП игра Яга для тренировки ПИб-201 и ПИб-202 КузГТУ -Игра работает с локальным сервером, который Вы сами напишете. -Требования к api: -- реализация _./swagger_file_ +Игра работает с локальным сервером, который Вы сами напишете. Требования к api: + +- реализация http://ooya.ga/swagger.json +- хостинг https://localhost:7115/api/v1 - CORS должен принимать любые домены ## Удачи! diff --git a/public/swagger.json b/public/swagger.json new file mode 100644 index 0000000..2ac71f5 --- /dev/null +++ b/public/swagger.json @@ -0,0 +1,158 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "ooya.ga_api", + "version": "1.0" + }, + "paths": { + "/api/v1/version": { + "get": { + "tags": [ + "Api" + ], + "operationId": "version", + "responses": { + "200": { + "description": "Success", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + }, + "application/json": { + "schema": { + "type": "string" + } + }, + "text/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/api/v1/game": { + "get": { + "tags": [ + "Api" + ], + "operationId": "game", + "responses": { + "200": { + "description": "Success", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/GameDto" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/GameDto" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/GameDto" + } + } + } + } + } + } + }, + "/api/v1/turn": { + "get": { + "tags": [ + "Api" + ], + "operationId": "turn", + "parameters": [ + { + "name": "gameGuid", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "witchGuid", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/GameDto" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/GameDto" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/GameDto" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "GameDto": { + "type": "object", + "properties": { + "date": { + "type": "string", + "format": "date-time" + }, + "guid": { + "type": "string", + "nullable": true + }, + "score": { + "type": "integer", + "format": "int32" + }, + "witches": { + "type": "array", + "items": { + "$ref": "#/components/schemas/WitchDto" + }, + "nullable": true + } + }, + "additionalProperties": false + }, + "WitchDto": { + "type": "object", + "properties": { + "guid": { + "type": "string", + "nullable": true + }, + "position": { + "type": "integer", + "format": "int32" + } + }, + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/src/components/App/App.css b/src/components/App/App.css index 197dad6..004a312 100644 --- a/src/components/App/App.css +++ b/src/components/App/App.css @@ -41,6 +41,12 @@ h1 { .small { font-size: 0.5em; + text-align: left; +} + +.small a, .small a:visited, .small a:active { + color: white; + text-decoration: underline; } .witch { diff --git a/src/components/App/App.tsx b/src/components/App/App.tsx index 44c2e7c..2449c83 100644 --- a/src/components/App/App.tsx +++ b/src/components/App/App.tsx @@ -21,18 +21,20 @@ const App: React.FC = observer((props) => { case EGameStage.Start: { content = { apiStore.startNewGame(); - } } />; + }}/>; break; } case EGameStage.Process: { - content = apiStore.setGameStage(EGameStage.Start) } />; + content = apiStore.setGameStage(EGameStage.Start)}/>; break; } } return ( -
- {content} -
+ <> +
+ {content} +
+ ); }); diff --git a/src/components/GamePage/GamePage.tsx b/src/components/GamePage/GamePage.tsx index 10c8dd8..171adb1 100644 --- a/src/components/GamePage/GamePage.tsx +++ b/src/components/GamePage/GamePage.tsx @@ -59,7 +59,16 @@ const GamePage: React.FC = (props) => { checked={!apiStore.mockMode} value='1' onChange={(e) => apiStore.tryToSetMockMode(e.target.checked)} - /> + /> + +
Свой сервис: +
    +
  • реализация swagger
  • +
  • хостинг https://localhost:7115/api/v1
  • +
  • прием CORS от ooya.ga
  • +
+
+ ); }