feat: лайки

This commit is contained in:
Anton Pomorzin
2025-05-21 11:33:43 +05:00
parent 68f53811f3
commit a5d571d09a
+172
View File
@@ -4907,6 +4907,178 @@ paths:
403:
description: Unauthorized request.
/api/v2/like/add:
post:
tags:
- like
summary: Добавить лайк
description: Добавляет лайк к сущности по entity_id и item_id.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
entity_id:
type: integer
description: ID сущности
example: 100
item_id:
type: string
description: ID записи
example: "e456bfb3-31dc-4c94-81ca-17dc49043a2b"
responses:
200:
description: Результат добавления лайка
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
description: Результат операции
example: true
400:
description: Ошибка валидации данных
content:
application/json:
schema:
type: array
items:
type: object
properties:
field:
type: string
example: entityId
message:
type: string
example: Необходимо заполнить «Entity Id».
404:
description: Не найдено
500:
description: Внутренняя ошибка сервера
paths:
/api/v2/like/delete:
delete:
tags:
- like
summary: Удалить лайк
operationId: LikeDelete
parameters:
- name: entity_id
in: query
required: true
schema:
type: integer
description: ID сущности
- name: item_id
in: query
required: true
schema:
type: string
description: ID записи
responses:
204:
description: Успешно удалено (нет тела ответа)
404:
description: Запись не найдена
422:
description: Ошибка валидации
content:
application/json:
schema:
type: array
items:
type: object
properties:
field:
type: string
message:
type: string
example:
- field: entityId
message: Необходимо заполнить «Entity Id».
/api/v2/like/content-items-state:
get:
tags:
- like
summary: Получить статистику лайков по контенту из редактора (галерея типа карусель)
description: |
Возвращает:
- `counts`: список ID файлов (из редактора, из галереи), у которых есть лайки, и количество этих лайков.
- `states`: список ID файлов, которым текущий пользователь поставил лайк.
operationId: ContentItemsState
parameters:
- name: entity_id
in: query
schema:
type: number
enum:
- 50
- 100
- 300
- 375
- 500
- 550
description: >
Entity ID - Идентификатор сущности, которая имеет контет, из редактора.
* `22` - Department (Тренинги)
* `100` - Article (Новости/Страницы)
* `119` - CalendarEvent (Тренинги)
* `500` - WfWorkflow (Процессы)
* `550` - Training (Тренинги)
- name: item_id
in: query
required: true
schema:
type: string
description: ID записи
responses:
200:
description: Успешный ответ
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
example: true
data:
type: object
properties:
counts:
type: object
example:
e456bfb3-31dc-4c94-81ca-17dc49043a2b: 5
ee56bfb3-31dc-4c94-81ca-17dc49043a2b: 2
states:
type: array
items:
type: string
example:
- e456bfb3-31dc-4c94-81ca-17dc49043a2b
- ee56bfb3-31dc-4c94-81ca-17dc49043a2b
404:
description: Сущность не найдена или не реализует ContentEditorInterface
422:
description: Ошибка валидации
content:
application/json:
schema:
type: array
items:
type: object
properties:
field:
type: string
message:
type: string
example:
- field: entityId
message: Необходимо заполнить «Entity Id».
components:
securitySchemes:
SessionAuth: