From 1efcb2dfbdedc19f02be738d5fb4bf466ac42d62 Mon Sep 17 00:00:00 2001 From: Kevin Cador Date: Tue, 30 Jun 2026 12:25:02 +0200 Subject: [PATCH] fix(api): correct favorited response schemas --- projects/api/src/contracts/movies/index.ts | 8 +++++++- .../schema/response/movieFavoritedResponseSchema.ts | 7 +++++++ projects/api/src/contracts/shows/index.ts | 6 +++++- .../shows/schema/response/showFavoritedResponseSchema.ts | 7 +++++++ 4 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 projects/api/src/contracts/movies/schema/response/movieFavoritedResponseSchema.ts create mode 100644 projects/api/src/contracts/shows/schema/response/showFavoritedResponseSchema.ts diff --git a/projects/api/src/contracts/movies/index.ts b/projects/api/src/contracts/movies/index.ts index 77f8b4fe..f976982f 100644 --- a/projects/api/src/contracts/movies/index.ts +++ b/projects/api/src/contracts/movies/index.ts @@ -41,6 +41,7 @@ import { } from '../_internal/response/watchNowResponseSchema.ts'; import { z } from '../_internal/z.ts'; import { movieAnticipatedResponseSchema } from './schema/response/movieAnticipatedResponseSchema.ts'; +import { movieFavoritedResponseSchema } from './schema/response/movieFavoritedResponseSchema.ts'; import { movieHotResponseSchema } from './schema/response/movieHotResponseSchema.ts'; import { movieStreamingResponseSchema } from './schema/response/movieStreamingResponseSchema.ts'; import { movieTrendingResponseSchema } from './schema/response/movieTrendingResponseSchema.ts'; @@ -377,7 +378,7 @@ Returns the most favorited movies in the specified time \`period\`, defaulting t .merge(ignoreQuerySchema), pathParams: periodParamsSchema, responses: { - 200: movieWatchedResponseSchema.array(), + 200: movieFavoritedResponseSchema.array(), }, }, played: { @@ -540,6 +541,11 @@ export type MovieWatchedResponse = z.infer< typeof movieWatchedResponseSchema >; +export { movieFavoritedResponseSchema }; +export type MovieFavoritedResponse = z.infer< + typeof movieFavoritedResponseSchema +>; + export { movieAnticipatedResponseSchema }; export type MovieAnticipatedResponse = z.infer< typeof movieAnticipatedResponseSchema diff --git a/projects/api/src/contracts/movies/schema/response/movieFavoritedResponseSchema.ts b/projects/api/src/contracts/movies/schema/response/movieFavoritedResponseSchema.ts new file mode 100644 index 00000000..c872d758 --- /dev/null +++ b/projects/api/src/contracts/movies/schema/response/movieFavoritedResponseSchema.ts @@ -0,0 +1,7 @@ +import { movieResponseSchema } from '../../../_internal/response/movieResponseSchema.ts'; +import { z } from '../../../_internal/z.ts'; + +export const movieFavoritedResponseSchema = z.object({ + user_count: z.number().int(), + movie: movieResponseSchema, +}); diff --git a/projects/api/src/contracts/shows/index.ts b/projects/api/src/contracts/shows/index.ts index a60a7ddc..c31ca5b8 100644 --- a/projects/api/src/contracts/shows/index.ts +++ b/projects/api/src/contracts/shows/index.ts @@ -42,6 +42,7 @@ import { seasonParamsSchema } from './schema/request/seasonParamsSchema.ts'; import { showQueryParamsSchema } from './schema/request/showQueryParamsSchema.ts'; import { seasonResponseSchema } from './schema/response/seasonResponseSchema.ts'; import { showAnticipatedResponseSchema } from './schema/response/showAnticipatedResponseSchema.ts'; +import { showFavoritedResponseSchema } from './schema/response/showFavoritedResponseSchema.ts'; import { showHotResponseSchema } from './schema/response/showHotResponseSchema.ts'; import { showProgressResponseSchema } from './schema/response/showProgressResponseSchema.ts'; import { showStreamingResponseSchema } from './schema/response/showStreamingResponseSchema.ts'; @@ -868,7 +869,7 @@ Returns the most favorited shows in the specified time \`period\`, defaulting to .merge(ignoreQuerySchema), pathParams: periodParamsSchema, responses: { - 200: showWatchedResponseSchema.array(), + 200: showFavoritedResponseSchema.array(), }, }, played: { @@ -1013,6 +1014,9 @@ export type ShowTrendingResponse = z.infer; export { showWatchedResponseSchema }; export type ShowWatchedResponse = z.infer; +export { showFavoritedResponseSchema }; +export type ShowFavoritedResponse = z.infer; + export type ShowStatsResponse = z.infer; export { showAnticipatedResponseSchema }; diff --git a/projects/api/src/contracts/shows/schema/response/showFavoritedResponseSchema.ts b/projects/api/src/contracts/shows/schema/response/showFavoritedResponseSchema.ts new file mode 100644 index 00000000..cae656e6 --- /dev/null +++ b/projects/api/src/contracts/shows/schema/response/showFavoritedResponseSchema.ts @@ -0,0 +1,7 @@ +import { showResponseSchema } from '../../../_internal/response/showResponseSchema.ts'; +import { z } from '../../../_internal/z.ts'; + +export const showFavoritedResponseSchema = z.object({ + user_count: z.number().int(), + show: showResponseSchema, +});