Update configuration and enhance media processing: add stream token TTL and timeout settings in .env.example, improve error handling in media endpoints, and refactor command handlers for asynchronous operations. Update documentation to reflect current application state and features.
build / backend (push) Successful in 2m19s
build / frontend (push) Successful in 53s
tests / backend-tests (push) Successful in 2m27s

This commit is contained in:
Leonid Pershin
2026-07-25 23:14:55 +03:00
parent a261e261f0
commit 6c18a9da79
42 changed files with 387 additions and 98 deletions
+27
View File
@@ -23,6 +23,33 @@ export function listMedia(params: ListMediaParams) {
return apiRequest<PagedList<MediaAssetDto>>(`/admin/media?${query.toString()}`)
}
/**
* Дозагружает ВСЕ страницы медиа (для пикеров с клиентской фильтрацией/сортировкой — кандидаты серий,
* пул рекламы), чтобы ничего не терялось молча за фиксированным pageSize. Есть предохранитель `cap`:
* если элементов больше — возвращаем `truncated: true`, и UI показывает предупреждение (а не делает вид,
* что список полон).
*/
export async function listAllMedia(
params: Omit<ListMediaParams, 'page' | 'pageSize'> & { cap?: number },
): Promise<{ items: MediaAssetDto[]; total: number; truncated: boolean }> {
const pageSize = 200
const cap = params.cap ?? 5000
const items: MediaAssetDto[] = []
let total = 0
for (let page = 1; ; page++) {
const res = await listMedia({
page,
pageSize,
statuses: params.statuses,
search: params.search,
})
total = res.total
items.push(...res.items)
if (res.items.length === 0 || items.length >= total || items.length >= cap) break
}
return { items, total, truncated: items.length < total }
}
export function deleteMedia(id: string) {
return apiRequest<void>(`/admin/media/${id}`, { method: 'DELETE' })
}