diff --git a/api/src/models/entry/episode.ts b/api/src/models/entry/episode.ts index 43198a3c..3b46fd4e 100644 --- a/api/src/models/entry/episode.ts +++ b/api/src/models/entry/episode.ts @@ -1,4 +1,5 @@ import { t } from "elysia"; +import type { Prettify } from "~/utils"; import { EpisodeId, Resource, SeedImage, TranslationRecord } from "../utils"; import { BaseEntry, EntryTranslation } from "./base-entry"; @@ -14,7 +15,7 @@ export const BaseEpisode = t.Intersect([ ]); export const Episode = t.Intersect([Resource(), BaseEpisode, EntryTranslation]); -export type Episode = typeof Episode.static; +export type Episode = Prettify; export const SeedEpisode = t.Intersect([ t.Omit(BaseEpisode, ["thumbnail", "createdAt", "nextRefresh"]), @@ -24,4 +25,4 @@ export const SeedEpisode = t.Intersect([ videos: t.Optional(t.Array(t.String({ format: "uuid" }))), }), ]); -export type SeedEpisode = typeof SeedEpisode.static; +export type SeedEpisode = Prettify; diff --git a/api/src/models/entry/extra.ts b/api/src/models/entry/extra.ts index 5d002976..94ab4cc7 100644 --- a/api/src/models/entry/extra.ts +++ b/api/src/models/entry/extra.ts @@ -1,5 +1,5 @@ import { t } from "elysia"; -import { comment } from "~/utils"; +import { type Prettify, comment } from "~/utils"; import { SeedImage } from "../utils"; import { Resource } from "../utils/resource"; import { BaseEntry } from "./base-entry"; @@ -31,7 +31,7 @@ export const BaseExtra = t.Intersect( ); export const Extra = t.Intersect([Resource(), BaseExtra]); -export type Extra = typeof Extra.static; +export type Extra = Prettify; export const SeedExtra = t.Intersect([ t.Omit(BaseExtra, ["thumbnail", "createdAt"]), @@ -41,4 +41,4 @@ export const SeedExtra = t.Intersect([ video: t.String({ format: "uuid" }), }), ]); -export type SeedExtra = typeof SeedExtra.static; +export type SeedExtra = Prettify; diff --git a/api/src/models/entry/index.ts b/api/src/models/entry/index.ts index 56b9b9f9..75f500b1 100644 --- a/api/src/models/entry/index.ts +++ b/api/src/models/entry/index.ts @@ -9,10 +9,10 @@ import { } from "../entry"; export const Entry = t.Union([Episode, MovieEntry, Special]); -export type Entry = typeof Entry.static; +export type Entry = Episode | MovieEntry | Special; export const SeedEntry = t.Union([SeedEpisode, SeedMovieEntry, SeedSpecial]); -export type SeedEntry = typeof SeedEntry.static; +export type SeedEntry = SeedEpisode | SeedMovieEntry | SeedSpecial; export * from "./episode"; export * from "./movie-entry"; diff --git a/api/src/models/entry/movie-entry.ts b/api/src/models/entry/movie-entry.ts index ca8a8e9d..ada21fe2 100644 --- a/api/src/models/entry/movie-entry.ts +++ b/api/src/models/entry/movie-entry.ts @@ -1,5 +1,5 @@ import { t } from "elysia"; -import { comment } from "../../utils"; +import { comment, Prettify } from "../../utils"; import { ExternalId, Image, @@ -42,7 +42,7 @@ export const MovieEntry = t.Intersect([ BaseMovieEntry, MovieEntryTranslation, ]); -export type MovieEntry = typeof MovieEntry.static; +export type MovieEntry = Prettify; export const SeedMovieEntry = t.Intersect([ t.Omit(BaseMovieEntry, ["thumbnail", "createdAt", "nextRefresh"]), @@ -58,4 +58,4 @@ export const SeedMovieEntry = t.Intersect([ videos: t.Optional(t.Array(t.String({ format: "uuid" }))), }), ]); -export type SeedMovieEntry = typeof SeedMovieEntry.static; +export type SeedMovieEntry = Prettify; diff --git a/api/src/models/entry/special.ts b/api/src/models/entry/special.ts index 188c8b3c..ea53f8c9 100644 --- a/api/src/models/entry/special.ts +++ b/api/src/models/entry/special.ts @@ -1,5 +1,5 @@ import { t } from "elysia"; -import { comment } from "../../utils"; +import { type Prettify, comment } from "~/utils"; import { EpisodeId, Resource, SeedImage, TranslationRecord } from "../utils"; import { BaseEntry, EntryTranslation } from "./base-entry"; @@ -25,7 +25,7 @@ export const BaseSpecial = t.Intersect( ); export const Special = t.Intersect([Resource(), BaseSpecial, EntryTranslation]); -export type Special = typeof Special.static; +export type Special = Prettify; export const SeedSpecial = t.Intersect([ t.Omit(BaseSpecial, ["thumbnail", "createdAt", "nextRefresh"]), @@ -35,4 +35,4 @@ export const SeedSpecial = t.Intersect([ videos: t.Optional(t.Array(t.String({ format: "uuid" }))), }), ]); -export type SeedSpecial = typeof SeedSpecial.static; +export type SeedSpecial = Prettify; diff --git a/api/src/models/entry/unknown-entry.ts b/api/src/models/entry/unknown-entry.ts index 383fd15b..b5b12673 100644 --- a/api/src/models/entry/unknown-entry.ts +++ b/api/src/models/entry/unknown-entry.ts @@ -1,5 +1,5 @@ import { t } from "elysia"; -import { comment } from "../../utils"; +import { type Prettify, comment } from "~/utils"; import { Resource } from "../utils/resource"; import { BaseEntry, EntryTranslation } from "./base-entry"; @@ -27,4 +27,4 @@ export const UnknownEntry = t.Intersect([ BaseUnknownEntry, UnknownEntryTranslation, ]); -export type UnknownEntry = typeof UnknownEntry.static; +export type UnknownEntry = Prettify; diff --git a/api/src/models/movie.ts b/api/src/models/movie.ts index 76099c23..fccce3b8 100644 --- a/api/src/models/movie.ts +++ b/api/src/models/movie.ts @@ -1,4 +1,5 @@ import { t } from "elysia"; +import type { Prettify } from "~/utils"; import { bubble, registerExamples } from "./examples"; import { bubbleImages } from "./examples/bubble"; import { @@ -57,7 +58,7 @@ export const Movie = t.Intersect([ BaseMovie, t.Object({ isAvailable: t.Boolean() }), ]); -export type Movie = typeof Movie.static; +export type Movie = Prettify; export const FullMovie = t.Intersect([ Movie, @@ -86,7 +87,7 @@ export const SeedMovie = t.Intersect([ videos: t.Optional(t.Array(t.String({ format: "uuid" }))), }), ]); -export type SeedMovie = typeof SeedMovie.static; +export type SeedMovie = Prettify; registerExamples(Movie, { ...bubble, diff --git a/api/src/utils.ts b/api/src/utils.ts index bb3d374e..72d76e2e 100644 --- a/api/src/utils.ts +++ b/api/src/utils.ts @@ -10,3 +10,7 @@ export const comment = (str: TemplateStringsArray, ...values: any[]) => export function getYear(date: string) { return new Date(date).getUTCFullYear(); } + +export type Prettify = { + [K in keyof T]: Prettify; +} & {};