openapi: 3.1.0 info: title: Api version: 0.1.0 description: Admin Dashboard API servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: auth description: Authentication - name: movies description: Movies management - name: series description: Series management - name: doramas description: Doramas management - name: anime description: Anime management - name: schedule description: Weekly airing schedule - name: import description: Content import from TMDB/AniList paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /auth/check-first-admin: get: operationId: checkFirstAdmin tags: [auth] summary: Check if any admin exists responses: "200": description: Admin existence status content: application/json: schema: $ref: "#/components/schemas/FirstAdminCheck" /auth/register: post: operationId: registerAdmin tags: [auth] summary: Register first admin requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/RegisterRequest" responses: "201": description: Admin created content: application/json: schema: $ref: "#/components/schemas/AuthUser" "400": description: Bad request content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /auth/login: post: operationId: loginAdmin tags: [auth] summary: Login admin requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/LoginRequest" responses: "200": description: Login successful content: application/json: schema: $ref: "#/components/schemas/AuthUser" "401": description: Invalid credentials content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /auth/logout: post: operationId: logoutAdmin tags: [auth] summary: Logout admin responses: "200": description: Logout successful content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /auth/me: get: operationId: getCurrentUser tags: [auth] summary: Get current logged in user responses: "200": description: Current user content: application/json: schema: $ref: "#/components/schemas/AuthUser" "401": description: Not authenticated content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /movies: get: operationId: listMovies tags: [movies] summary: List movies with pagination parameters: - name: page in: query schema: type: integer default: 1 - name: limit in: query schema: type: integer default: 20 - name: search in: query schema: type: string responses: "200": description: Movies list content: application/json: schema: $ref: "#/components/schemas/MoviesList" post: operationId: createMovie tags: [movies] summary: Create a movie requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/MovieInput" responses: "201": description: Movie created content: application/json: schema: $ref: "#/components/schemas/MovieItem" /movies/{id}: put: operationId: updateMovie tags: [movies] summary: Update a movie parameters: - name: id in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/MovieInput" responses: "200": description: Movie updated content: application/json: schema: $ref: "#/components/schemas/MovieItem" delete: operationId: deleteMovie tags: [movies] summary: Delete a movie parameters: - name: id in: path required: true schema: type: string responses: "200": description: Movie deleted content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /movies/{id}/streams: get: operationId: listMovieStreams tags: [movies] summary: List streams for a movie parameters: - name: id in: path required: true schema: type: string responses: "200": description: Movie streams content: application/json: schema: $ref: "#/components/schemas/StreamsList" post: operationId: createMovieStream tags: [movies] summary: Add a stream to a movie parameters: - name: id in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/StreamInput" responses: "201": description: Stream created content: application/json: schema: $ref: "#/components/schemas/StreamItem" /streams/extract: post: operationId: extractStreams tags: [movies] summary: Extract stream info from URLs requestBody: required: true content: application/json: schema: type: object required: [urls] properties: urls: type: array items: type: string responses: "200": description: Extracted stream info content: application/json: schema: type: object properties: streams: type: array items: $ref: "#/components/schemas/ExtractedStreamInfo" /streams/{id}: delete: operationId: deleteStream tags: [movies] summary: Delete a stream parameters: - name: id in: path required: true schema: type: string responses: "200": description: Stream deleted content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /series: get: operationId: listSeries tags: [series] summary: List series with pagination parameters: - name: page in: query schema: type: integer default: 1 - name: limit in: query schema: type: integer default: 20 - name: search in: query schema: type: string responses: "200": description: Series list content: application/json: schema: $ref: "#/components/schemas/SeriesListResponse" post: operationId: createSeries tags: [series] summary: Create a series requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/SeriesInput" responses: "201": description: Series created content: application/json: schema: $ref: "#/components/schemas/SeriesItem" /series/{id}: put: operationId: updateSeries tags: [series] summary: Update a series parameters: - name: id in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/SeriesInput" responses: "200": description: Series updated content: application/json: schema: $ref: "#/components/schemas/SeriesItem" delete: operationId: deleteSeries tags: [series] summary: Delete a series parameters: - name: id in: path required: true schema: type: string responses: "200": description: Series deleted content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /series/{id}/seasons: get: operationId: listSeriesSeasons tags: [series] summary: List seasons for a series parameters: - name: id in: path required: true schema: type: string responses: "200": description: Seasons list content: application/json: schema: $ref: "#/components/schemas/SeasonsList" /series/seasons/{seasonId}/episodes: get: operationId: listSeriesEpisodes tags: [series] summary: List episodes for a season parameters: - name: seasonId in: path required: true schema: type: string responses: "200": description: Episodes list content: application/json: schema: $ref: "#/components/schemas/EpisodesList" /series/episodes/{episodeId}/streams: get: operationId: listSeriesEpisodeStreams tags: [series] summary: List streams for an episode parameters: - name: episodeId in: path required: true schema: type: string responses: "200": description: Streams list content: application/json: schema: $ref: "#/components/schemas/StreamsList" post: operationId: createSeriesEpisodeStream tags: [series] summary: Add stream to series episode parameters: - name: episodeId in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/StreamInput" responses: "201": description: Stream created content: application/json: schema: $ref: "#/components/schemas/StreamItem" /doramas: get: operationId: listDoramas tags: [doramas] summary: List doramas with pagination parameters: - name: page in: query schema: type: integer default: 1 - name: limit in: query schema: type: integer default: 20 - name: search in: query schema: type: string responses: "200": description: Doramas list content: application/json: schema: $ref: "#/components/schemas/DoramasListResponse" post: operationId: createDorama tags: [doramas] summary: Create a dorama requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/DoramaInput" responses: "201": description: Dorama created content: application/json: schema: $ref: "#/components/schemas/DoramaItem" /doramas/{id}: put: operationId: updateDorama tags: [doramas] summary: Update a dorama parameters: - name: id in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/DoramaInput" responses: "200": description: Dorama updated content: application/json: schema: $ref: "#/components/schemas/DoramaItem" delete: operationId: deleteDorama tags: [doramas] summary: Delete a dorama parameters: - name: id in: path required: true schema: type: string responses: "200": description: Dorama deleted content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /doramas/{id}/seasons: get: operationId: listDoramaSeasons tags: [doramas] summary: List seasons for a dorama parameters: - name: id in: path required: true schema: type: string responses: "200": description: Seasons list content: application/json: schema: $ref: "#/components/schemas/SeasonsList" /doramas/seasons/{seasonId}/episodes: get: operationId: listDoramaEpisodes tags: [doramas] summary: List episodes for a dorama season parameters: - name: seasonId in: path required: true schema: type: string responses: "200": description: Episodes list content: application/json: schema: $ref: "#/components/schemas/EpisodesList" /doramas/episodes/{episodeId}/streams: get: operationId: listDoramaEpisodeStreams tags: [doramas] summary: List streams for a dorama episode parameters: - name: episodeId in: path required: true schema: type: string responses: "200": description: Streams list content: application/json: schema: $ref: "#/components/schemas/StreamsList" post: operationId: createDoramaEpisodeStream tags: [doramas] summary: Add stream to dorama episode parameters: - name: episodeId in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/StreamInput" responses: "201": description: Stream created content: application/json: schema: $ref: "#/components/schemas/StreamItem" /anime: get: operationId: listAnime tags: [anime] summary: List anime with pagination parameters: - name: page in: query schema: type: integer default: 1 - name: limit in: query schema: type: integer default: 20 - name: search in: query schema: type: string responses: "200": description: Anime list content: application/json: schema: $ref: "#/components/schemas/AnimeListResponse" post: operationId: createAnime tags: [anime] summary: Create an anime requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AnimeInput" responses: "201": description: Anime created content: application/json: schema: $ref: "#/components/schemas/AnimeItem" /anime/{id}: put: operationId: updateAnime tags: [anime] summary: Update an anime parameters: - name: id in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AnimeInput" responses: "200": description: Anime updated content: application/json: schema: $ref: "#/components/schemas/AnimeItem" delete: operationId: deleteAnime tags: [anime] summary: Delete an anime parameters: - name: id in: path required: true schema: type: string responses: "200": description: Anime deleted content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /anime/{id}/seasons: get: operationId: listAnimeSeasons tags: [anime] summary: List seasons for an anime parameters: - name: id in: path required: true schema: type: string responses: "200": description: Seasons list content: application/json: schema: $ref: "#/components/schemas/SeasonsList" /anime/{id}/episodes: get: operationId: listAnimeEpisodes tags: [anime] summary: List episodes for an anime (direct, no season) parameters: - name: id in: path required: true schema: type: string responses: "200": description: Episodes list content: application/json: schema: $ref: "#/components/schemas/EpisodesList" /anime/seasons/{seasonId}/episodes: get: operationId: listAnimeSeasonEpisodes tags: [anime] summary: List episodes for an anime season parameters: - name: seasonId in: path required: true schema: type: string responses: "200": description: Episodes list content: application/json: schema: $ref: "#/components/schemas/EpisodesList" /anime/episodes/{episodeId}/streams: get: operationId: listAnimeEpisodeStreams tags: [anime] summary: List streams for an anime episode parameters: - name: episodeId in: path required: true schema: type: string responses: "200": description: Streams list content: application/json: schema: $ref: "#/components/schemas/StreamsList" post: operationId: createAnimeEpisodeStream tags: [anime] summary: Add stream to anime episode parameters: - name: episodeId in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/StreamInput" responses: "201": description: Stream created content: application/json: schema: $ref: "#/components/schemas/StreamItem" /schedule/weekly: get: operationId: getWeeklySchedule tags: [schedule] summary: Get weekly airing schedule for imported content parameters: - name: weekStart in: query schema: type: string description: ISO date for start of week (YYYY-MM-DD). Defaults to current week Monday. responses: "200": description: Weekly schedule grouped by weekday content: application/json: schema: $ref: "#/components/schemas/WeeklyScheduleResponse" /import/tmdb/search: get: operationId: searchTmdb tags: [import] summary: Search TMDB for movies or TV shows parameters: - name: query in: query required: true schema: type: string - name: type in: query required: true schema: type: string enum: [movie, tv] responses: "200": description: Search results content: application/json: schema: $ref: "#/components/schemas/TmdbSearchResults" /import/tmdb/details: get: operationId: getTmdbDetails tags: [import] summary: Get TMDB details for a movie or TV show parameters: - name: tmdbId in: query required: true schema: type: integer - name: type in: query required: true schema: type: string enum: [movie, tv] responses: "200": description: TMDB details with seasons content: application/json: schema: $ref: "#/components/schemas/TmdbDetails" /import/tmdb/season-episodes: get: operationId: getTmdbSeasonEpisodes tags: [import] summary: Get episodes for a TMDB season parameters: - name: tmdbId in: query required: true schema: type: integer - name: seasonNumber in: query required: true schema: type: integer responses: "200": description: Season episodes content: application/json: schema: $ref: "#/components/schemas/TmdbSeasonEpisodes" /import/tmdb/import: post: operationId: importFromTmdb tags: [import] summary: Import content from TMDB requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/TmdbImportRequest" responses: "201": description: Import successful content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /import/anilist/search: get: operationId: searchAnilist tags: [import] summary: Search AniList for anime parameters: - name: query in: query required: true schema: type: string responses: "200": description: Search results content: application/json: schema: $ref: "#/components/schemas/AnilistSearchResults" /import/anilist/details: get: operationId: getAnilistDetails tags: [import] summary: Get AniList anime details parameters: - name: anilistId in: query required: true schema: type: integer responses: "200": description: Anime details content: application/json: schema: $ref: "#/components/schemas/AnilistDetails" /import/anilist/import: post: operationId: importFromAnilist tags: [import] summary: Import anime from AniList requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AnilistImportRequest" responses: "201": description: Import successful content: application/json: schema: $ref: "#/components/schemas/MessageResponse" /sync/episodes: post: operationId: syncEpisodes tags: [import] summary: Sync new episodes from external sources requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/SyncEpisodesRequest" responses: "200": description: Sync result content: application/json: schema: $ref: "#/components/schemas/SyncEpisodesResponse" "404": description: Content not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" components: schemas: HealthStatus: type: object properties: status: type: string required: [status] ErrorResponse: type: object properties: error: type: string required: [error] MessageResponse: type: object properties: message: type: string required: [message] FirstAdminCheck: type: object properties: hasAdmin: type: boolean required: [hasAdmin] RegisterRequest: type: object properties: email: type: string password: type: string name: type: string required: [email, password, name] LoginRequest: type: object properties: email: type: string password: type: string required: [email, password] AuthUser: type: object properties: id: type: string email: type: string name: type: string role: type: string required: [id, email, name, role] MovieInput: type: object properties: tmdbId: type: integer title: type: string originalTitle: type: string overview: type: string releaseDate: type: string posterUrl: type: string backdropUrl: type: string voteAverage: type: number popularity: type: number required: [tmdbId, title] MovieItem: type: object properties: id: type: string tmdbId: type: integer title: type: string originalTitle: type: string overview: type: string releaseDate: type: string posterUrl: type: string backdropUrl: type: string voteAverage: type: string popularity: type: string isActive: type: boolean createdAt: type: string required: [id, tmdbId, title] MoviesList: type: object properties: data: type: array items: $ref: "#/components/schemas/MovieItem" total: type: integer page: type: integer totalPages: type: integer required: [data, total, page, totalPages] SeriesInput: type: object properties: tmdbId: type: integer title: type: string originalTitle: type: string overview: type: string firstAirDate: type: string posterUrl: type: string backdropUrl: type: string voteAverage: type: number popularity: type: number totalSeasons: type: integer totalEpisodes: type: integer required: [tmdbId, title] SeriesItem: type: object properties: id: type: string tmdbId: type: integer title: type: string originalTitle: type: string overview: type: string firstAirDate: type: string posterUrl: type: string backdropUrl: type: string voteAverage: type: string popularity: type: string totalSeasons: type: integer totalEpisodes: type: integer isActive: type: boolean createdAt: type: string required: [id, tmdbId, title] SeriesListResponse: type: object properties: data: type: array items: $ref: "#/components/schemas/SeriesItem" total: type: integer page: type: integer totalPages: type: integer required: [data, total, page, totalPages] DoramaInput: type: object properties: tmdbId: type: integer title: type: string originalTitle: type: string overview: type: string firstAirDate: type: string posterUrl: type: string backdropUrl: type: string voteAverage: type: number popularity: type: number totalSeasons: type: integer totalEpisodes: type: integer required: [tmdbId, title] DoramaItem: type: object properties: id: type: string tmdbId: type: integer title: type: string originalTitle: type: string overview: type: string firstAirDate: type: string posterUrl: type: string backdropUrl: type: string voteAverage: type: string popularity: type: string totalSeasons: type: integer totalEpisodes: type: integer isActive: type: boolean createdAt: type: string required: [id, tmdbId, title] DoramasListResponse: type: object properties: data: type: array items: $ref: "#/components/schemas/DoramaItem" total: type: integer page: type: integer totalPages: type: integer required: [data, total, page, totalPages] AnimeInput: type: object properties: anilistId: type: integer title: type: string englishTitle: type: string romajiTitle: type: string nativeTitle: type: string overview: type: string format: type: string season: type: string seasonYear: type: integer episodesCount: type: integer posterUrl: type: string bannerUrl: type: string score: type: number popularity: type: number required: [anilistId, title] AnimeItem: type: object properties: id: type: string anilistId: type: integer title: type: string englishTitle: type: string romajiTitle: type: string nativeTitle: type: string overview: type: string format: type: string season: type: string seasonYear: type: integer episodesCount: type: integer posterUrl: type: string bannerUrl: type: string score: type: string popularity: type: string isActive: type: boolean createdAt: type: string required: [id, anilistId, title] AnimeListResponse: type: object properties: data: type: array items: $ref: "#/components/schemas/AnimeItem" total: type: integer page: type: integer totalPages: type: integer required: [data, total, page, totalPages] SeasonItem: type: object properties: id: type: string seasonNumber: type: integer title: type: string overview: type: string airDate: type: string posterUrl: type: string episodeCount: type: integer required: [id, seasonNumber] SeasonsList: type: object properties: data: type: array items: $ref: "#/components/schemas/SeasonItem" required: [data] EpisodeItem: type: object properties: id: type: string episodeNumber: type: integer title: type: string overview: type: string airDate: type: string runtimeMinutes: type: integer stillUrl: type: string voteAverage: type: string required: [id, episodeNumber, title] EpisodesList: type: object properties: data: type: array items: $ref: "#/components/schemas/EpisodeItem" required: [data] StreamInput: type: object properties: name: type: string streamType: type: string enum: [hls, mp4, dash, torrent, embed, external] url: type: string quality: type: string language: type: string audioLanguage: type: string subtitleLanguage: type: string required: [name, streamType, url] ExtractedStreamInfo: type: object properties: name: type: string streamType: type: string url: type: string quality: type: string nullable: true language: type: string nullable: true required: [name, streamType, url] StreamItem: type: object properties: id: type: string name: type: string streamType: type: string url: type: string quality: type: string language: type: string audioLanguage: type: string subtitleLanguage: type: string isActive: type: boolean createdAt: type: string required: [id, name, streamType, url] StreamsList: type: object properties: data: type: array items: $ref: "#/components/schemas/StreamItem" required: [data] ScheduleItem: type: object properties: contentType: type: string enum: [anime, series, dorama] title: type: string posterUrl: type: string nullable: true episodeNumber: type: integer airingAt: type: string nullable: true weekday: type: integer required: [contentType, title, episodeNumber, weekday] WeeklyScheduleResponse: type: object properties: weekStart: type: string weekEnd: type: string schedule: type: object additionalProperties: type: array items: $ref: "#/components/schemas/ScheduleItem" required: [weekStart, weekEnd, schedule] TmdbSearchResult: type: object properties: id: type: integer title: type: string originalTitle: type: string overview: type: string posterPath: type: string backdropPath: type: string releaseDate: type: string voteAverage: type: number popularity: type: number required: [id, title] TmdbSearchResults: type: object properties: results: type: array items: $ref: "#/components/schemas/TmdbSearchResult" required: [results] TmdbSeason: type: object properties: seasonNumber: type: integer name: type: string overview: type: string posterPath: type: string airDate: type: string episodeCount: type: integer required: [seasonNumber, name] TmdbDetails: type: object properties: id: type: integer title: type: string originalTitle: type: string overview: type: string posterPath: type: string backdropPath: type: string releaseDate: type: string voteAverage: type: number popularity: type: number totalSeasons: type: integer totalEpisodes: type: integer seasons: type: array items: $ref: "#/components/schemas/TmdbSeason" required: [id, title] TmdbEpisode: type: object properties: episodeNumber: type: integer name: type: string overview: type: string airDate: type: string stillPath: type: string voteAverage: type: number runtimeMinutes: type: integer required: [episodeNumber, name] TmdbSeasonEpisodes: type: object properties: seasonNumber: type: integer episodes: type: array items: $ref: "#/components/schemas/TmdbEpisode" required: [seasonNumber, episodes] TmdbImportRequest: type: object properties: tmdbId: type: integer type: type: string enum: [movie, series, dorama] seasons: type: array items: type: object properties: seasonNumber: type: integer episodes: type: array items: type: object properties: episodeNumber: type: integer stillUrl: type: string required: [episodeNumber] required: [seasonNumber] required: [tmdbId, type] AnilistSearchResult: type: object properties: id: type: integer title: type: string englishTitle: type: string romajiTitle: type: string nativeTitle: type: string format: type: string episodes: type: integer season: type: string seasonYear: type: integer coverImage: type: string bannerImage: type: string score: type: number popularity: type: number description: type: string required: [id, title] AnilistSearchResults: type: object properties: results: type: array items: $ref: "#/components/schemas/AnilistSearchResult" required: [results] AnilistDetails: type: object properties: id: type: integer title: type: string englishTitle: type: string romajiTitle: type: string nativeTitle: type: string format: type: string episodes: type: integer season: type: string seasonYear: type: integer coverImage: type: string bannerImage: type: string score: type: number popularity: type: number description: type: string status: type: string studios: type: array items: type: string genres: type: array items: type: string required: [id, title] AnilistImportRequest: type: object properties: anilistId: type: integer episodes: type: array items: type: object properties: episodeNumber: type: integer title: type: string stillUrl: type: string required: [episodeNumber, title] required: [anilistId] SyncEpisodesRequest: type: object properties: contentType: type: string enum: [series, dorama, anime] id: type: string required: [contentType, id] SyncEpisodesResponse: type: object properties: added: type: object properties: seasons: type: integer episodes: type: integer required: [seasons, episodes] required: [added]