update openapi
This commit is contained in:
parent
3a68da81e1
commit
d8abc9c16f
@ -2,68 +2,64 @@ openapi: 3.0.0
|
|||||||
info:
|
info:
|
||||||
title: Codeword Recovery Service API
|
title: Codeword Recovery Service API
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
description: API for handling password recovery for the Codeword service.
|
description: API для обработки восстановления паролей для сервиса Codeword.
|
||||||
|
|
||||||
|
tags:
|
||||||
|
- name: recover
|
||||||
|
description: Операции связанные с восстановлением пароля
|
||||||
|
- name: promocode
|
||||||
|
description: Операции связанные с промокодами
|
||||||
|
- name: stats
|
||||||
|
description: Операции связанные со статистикой
|
||||||
|
|
||||||
paths:
|
paths:
|
||||||
/liveness:
|
/liveness:
|
||||||
get:
|
get:
|
||||||
|
operationId: Liveness
|
||||||
summary: Роут проверки активности
|
summary: Роут проверки активности
|
||||||
|
tags:
|
||||||
|
- recover
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: Успех – сервис запущен
|
description: Успех – сервис запущен
|
||||||
|
|
||||||
/readiness:
|
/readiness:
|
||||||
get:
|
get:
|
||||||
summary: Роут проверки базы данных
|
operationId: Readiness
|
||||||
|
summary: Роут проверки баз данных
|
||||||
|
tags:
|
||||||
|
- recover
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: Успех — сервис готов и соединение с БД живо
|
description: Успех — сервис готов и соединение с БД живо
|
||||||
'503':
|
'503':
|
||||||
description: Служба недоступна — не удалось выполнить проверку связи с БД
|
description: Служба недоступна — не удалось выполнить проверку связи с БД
|
||||||
|
|
||||||
/recover:
|
/recover:
|
||||||
post:
|
post:
|
||||||
summary: Запустите процесс восстановления пароля
|
operationId: Recovery
|
||||||
|
summary: Восстановления пароля
|
||||||
|
tags:
|
||||||
|
- recover
|
||||||
requestBody:
|
requestBody:
|
||||||
required: true
|
required: true
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
type: object
|
$ref: '#/components/schemas/RecoveryRequest'
|
||||||
required:
|
|
||||||
- email
|
|
||||||
properties:
|
|
||||||
email:
|
|
||||||
type: string
|
|
||||||
format: email
|
|
||||||
description: Электронная почта, на которую нужно отправить инструкции по восстановлению
|
|
||||||
Referrer:
|
|
||||||
type: string
|
|
||||||
description: URL-адрес referral, если он доступен
|
|
||||||
RedirectionURL:
|
|
||||||
type: string
|
|
||||||
description: URL-адрес, на который перенаправляется пользователь после отправки электронного письма
|
|
||||||
|
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: Запрос на восстановление принят, и возвращен идентификатор записи восстановления
|
description: Запрос на восстановление принят
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
id:
|
|
||||||
type: string
|
|
||||||
description: Идентификатор запроса на восстановление
|
|
||||||
'404':
|
'404':
|
||||||
description: Пользователь не найден по электронной почте
|
description: Пользователь не найден по электронной почте
|
||||||
'500':
|
'500':
|
||||||
description: Внутренняя ошибка сервера – разные причины
|
description: Внутренняя ошибка сервера
|
||||||
|
|
||||||
/recover/{sign}:
|
/recover/{sign}:
|
||||||
get:
|
get:
|
||||||
summary: Обработать ссылку восстановления, в которой содержится подпись и обменять ее на токены
|
operationId: RecoveryLink
|
||||||
|
summary: Обработать ссылку восстановления и обменять ее на токены
|
||||||
|
tags:
|
||||||
|
- recover
|
||||||
parameters:
|
parameters:
|
||||||
- in: path
|
- in: path
|
||||||
name: sign
|
name: sign
|
||||||
@ -73,59 +69,41 @@ paths:
|
|||||||
description: Подпись восстановления как часть URL-адреса восстановления
|
description: Подпись восстановления как часть URL-адреса восстановления
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: Восстановление успешно, информация для обмена токенов возвращена
|
description: Восстановление успешно, информация для обмена токенов возвращена в cookie
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
accessToken:
|
|
||||||
type: string
|
|
||||||
refreshToken:
|
|
||||||
type: string
|
|
||||||
'406':
|
'406':
|
||||||
description: NotAcceptable - срок действия ссылки для восстановления истек или она недействительна
|
description: NotAcceptable - срок действия ссылки для восстановления истек или она недействительна
|
||||||
'500':
|
'500':
|
||||||
description: Внутренняя ошибка сервера – разные причины
|
description: Внутренняя ошибка сервера
|
||||||
|
|
||||||
/promocode/create:
|
/promocode/create:
|
||||||
post:
|
post:
|
||||||
|
operationId: CreatePromoCode
|
||||||
summary: Создать новый промокод
|
summary: Создать новый промокод
|
||||||
|
tags:
|
||||||
|
- promocode
|
||||||
requestBody:
|
requestBody:
|
||||||
required: true
|
required: true
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/PromoCodeRequest'
|
$ref: '#/components/schemas/PromoCodeReq'
|
||||||
responses:
|
responses:
|
||||||
'201':
|
'200':
|
||||||
description: Новый промокод успешно создан
|
description: Новый промокод успешно создан
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/PromoCodeResponse'
|
$ref: '#/components/schemas/PromoCode'
|
||||||
'400':
|
'400':
|
||||||
description: Invalid request payload / Duplicate Codeword
|
description: Неверный формат запроса или дублирующийся codeword
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
error:
|
|
||||||
type: string
|
|
||||||
'500':
|
'500':
|
||||||
description: Внутренняя ошибка сервера
|
description: Внутренняя ошибка сервера
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
error:
|
|
||||||
type: string
|
|
||||||
|
|
||||||
/promocode/edit:
|
/promocode/edit:
|
||||||
put:
|
put:
|
||||||
|
operationId: EditPromoCode
|
||||||
summary: Обновить существующий промокод
|
summary: Обновить существующий промокод
|
||||||
|
tags:
|
||||||
|
- promocode
|
||||||
requestBody:
|
requestBody:
|
||||||
required: true
|
required: true
|
||||||
content:
|
content:
|
||||||
@ -138,38 +116,20 @@ paths:
|
|||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/PromoCodeResponse'
|
$ref: '#/components/schemas/PromoCode'
|
||||||
'400':
|
'400':
|
||||||
description: Неверный формат запроса
|
description: Неверный формат запроса
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
error:
|
|
||||||
type: string
|
|
||||||
'404':
|
'404':
|
||||||
description: Промокод не найден
|
description: Промокод не найден
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
error:
|
|
||||||
type: string
|
|
||||||
'500':
|
'500':
|
||||||
description: Внутренняя ошибка сервера
|
description: Внутренняя ошибка сервера
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
error:
|
|
||||||
type: string
|
|
||||||
|
|
||||||
/promocode/getList:
|
/promocode/getList:
|
||||||
post:
|
post:
|
||||||
summary: Получить список промокодов
|
operationId: GetList
|
||||||
|
summary: Получить список промокодов с пагинацией
|
||||||
|
tags:
|
||||||
|
- promocode
|
||||||
requestBody:
|
requestBody:
|
||||||
required: true
|
required: true
|
||||||
content:
|
content:
|
||||||
@ -185,19 +145,15 @@ paths:
|
|||||||
$ref: '#/components/schemas/GetPromoCodesListResp'
|
$ref: '#/components/schemas/GetPromoCodesListResp'
|
||||||
'400':
|
'400':
|
||||||
description: Неверный запрос из-за невалидных данных
|
description: Неверный запрос из-за невалидных данных
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
error:
|
|
||||||
type: string
|
|
||||||
'500':
|
'500':
|
||||||
description: Внутренняя ошибка сервера
|
description: Внутренняя ошибка сервера
|
||||||
|
|
||||||
/promocode/activate:
|
/promocode/activate:
|
||||||
post:
|
post:
|
||||||
|
operationId: Activate
|
||||||
summary: Активировать промокод
|
summary: Активировать промокод
|
||||||
|
tags:
|
||||||
|
- promocode
|
||||||
requestBody:
|
requestBody:
|
||||||
required: true
|
required: true
|
||||||
content:
|
content:
|
||||||
@ -212,7 +168,7 @@ paths:
|
|||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/ActivateResp'
|
$ref: '#/components/schemas/ActivateResp'
|
||||||
'400':
|
'400':
|
||||||
description: Невалидный запрос или отсутствует обязательное поле codeword
|
description: Невалидный запрос или отсутствует обязательное поле codeword или fastLink
|
||||||
'404':
|
'404':
|
||||||
description: Промокод не найден
|
description: Промокод не найден
|
||||||
'500':
|
'500':
|
||||||
@ -220,7 +176,10 @@ paths:
|
|||||||
|
|
||||||
/promocode/{promocodeID}:
|
/promocode/{promocodeID}:
|
||||||
delete:
|
delete:
|
||||||
|
operationId: Delete
|
||||||
summary: Мягко удалить промокод по его id
|
summary: Мягко удалить промокод по его id
|
||||||
|
tags:
|
||||||
|
- promocode
|
||||||
parameters:
|
parameters:
|
||||||
- in: path
|
- in: path
|
||||||
name: promocodeID
|
name: promocodeID
|
||||||
@ -233,98 +192,50 @@ paths:
|
|||||||
description: Промокод успешно помечен как удаленный
|
description: Промокод успешно помечен как удаленный
|
||||||
'400':
|
'400':
|
||||||
description: Неверный запрос, отсутствует идентификатор промокода
|
description: Неверный запрос, отсутствует идентификатор промокода
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
error:
|
|
||||||
type: string
|
|
||||||
'404':
|
'404':
|
||||||
description: Промокод не найден
|
description: Промокод не найден
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
error:
|
|
||||||
type: string
|
|
||||||
'500':
|
'500':
|
||||||
description: Внутренняя ошибка сервера
|
description: Внутренняя ошибка сервера
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
error:
|
|
||||||
type: string
|
|
||||||
|
|
||||||
/promocode/fastlink:
|
/promocode/fastlink:
|
||||||
post:
|
post:
|
||||||
|
operationId: CreateFastLink
|
||||||
summary: Создать быструю ссылку для промокода
|
summary: Создать быструю ссылку для промокода
|
||||||
|
tags:
|
||||||
|
- promocode
|
||||||
requestBody:
|
requestBody:
|
||||||
required: true
|
required: true
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
type: object
|
$ref: '#/components/schemas/CreateFastLinkRequest'
|
||||||
required:
|
|
||||||
- id
|
|
||||||
properties:
|
|
||||||
id:
|
|
||||||
type: string
|
|
||||||
description: ID промокода, для которого нужно создать быструю ссылку
|
|
||||||
responses:
|
responses:
|
||||||
'201':
|
'200':
|
||||||
description: Быстрая ссылка для промокода успешно создана
|
description: Быстрая ссылка для промокода успешно создана
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
type: object
|
$ref: '#/components/schemas/CreateFastLinkResponse'
|
||||||
properties:
|
|
||||||
fastlink:
|
|
||||||
type: string
|
|
||||||
description: Быстрая ссылка для активации промокода
|
|
||||||
'400':
|
'400':
|
||||||
description: Неверный запрос, отсутствует идентификатор промокода
|
description: Неверный запрос, отсутствует идентификатор промокода
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
error:
|
|
||||||
type: string
|
|
||||||
'404':
|
'404':
|
||||||
description: Промокод не найден
|
description: Промокод не найден
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
error:
|
|
||||||
type: string
|
|
||||||
'500':
|
'500':
|
||||||
description: Внутренняя ошибка сервера
|
description: Внутренняя ошибка сервера
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
error:
|
|
||||||
type: string
|
|
||||||
/promocode/stats:
|
/promocode/stats:
|
||||||
post:
|
get:
|
||||||
|
operationId: GetStats
|
||||||
summary: Получить статистику промокода
|
summary: Получить статистику промокода
|
||||||
|
tags:
|
||||||
|
- stats
|
||||||
|
description: Идентификатор промокода
|
||||||
requestBody:
|
requestBody:
|
||||||
required: true
|
required: true
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
type: object
|
$ref: '#/components/schemas/PromoCodeStatsRequest'
|
||||||
properties:
|
|
||||||
promoCodeID:
|
|
||||||
type: string
|
|
||||||
description: Идентификатор промокода
|
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: Статистика промокода успешно получена
|
description: Статистика промокода успешно получена
|
||||||
@ -334,199 +245,83 @@ paths:
|
|||||||
$ref: '#/components/schemas/PromoCodeStats'
|
$ref: '#/components/schemas/PromoCodeStats'
|
||||||
'400':
|
'400':
|
||||||
description: Неверный запрос
|
description: Неверный запрос
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
error:
|
|
||||||
type: string
|
|
||||||
'500':
|
'500':
|
||||||
description: Внутренняя ошибка сервера
|
description: Внутренняя ошибка сервера
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
error:
|
|
||||||
type: string
|
|
||||||
|
|
||||||
components:
|
components:
|
||||||
schemas:
|
schemas:
|
||||||
PromoCodeRequest:
|
RecoveryRequest:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- email
|
||||||
|
properties:
|
||||||
|
email:
|
||||||
|
type: string
|
||||||
|
format: email
|
||||||
|
description: Электронная почта, на которую нужно отправить инструкции по восстановлению
|
||||||
|
redirectionURL:
|
||||||
|
type: string
|
||||||
|
description: URL-адрес, на который перенаправляется пользователь
|
||||||
|
PromoCodeStatsRequest:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
codeword:
|
promoCodeID:
|
||||||
type: string
|
type: string
|
||||||
description: Кодовое слово, которое должен ввести пользователь
|
required:
|
||||||
description:
|
- promoCodeID
|
||||||
type: string
|
PromoCodeStats:
|
||||||
description: Описание, необходимое для администратора в панели управления
|
|
||||||
greetings:
|
|
||||||
type: string
|
|
||||||
description: Текст, который будет отправлен пользователю в ответ на активацию кода
|
|
||||||
dueTo:
|
|
||||||
type: integer
|
|
||||||
format: int64
|
|
||||||
description: Временная метка окончания активации кода
|
|
||||||
activationCount:
|
|
||||||
type: integer
|
|
||||||
format: int64
|
|
||||||
description: Лимит активации кода
|
|
||||||
bonus:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
privilege:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
privilegeID:
|
|
||||||
type: string
|
|
||||||
description: Идентификатор привилегии, которую необходимо предоставить
|
|
||||||
amount:
|
|
||||||
type: integer
|
|
||||||
format: uint64
|
|
||||||
description: Размер привилегии
|
|
||||||
discount:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
layer:
|
|
||||||
type: integer
|
|
||||||
factor:
|
|
||||||
type: number
|
|
||||||
target:
|
|
||||||
type: string
|
|
||||||
threshold:
|
|
||||||
type: integer
|
|
||||||
description: Информация о бонусах
|
|
||||||
|
|
||||||
PromoCodeResponse:
|
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
id:
|
id:
|
||||||
type: string
|
type: string
|
||||||
description: ID созданного промокода
|
description: Идентификатор промокода
|
||||||
codeword:
|
usageCount:
|
||||||
type: string
|
|
||||||
description: Кодовое слово промокода
|
|
||||||
description:
|
|
||||||
type: string
|
|
||||||
description: Описание промокода
|
|
||||||
greetings:
|
|
||||||
type: string
|
|
||||||
description: Текст, который будет отправлен пользователю в ответ на активацию кода
|
|
||||||
dueTo:
|
|
||||||
type: integer
|
type: integer
|
||||||
format: int64
|
description: Количество использований промокода
|
||||||
description: Временная метка окончания активации кода
|
usageMap:
|
||||||
activationCount:
|
|
||||||
type: integer
|
|
||||||
format: int64
|
|
||||||
description: Лимит активации кода
|
|
||||||
bonus:
|
|
||||||
type: object
|
type: object
|
||||||
properties:
|
description: Карта использования промокода
|
||||||
privilege:
|
additionalProperties:
|
||||||
type: object
|
type: array
|
||||||
properties:
|
items:
|
||||||
privilegeID:
|
$ref: '#/components/schemas/Usage'
|
||||||
type: string
|
|
||||||
description: Идентификатор привилегии, которую необходимо предоставить
|
Usage:
|
||||||
amount:
|
type: object
|
||||||
type: integer
|
properties:
|
||||||
format: uint64
|
key:
|
||||||
description: Размер привилегии
|
type: string
|
||||||
discount:
|
description: fastlink или codeword в зависимости от того что применялось
|
||||||
type: object
|
time:
|
||||||
properties:
|
|
||||||
layer:
|
|
||||||
type: integer
|
|
||||||
factor:
|
|
||||||
type: number
|
|
||||||
target:
|
|
||||||
type: string
|
|
||||||
threshold:
|
|
||||||
type: integer
|
|
||||||
description: Информация о бонусах
|
|
||||||
outdated:
|
|
||||||
type: boolean
|
|
||||||
offLimit:
|
|
||||||
type: boolean
|
|
||||||
delete:
|
|
||||||
type: boolean
|
|
||||||
createdAt:
|
|
||||||
type: string
|
type: string
|
||||||
format: date-time
|
format: date-time
|
||||||
description: Время создания промокода
|
description: Время использования промокода
|
||||||
|
|
||||||
ReqEditPromoCode:
|
CreateFastLinkRequest:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
id:
|
id:
|
||||||
type: string
|
type: string
|
||||||
description: ID промокода, который обновляем
|
description: ID промокода, для которого нужно создать быструю ссылку
|
||||||
description:
|
|
||||||
type: string
|
|
||||||
description: Описание, необходимое менеджеру в админке
|
|
||||||
greetings:
|
|
||||||
type: string
|
|
||||||
description: Текст, выдаваемый пользователю в ответ на активацию промокода
|
|
||||||
dueTo:
|
|
||||||
type: integer
|
|
||||||
format: int64
|
|
||||||
description: Временная метка окончания активации кода
|
|
||||||
activationCount:
|
|
||||||
type: integer
|
|
||||||
format: int64
|
|
||||||
description: Предел количества активаций промокода
|
|
||||||
delete:
|
|
||||||
type: boolean
|
|
||||||
description: Флаг удаления промокода
|
|
||||||
required:
|
required:
|
||||||
- id
|
- id
|
||||||
GetPromoCodesListReq:
|
|
||||||
type: object
|
|
||||||
required:
|
|
||||||
- page
|
|
||||||
- limit
|
|
||||||
- filter
|
|
||||||
properties:
|
|
||||||
page:
|
|
||||||
type: integer
|
|
||||||
description: Номер страницы выборки, начиная с 0
|
|
||||||
limit:
|
|
||||||
type: integer
|
|
||||||
description: Размер страницы выборки
|
|
||||||
filter:
|
|
||||||
$ref: '#/components/schemas/GetPromoCodesListReqFilter'
|
|
||||||
|
|
||||||
GetPromoCodesListReqFilter:
|
CreateFastLinkResponse:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
text:
|
fastlink:
|
||||||
type: string
|
type: string
|
||||||
description: Полнотекстовый поиск по полям Codeword, Description, Greetings
|
description: Быстрая ссылка для активации промокода
|
||||||
active:
|
|
||||||
type: boolean
|
|
||||||
description: Если true, выбираются записи, где delete, outdated и offLimit равны false
|
|
||||||
|
|
||||||
GetPromoCodesListResp:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
count:
|
|
||||||
type: integer
|
|
||||||
format: int64
|
|
||||||
description: Общее количество промокодов в выборке
|
|
||||||
items:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
$ref: '#/components/schemas/PromoCodeResponse'
|
|
||||||
|
|
||||||
ActivateReq:
|
ActivateReq:
|
||||||
type: object
|
type: object
|
||||||
|
required:
|
||||||
|
- codeword
|
||||||
properties:
|
properties:
|
||||||
codeword:
|
codeword:
|
||||||
type: string
|
type: string
|
||||||
description: Кодовое слово промокода, которое требуется активировать
|
description: Кодовое слово для активации промокода
|
||||||
fastLink:
|
fastLink:
|
||||||
type: string
|
type: string
|
||||||
description: Быстрая ссылка для активации промокода
|
description: Быстрая ссылка для активации промокода
|
||||||
@ -536,17 +331,190 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
greetings:
|
greetings:
|
||||||
type: string
|
type: string
|
||||||
description: Поле из активированного промокода
|
description: Слово успешной активации промокода
|
||||||
|
|
||||||
PromoCodeStats:
|
GetPromoCodesListReq:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- page
|
||||||
|
- limit
|
||||||
|
properties:
|
||||||
|
page:
|
||||||
|
type: integer
|
||||||
|
description: Номер страницы
|
||||||
|
limit:
|
||||||
|
type: integer
|
||||||
|
description: Максимальное количество элементов на странице
|
||||||
|
filter:
|
||||||
|
$ref: '#/components/schemas/Filter'
|
||||||
|
|
||||||
|
Filter:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
text:
|
||||||
|
type: string
|
||||||
|
description: Текстовый фильтр для поиска промокодов
|
||||||
|
active:
|
||||||
|
type: boolean
|
||||||
|
description: Флаг для фильтрации активных промокодов
|
||||||
|
|
||||||
|
GetPromoCodesListResp:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
count:
|
||||||
|
type: integer
|
||||||
|
description: Общее количество промокодов
|
||||||
|
items:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/PromoCode'
|
||||||
|
|
||||||
|
PromoCode:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
id:
|
id:
|
||||||
type: string
|
type: string
|
||||||
description: ID промокода
|
description: Идентификатор промокода
|
||||||
usageCount:
|
codeword:
|
||||||
|
type: string
|
||||||
|
description: Кодовое слово для активации промокода
|
||||||
|
description:
|
||||||
|
type: string
|
||||||
|
description: Описание промокода
|
||||||
|
greetings:
|
||||||
|
type: string
|
||||||
|
description: Приветственное сообщение после активации промокода
|
||||||
|
dueTo:
|
||||||
|
type: integer
|
||||||
|
description: Дата истечения действия промокода в формате Unix time
|
||||||
|
activationCount:
|
||||||
|
type: integer
|
||||||
|
description: Количество активаций промокода
|
||||||
|
bonus:
|
||||||
type: object
|
type: object
|
||||||
description: Количество использований промокода для каждого пользователя
|
description: Бонус, предоставляемый с промокодом
|
||||||
usageHistory:
|
properties:
|
||||||
|
privilege:
|
||||||
|
type: object
|
||||||
|
description: Привилегия
|
||||||
|
properties:
|
||||||
|
privilegeID:
|
||||||
|
type: string
|
||||||
|
description: Идентификатор привилегии
|
||||||
|
amount:
|
||||||
|
type: integer
|
||||||
|
description: Количество привилегии
|
||||||
|
discount:
|
||||||
|
type: object
|
||||||
|
description: Скидка
|
||||||
|
properties:
|
||||||
|
layer:
|
||||||
|
type: integer
|
||||||
|
description: Уровень скидки
|
||||||
|
factor:
|
||||||
|
type: number
|
||||||
|
description: Множитель скидки
|
||||||
|
target:
|
||||||
|
type: string
|
||||||
|
description: Слой
|
||||||
|
threshold:
|
||||||
|
type: integer
|
||||||
|
description: Граничное значение
|
||||||
|
outdated:
|
||||||
|
type: boolean
|
||||||
|
description: Флаг
|
||||||
|
offLimit:
|
||||||
|
type: boolean
|
||||||
|
description: Флаг
|
||||||
|
delete:
|
||||||
|
type: boolean
|
||||||
|
description: Флаг
|
||||||
|
createdAt:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
description: Дата и время создания промокода
|
||||||
|
fastLinks:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
description: Список быстрых ссылок для активации промокода
|
||||||
|
|
||||||
|
ReqEditPromoCode:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
ID:
|
||||||
|
type: string
|
||||||
|
description: Идентификатор промокода, который требуется обновить
|
||||||
|
Description:
|
||||||
|
type: string
|
||||||
|
nullable: true
|
||||||
|
description: Описание промокода
|
||||||
|
Greetings:
|
||||||
|
type: string
|
||||||
|
nullable: true
|
||||||
|
description: Приветственное сообщение после активации промокода
|
||||||
|
DueTo:
|
||||||
|
type: integer
|
||||||
|
nullable: true
|
||||||
|
description: Дата окончания промокода в формате Unix time
|
||||||
|
ActivationCount:
|
||||||
|
type: integer
|
||||||
|
nullable: true
|
||||||
|
description: Количество активаций промокода
|
||||||
|
Delete:
|
||||||
|
type: boolean
|
||||||
|
nullable: true
|
||||||
|
description: Флаг удаления промокода
|
||||||
|
PromoCodeReq:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
codeword:
|
||||||
|
type: string
|
||||||
|
description: Кодовое слово для активации промокода
|
||||||
|
description:
|
||||||
|
type: string
|
||||||
|
description: Описание промокода
|
||||||
|
greetings:
|
||||||
|
type: string
|
||||||
|
description: Приветственное сообщение после активации промокода
|
||||||
|
dueTo:
|
||||||
|
type: integer
|
||||||
|
description: Дата истечения действия промокода в формате Unix time
|
||||||
|
activationCount:
|
||||||
|
type: integer
|
||||||
|
description: Количество активаций промокода
|
||||||
|
bonus:
|
||||||
type: object
|
type: object
|
||||||
description: История использования промокода для каждого пользователя
|
description: Бонус
|
||||||
|
properties:
|
||||||
|
privilege:
|
||||||
|
type: object
|
||||||
|
description: Привилегия
|
||||||
|
properties:
|
||||||
|
privilegeID:
|
||||||
|
type: string
|
||||||
|
description: Идентификатор привилегии
|
||||||
|
amount:
|
||||||
|
type: integer
|
||||||
|
description: Количество привилегии
|
||||||
|
discount:
|
||||||
|
type: object
|
||||||
|
description: Скидка
|
||||||
|
properties:
|
||||||
|
layer:
|
||||||
|
type: integer
|
||||||
|
description: Уровень скидки
|
||||||
|
factor:
|
||||||
|
type: number
|
||||||
|
description: Множитель скидки
|
||||||
|
target:
|
||||||
|
type: string
|
||||||
|
description: Слой
|
||||||
|
threshold:
|
||||||
|
type: integer
|
||||||
|
description: Граничное значение
|
||||||
|
fastLinks:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
description: Список быстрых ссылок для активации промокода
|
||||||
|
@ -50,7 +50,7 @@ func (p *PromoCodeController) CreatePromoCode(c *fiber.Ctx) error {
|
|||||||
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{"error": "Internal Server Error"})
|
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{"error": "Internal Server Error"})
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.Status(fiber.StatusCreated).JSON(createdPromoCode)
|
return c.Status(fiber.StatusOK).JSON(createdPromoCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PromoCodeController) EditPromoCode(c *fiber.Ctx) error {
|
func (p *PromoCodeController) EditPromoCode(c *fiber.Ctx) error {
|
||||||
@ -193,6 +193,10 @@ func (p *PromoCodeController) GetStats(c *fiber.Ctx) error {
|
|||||||
return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{"error": "Invalid request payload"})
|
return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{"error": "Invalid request payload"})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if req.PromoCodeID == "" {
|
||||||
|
return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{"error": "PromoCode ID is required"})
|
||||||
|
}
|
||||||
|
|
||||||
promoStats, err := p.promoCodeService.GetStats(c.Context(), req.PromoCodeID)
|
promoStats, err := p.promoCodeService.GetStats(c.Context(), req.PromoCodeID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
p.logger.Error("Failed getting promo stats", zap.Error(err))
|
p.logger.Error("Failed getting promo stats", zap.Error(err))
|
||||||
|
Loading…
Reference in New Issue
Block a user