Refactor ShowAudience handling across the application to align with MPAA rating system. Update ShowAudience enum to reflect new ratings (G, PG, PG-13, R, NC-17) and adjust related data models, API types, and frontend components to support nullable audience values. Enhance metadata handling to incorporate content ratings from external sources, ensuring proper audience filtering in scheduling logic. Update documentation to clarify changes in audience categorization and its implications for content management.
ci / build-backend (push) Successful in 1m28s
ci / build-frontend (push) Successful in 51s
ci / tests (push) Successful in 2m7s
ci / sonar (push) Successful in 4m31s

This commit is contained in:
Leonid Pershin
2026-07-26 22:18:14 +03:00
parent c4c93cff02
commit fdb0f321e4
34 changed files with 1868 additions and 116 deletions
+17 -6
View File
@@ -128,18 +128,27 @@ export type GenreDto = {
/** `Interstitial` — ролик-врезка: то же шоу, но со своим экраном и вне общей библиотеки. */
export type ShowKind = 'Series' | 'Single' | 'Interstitial'
/** Возрастная категория, по возрастанию строгости — порядок значим для правил планировщика. */
export type ShowAudience = 'Kids' | 'Family' | 'Teen' | 'General' | 'Adult'
/**
* Возрастной рейтинг (MPAA), по возрастанию строгости — порядок значим для правил планировщика.
* `null` у шоу означает «не проставлен», а не «подходит всем»: такой контент планировщик не отсекает.
*/
export type ShowAudience = 'G' | 'PG' | 'PG-13' | 'R' | 'NC-17'
/** Тот же порядок для селектов и списков. */
export const SHOW_AUDIENCES: ShowAudience[] = ['Kids', 'Family', 'Teen', 'General', 'Adult']
export const SHOW_AUDIENCES: ShowAudience[] = ['G', 'PG', 'PG-13', 'R', 'NC-17']
/**
* Значение пункта «рейтинг не проставлен» в селектах. Пустая строка не годится: Radix резервирует её
* под сброс и на пункте с value="" падает.
*/
export const AUDIENCE_UNSET = 'unset'
export type ShowSummaryDto = {
id: string
name: string
originalName: string | null
kind: ShowKind
audience: ShowAudience
audience: ShowAudience | null
episodeCount: number
seasonCount: number
year: number | null
@@ -192,7 +201,7 @@ type CollectionItemDto = {
position: number
showName: string
showKind: ShowKind
showAudience: ShowAudience
showAudience: ShowAudience | null
episodeCount: number
year: number | null
posterImageId: string | null
@@ -286,6 +295,8 @@ export type MetadataCandidate = {
year: number | null
overview: string | null
posterUrl: string | null
/** Сериал или полнометражка; null — источник ищет только по одному типу. */
kind: ShowKind | null
}
type SeasonGapDto = {
@@ -327,7 +338,7 @@ export type ShowDto = {
name: string
originalName: string | null
kind: ShowKind
audience: ShowAudience
audience: ShowAudience | null
description: string | null
metadataProvider: string | null
metadataExternalId: string | null
+9 -7
View File
@@ -108,7 +108,8 @@ export const en = {
genres: 'Genres',
genresHint: 'Any of the checked ones.',
maxAudience: 'No stricter than',
audienceHint: 'Categories are ordered by strictness: kids → family → … → adult.',
audienceHint:
'Ratings are ordered by strictness: G → PG → PG-13 → R → NC-17. Unrated shows stay in the selection.',
year: 'Year',
unitMinutes: 'Unit runtime, min',
unitMinutesHint:
@@ -294,13 +295,14 @@ export const en = {
originalName: 'Original name (eng)',
kind: 'Kind',
kinds: { Series: 'Series', Single: 'Movie', Interstitial: 'Clip' },
audience: 'Category',
audience: 'Rating',
audienceUnset: 'Not rated',
audiences: {
Kids: 'Kids',
Family: 'Family',
Teen: 'Teen',
General: 'General',
Adult: 'Adult',
G: 'G — general audiences',
PG: 'PG — parental guidance',
'PG-13': 'PG-13 — over 13',
R: 'R — under 17 with adult',
'NC-17': 'NC-17 — adults only',
},
seasons: 'Seasons',
loadedSeasons: 'Loaded seasons',
+9 -7
View File
@@ -108,7 +108,8 @@ export const ru = {
genres: 'Жанры',
genresHint: 'Любой из отмеченных.',
maxAudience: 'Возраст не строже',
audienceHint: 'Категории упорядочены по строгости: детское → семейное → … → взрослое.',
audienceHint:
'Рейтинги упорядочены по строгости: G → PG → PG-13 → R → NC-17. Шоу без рейтинга остаются в выборке.',
year: 'Год',
unitMinutes: 'Длительность единицы, мин',
unitMinutesHint:
@@ -294,13 +295,14 @@ export const ru = {
originalName: 'Оригинальное название (eng)',
kind: 'Тип',
kinds: { Series: 'Сериал', Single: 'Полнометражка', Interstitial: 'Ролик' },
audience: 'Категория',
audience: 'Рейтинг',
audienceUnset: 'Не проставлен',
audiences: {
Kids: 'Детское',
Family: 'Семейное',
Teen: 'Подростковое',
General: 'Общее',
Adult: 'Взрослое',
G: 'G — без ограничений',
PG: 'PG — с родителями',
'PG-13': 'PG-13 — с 13 лет',
R: 'R — с 17 со взрослым',
'NC-17': 'NC-17 — только взрослым',
},
seasons: 'Сезоны',
loadedSeasons: 'Загружены сезоны',