feat(admin): transfer user accounts and show local cover coverage
ci / contract / contract (сгенерированный код совпадает с openapi.yaml) (push) Successful in 1m17s
ci / ts / ts (packages + web) (push) Successful in 3m13s
ci / api / api (push) Successful in 59s
ci / mobile / mobile (Metro-бандл Android) (push) Successful in 1m31s
ci / db / db (push) Successful in 2m50s

This commit is contained in:
mrleo1nid committed 2026-10-23 02:17:06 +03:00
1 parent 0a4cd4bff1
commit f1528de948
22 files changed
+1661 -313

No files matched your search

+119
View File
@@ -460,6 +460,61 @@ paths:
$ref: "#/components/schemas/CreatedUser"
default:
$ref: "#/components/responses/Problem"
/api/v1/admin/sources/{id}/cover-stats:
get:
operationId: getSourceCoverStats
tags: [admin]
summary: Покрытие аудиофайлов локальными обложками (admin)
parameters:
- $ref: "#/components/parameters/SourceId"
responses:
"200":
description: Доступные аудиофайлы без исключённых папок; внешние обложки не учитываются
content:
application/json:
schema:
$ref: "#/components/schemas/SourceCoverStats"
default:
$ref: "#/components/responses/Problem"
/api/v1/admin/users/export:
get:
operationId: exportUsers
tags: [admin]
summary: Экспорт учётных записей с ролями и хэшами паролей (admin)
description: Только учётные записи и права доступа, без рекомендаций, истории, лайков и сессий. Ответ не кэшируется.
responses:
"200":
description: Файл переноса пользователей
content:
application/json:
schema:
$ref: "#/components/schemas/UserArchive"
default:
$ref: "#/components/responses/Problem"
/api/v1/admin/users/import:
post:
operationId: importUsers
tags: [admin]
summary: Импорт учётных записей с сохранением паролей (admin)
description: |
Атомарное добавление пользователей из экспорта, до 10000 записей и 16 MiB.
Существующие логины пропускаются без изменений. Новые записи получают новые ID.
Рекомендации, история, лайки и сессии не импортируются.
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/UserArchive"
responses:
"200":
description: Результат импорта
content:
application/json:
schema:
$ref: "#/components/schemas/UserImportResult"
default:
$ref: "#/components/responses/Problem"
/api/v1/admin/users/{id}:
parameters:
- $ref: "#/components/parameters/UserId"
@@ -2730,6 +2785,70 @@ components:
type: string
new_password:
type: string
SourceCoverStats:
type: object
required: [files_total, files_with_cover, albums_pending]
properties:
files_total:
type: integer
format: int64
files_with_cover:
type: integer
format: int64
description: Файлы, альбом которых имеет готовую локальную обложку (встроенную или из папки)
albums_pending:
type: integer
format: int64
UserArchive:
type: object
additionalProperties: false
required: [version, users]
properties:
version:
type: integer
enum: [1]
users:
type: array
maxItems: 10000
items:
$ref: "#/components/schemas/UserArchiveEntry"
UserArchiveEntry:
type: object
additionalProperties: false
required: [username, display_name, role, password_hash, is_blocked, must_change_password, must_change_credentials, reviews_uploads, manages_updates]
properties:
username:
type: string
display_name:
type: string
nullable: true
maxLength: 64
role:
$ref: "#/components/schemas/Role"
password_hash:
type: string
maxLength: 512
description: Argon2id PHC. Секретные данные; файл нужно хранить в защищённом месте.
is_blocked:
type: boolean
must_change_password:
type: boolean
must_change_credentials:
type: boolean
reviews_uploads:
type: boolean
manages_updates:
type: boolean
UserImportResult:
type: object
required: [created, skipped]
properties:
created:
type: integer
skipped:
type: array
items:
type: string
AdminUser:
type: object
required: [id, username, display_name, role, reviews_uploads, locale, is_blocked, must_change_password, must_change_credentials, created_at, last_login_at]