From 7575294a1b8d4a0d3917e2ac258e198e02616efd Mon Sep 17 00:00:00 2001 From: Cephetir Date: Mon, 7 Jul 2025 14:29:48 +0300 Subject: [PATCH 1/2] docs: contract.yaml --- contract.yaml | 215 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 215 insertions(+) create mode 100644 contract.yaml diff --git a/contract.yaml b/contract.yaml new file mode 100644 index 0000000..f90c9b2 --- /dev/null +++ b/contract.yaml @@ -0,0 +1,215 @@ +openapi: 3.0.4 +info: + title: FeedbackService + version: 1.0.0 + description: | + FeedbackService — микросервис для приема и хранения отзывов пользователей о соревнованиях и играх. + +servers: + - url: http://localhost:8000 + +paths: + /user/add/match: + post: + summary: Добавить отзыв о конкретной игре + tags: [ User ] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/MatchFeedbackCreate' + responses: + '201': + description: Отзыв успешно добавлен + '400': + description: Ошибка запроса + + /user/add/tournament: + post: + summary: Добавить отзыв о конкретном соревновании + tags: [ User ] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/TournamentFeedbackCreate' + responses: + '201': + description: Отзыв успешно добавлен + '400': + description: Ошибка запроса + + /user/match: + get: + summary: Получить отзывы по match_id + tags: [ User ] + parameters: + - name: matchId + in: query + required: true + schema: + type: string + format: uuid + responses: + '200': + description: Список отзывов + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/MatchFeedback' + '404': + description: Отзывы не найдены + + /user/tournament: + get: + summary: Получить отзывы по tournament_id + tags: [ User ] + parameters: + - name: tournamentId + in: query + required: true + schema: + type: string + format: uuid + responses: + '200': + description: Список отзывов + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/TournamentFeedback' + '404': + description: Отзывы не найдены + + /admin/user: + get: + summary: Получить все отзывы пользователя (игры + соревнования) + tags: [ Admin ] + parameters: + - name: userId + in: query + required: true + schema: + type: string + format: uuid + responses: + '200': + description: Список отзывов пользователя + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/UnifiedFeedback' + '404': + description: Отзывы не найдены + +components: + schemas: + MatchFeedbackCreate: + type: object + required: [ user_id, match_id, text, rating ] + properties: + user_id: + type: string + format: uuid + match_id: + type: string + format: uuid + text: + type: string + rating: + type: integer + minimum: 1 + maximum: 5 + + TournamentFeedbackCreate: + type: object + required: [ user_id, tournament_id, text, rating ] + properties: + user_id: + type: string + format: uuid + tournament_id: + type: string + format: uuid + text: + type: string + rating: + type: integer + minimum: 1 + maximum: 5 + + MatchFeedback: + type: object + properties: + id: + type: string + format: uuid + user_id: + type: string + format: uuid + match_id: + type: string + format: uuid + text: + type: string + rating: + type: integer + created_at: + type: string + format: date-time + + TournamentFeedback: + type: object + properties: + id: + type: string + format: uuid + user_id: + type: string + format: uuid + tournament_id: + type: string + format: uuid + text: + type: string + rating: + type: integer + created_at: + type: string + format: date-time + + UnifiedFeedback: + type: object + properties: + id: + type: string + format: uuid + user_id: + type: string + format: uuid + text: + type: string + rating: + type: integer + created_at: + type: string + format: date-time + type: + type: string + enum: [ match, tournament ] + match_id: + type: string + format: uuid + nullable: true + tournament_id: + type: string + format: uuid + nullable: true From 1574b508abe47c5d79e6d9999312ddabc9702894 Mon Sep 17 00:00:00 2001 From: Egorniiillll <119012231+Egorniiillll@users.noreply.github.com> Date: Wed, 9 Jul 2025 13:34:29 +0300 Subject: [PATCH 2/2] refacror contract.yaml --- contract.yaml | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/contract.yaml b/contract.yaml index f90c9b2..a309f42 100644 --- a/contract.yaml +++ b/contract.yaml @@ -6,7 +6,7 @@ info: FeedbackService — микросервис для приема и хранения отзывов пользователей о соревнованиях и играх. servers: - - url: http://localhost:8000 + - url: http://localhost:8000 paths: /user/add/match: @@ -46,12 +46,12 @@ paths: summary: Получить отзывы по match_id tags: [ User ] parameters: - - name: matchId - in: query - required: true - schema: - type: string - format: uuid + - name: matchId + in: query + required: true + schema: + type: string + format: uuid responses: '200': description: Список отзывов @@ -69,12 +69,12 @@ paths: summary: Получить отзывы по tournament_id tags: [ User ] parameters: - - name: tournamentId - in: query - required: true - schema: - type: string - format: uuid + - name: tournamentId + in: query + required: true + schema: + type: string + format: uuid responses: '200': description: Список отзывов @@ -92,12 +92,12 @@ paths: summary: Получить все отзывы пользователя (игры + соревнования) tags: [ Admin ] parameters: - - name: userId - in: query - required: true - schema: - type: string - format: uuid + - name: userId + in: query + required: true + schema: + type: string + format: uuid responses: '200': description: Список отзывов пользователя