diff --git a/matchmaker/api/src/main/resources/static/openapi/api.yml b/matchmaker/api/src/main/resources/static/openapi/api.yml index aa55c5f7..6adeed65 100644 --- a/matchmaker/api/src/main/resources/static/openapi/api.yml +++ b/matchmaker/api/src/main/resources/static/openapi/api.yml @@ -92,6 +92,79 @@ paths: application/json: schema: $ref: "#/components/schemas/GeneralError" + 409: + description: Attitude was already taken + content: + application/json: + schema: + $ref: "#/components/schemas/GeneralError" + /people/{target_id}/attitudes/{attitude_kind}: + post: + tags: [SOA] + summary: Like or skip a suggestion + description: | + Does the same as /people/{target_id}/attitudes. + Exists just to defend SOA labs. + parameters: + - name: target_id + in: path + required: true + schema: + $ref: "#/components/schemas/PersonId" + - name: attitude_kind + in: path + required: true + schema: + $ref: "#/components/schemas/AttitudeKind" + responses: + 204: + description: Attitude was taken into account + 401: + description: No authentication + content: + application/json: + schema: + $ref: "#/components/schemas/GeneralError" + 404: + description: Person is not found + content: + application/json: + schema: + $ref: "#/components/schemas/GeneralError" + 409: + description: Attitude was already taken + content: + application/json: + schema: + $ref: "#/components/schemas/GeneralError" + /attitudes: + delete: + tags: [SOA] + summary: Reset attitudes + description: Removes attitudes from the given person + security: + - bearerAuth: [ADMIN] + parameters: + - name: source_id + in: query + required: true + schema: + $ref: "#/components/schemas/PersonId" + responses: + 204: + description: Attitudes was reset + 401: + description: No authentication + content: + application/json: + schema: + $ref: "#/components/schemas/GeneralError" + 404: + description: Person is not found + content: + application/json: + schema: + $ref: "#/components/schemas/GeneralError" /people/{person_id}/matches: get: tags: [Suggestions] @@ -131,6 +204,52 @@ paths: application/json: schema: $ref: "#/components/schemas/GeneralError" + /statistics/attitudes: + get: + tags: [SOA] + summary: Get attitudes statistics + description: Returns like/skip counters for each person + security: + - bearerAuth: [ADMIN] + responses: + 200: + description: OK + content: + application/json: + schema: + type: array + items: + type: object + properties: + person_id: + $ref: "#/components/schemas/PersonId" + likes: + type: integer + description: Count of people liked by the person + format: int32 + minimum: 0 + skips: + type: integer + description: Count of people skipped by the person + format: int32 + minimum: 0 + required: + - person_id + - likes + - skips + uniqueItems: true + 401: + description: No authentication + content: + application/json: + schema: + $ref: "#/components/schemas/GeneralError" + 403: + description: Forbidden + content: + application/json: + schema: + $ref: "#/components/schemas/GeneralError" components: securitySchemes: bearerAuth: @@ -144,14 +263,16 @@ components: format: int64 minimum: 1 example: 12345678 + AttitudeKind: + type: string + enum: + - like + - skip Attitude: type: object properties: - verdict: - type: string - enum: - - like - - skip + kind: + $ref: "#/components/schemas/AttitudeKind" required: - verdict GeneralError: diff --git a/people/api/src/main/resources/static/openapi/api.yml b/people/api/src/main/resources/static/openapi/api.yml index 3f64a99c..df789c05 100644 --- a/people/api/src/main/resources/static/openapi/api.yml +++ b/people/api/src/main/resources/static/openapi/api.yml @@ -5,7 +5,7 @@ info: servers: - url: /api/v1 security: - - bearerAuth: [] + - bearerAuth: [USER, ADMIN] paths: /monitoring/healthcheck: get: @@ -90,14 +90,14 @@ paths: required: false schema: $ref: "#/components/schemas/PersonHeight" - example: 160 + example: 160 - name: height_max in: query description: Maximum height of a person required: false schema: $ref: "#/components/schemas/PersonHeight" - example: 180 + example: 180 - name: birthday_min in: query description: Minimum birthday of a person @@ -164,6 +164,27 @@ paths: required: false schema: $ref: "#/components/schemas/UpdateMoment" + - name: sort_by + in: query + description: Sorting keys + required: false + explode: false + schema: + type: array + items: + type: string + enum: + - first_name + - last_name + - height + - birthday + - updated + - -first_name + - -last_name + - -height + - -birthday + - -updated + uniqueItems: true responses: 200: description: OK @@ -196,6 +217,14 @@ paths: tags: [People] summary: Create a person description: Creates a person with given parameters + parameters: + - name: Idempotency-Key + in: header + required: true + schema: + type: string + format: uuid + example: 550e8400-e29b-41d4-a716-446655440000 requestBody: required: true content: @@ -203,8 +232,8 @@ paths: schema: $ref: "#/components/schemas/PersonDraft" responses: - 200: - description: OK + 201: + description: Created content: application/json: schema: @@ -221,6 +250,12 @@ paths: application/json: schema: $ref: "#/components/schemas/GeneralError" + 409: + description: If person was already created (Idempotency-Key duplicated) + content: + application/json: + schema: + $ref: "#/components/schemas/GeneralError" /people/{person_id}: get: tags: [People] @@ -261,6 +296,8 @@ paths: tags: [People] summary: Delete person by id description: Deletes a person with a given id forever? + security: + - bearerAuth: [ADMIN] parameters: - name: person_id in: path