Add interstitial endpoints and enhance media and template functionalities: implement MapInterstitialEndpoints in Program.cs, add preview functionality for media assets in MediaEndpoints, and introduce template preview capabilities in TemplateEndpoints. Remove obsolete bumper settings from Channel and related classes to streamline configuration.
build / backend (push) Successful in 5m58s
build / frontend (push) Successful in 47s
tests / backend-tests (push) Successful in 5m57s

This commit is contained in:
Leonid Pershin
2026-07-26 14:03:53 +03:00
parent 66040a8841
commit 7b12a06d1b
53 changed files with 4076 additions and 469 deletions
+78 -1
View File
@@ -7,8 +7,13 @@ import type {
ChannelDto,
ChannelSummaryDto,
CreatedIdResponse,
JunctionAmountMode,
JunctionConditions,
JunctionElementKind,
JunctionTemplateDto,
LayerApplicability,
ScheduleEntryDto,
SchedulePreviewDto,
ScheduleTemplateDto,
SlotDto,
} from '@/shared/api/types'
@@ -58,9 +63,17 @@ export function applyChannelTemplate(channelId: string) {
})
}
/** Сухой прогон по текущим правилам: ничего не пишет и не двигает курсоры слотов. */
export function previewTemplate(channelId: string, days: number) {
const query = new URLSearchParams({ days: String(days) })
return apiRequest<SchedulePreviewDto>(
`/admin/channels/${channelId}/template/preview?${query.toString()}`,
)
}
export function updateTemplate(
templateId: string,
body: { name: string; fallbackGroupId: string | null },
body: { name: string; fallbackGroupId: string | null; defaultJunctionId: string | null },
) {
return apiRequest<void>(`/admin/templates/${templateId}`, { method: 'PUT', body })
}
@@ -103,6 +116,70 @@ export function deleteSlot(slotId: string) {
return apiRequest<void>(`/admin/slots/${slotId}`, { method: 'DELETE' })
}
// ── Стыки канала ──────────────────────────────────────────────────────────
export function listJunctions(channelId: string) {
return apiRequest<JunctionTemplateDto[]>(`/admin/channels/${channelId}/junctions`)
}
export function createJunction(channelId: string, name: string) {
return apiRequest<CreatedIdResponse>(`/admin/channels/${channelId}/junctions`, {
method: 'POST',
body: { name },
})
}
export function renameJunction(junctionId: string, name: string) {
return apiRequest<void>(`/admin/junctions/${junctionId}`, { method: 'PUT', body: { name } })
}
export function deleteJunction(junctionId: string) {
return apiRequest<void>(`/admin/junctions/${junctionId}`, { method: 'DELETE' })
}
export function addJunctionElement(junctionId: string, kind: JunctionElementKind) {
return apiRequest<CreatedIdResponse>(`/admin/junctions/${junctionId}/elements`, {
method: 'POST',
body: { kind },
})
}
/** Тело врезки: то же для любого типа — лишние поля сервер обнуляет сам (см. JunctionElement.Update). */
export type JunctionElementBody = {
kind: JunctionElementKind
groupId: string | null
bumperTemplateId: string | null
amountMode: JunctionAmountMode
amountValue: number
isRequired: boolean
conditions: JunctionConditions | null
}
export function updateJunctionElement(
junctionId: string,
elementId: string,
body: JunctionElementBody,
) {
return apiRequest<void>(`/admin/junctions/${junctionId}/elements/${elementId}`, {
method: 'PUT',
body,
})
}
export function removeJunctionElement(junctionId: string, elementId: string) {
return apiRequest<void>(`/admin/junctions/${junctionId}/elements/${elementId}`, {
method: 'DELETE',
})
}
/** Порядок врезок: не упомянутые остаются после перечисленных. */
export function reorderJunction(junctionId: string, elementIdsInOrder: string[]) {
return apiRequest<void>(`/admin/junctions/${junctionId}/order`, {
method: 'PUT',
body: { elementIdsInOrder },
})
}
export type BumperTemplateStyleBody = {
name: string
backgroundColor: string