From 520731649848b688e8bee6671f7dff31eb009499 Mon Sep 17 00:00:00 2001 From: michaldrabik Date: Fri, 19 Jun 2026 09:21:03 +0200 Subject: [PATCH 1/2] fix: endpoints fixes --- .../response/listMetadataResponseSchema.ts | 1 + .../response/favoritedMoviesResponseSchema.ts | 1 + .../response/favoritedShowsResponseSchema.ts | 1 + .../response/userCommentResponseSchema.ts | 38 ++++--------------- .../contracts/users/subroutes/userLists.ts | 2 +- 5 files changed, 12 insertions(+), 31 deletions(-) diff --git a/projects/api/src/contracts/_internal/response/listMetadataResponseSchema.ts b/projects/api/src/contracts/_internal/response/listMetadataResponseSchema.ts index 518796d7..70ed0413 100644 --- a/projects/api/src/contracts/_internal/response/listMetadataResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/listMetadataResponseSchema.ts @@ -5,4 +5,5 @@ export const listMetadataResponseSchema = z.object({ id: z.number().int(), listed_at: z.string().datetime(), notes: z.string().nullish(), + my_rating: z.number().int().nullish(), }); diff --git a/projects/api/src/contracts/users/schema/response/favoritedMoviesResponseSchema.ts b/projects/api/src/contracts/users/schema/response/favoritedMoviesResponseSchema.ts index 07815300..fa03a3e5 100644 --- a/projects/api/src/contracts/users/schema/response/favoritedMoviesResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/favoritedMoviesResponseSchema.ts @@ -6,4 +6,5 @@ export const favoritedMoviesResponseSchema = z.object({ listed_at: z.string().datetime(), notes: z.string().nullish(), rank: z.number().int(), + my_rating: z.number().int().nullish(), }).merge(typedMovieResponseSchema); diff --git a/projects/api/src/contracts/users/schema/response/favoritedShowsResponseSchema.ts b/projects/api/src/contracts/users/schema/response/favoritedShowsResponseSchema.ts index be59e12d..ed847bf2 100644 --- a/projects/api/src/contracts/users/schema/response/favoritedShowsResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/favoritedShowsResponseSchema.ts @@ -6,4 +6,5 @@ export const favoritedShowsResponseSchema = z.object({ listed_at: z.string().datetime(), notes: z.string().nullish(), rank: z.number().int(), + my_rating: z.number().int().nullish(), }).merge(typedShowResponseSchema); diff --git a/projects/api/src/contracts/users/schema/response/userCommentResponseSchema.ts b/projects/api/src/contracts/users/schema/response/userCommentResponseSchema.ts index eb8e6e3a..236f0666 100644 --- a/projects/api/src/contracts/users/schema/response/userCommentResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/userCommentResponseSchema.ts @@ -1,37 +1,15 @@ import { commentResponseSchema } from '../../../_internal/response/commentResponseSchema.ts'; import { episodeResponseSchema } from '../../../_internal/response/episodeResponseSchema.ts'; -import { typedMovieResponseSchema } from '../../../_internal/response/movieResponseSchema.ts'; -import { - showResponseSchema, - typedShowResponseSchema, -} from '../../../_internal/response/showResponseSchema.ts'; +import { movieResponseSchema } from '../../../_internal/response/movieResponseSchema.ts'; +import { showResponseSchema } from '../../../_internal/response/showResponseSchema.ts'; import { z } from '../../../_internal/z.ts'; import { seasonResponseSchema } from '../../../shows/schema/response/seasonResponseSchema.ts'; -const commentedMovieResponseSchema = z.object({ - comment: commentResponseSchema, -}).merge(typedMovieResponseSchema); - -const commentedShowResponseSchema = z.object({ - comment: commentResponseSchema, -}).merge(typedShowResponseSchema); - -const commentedSeasonResponseSchema = z.object({ - type: z.literal('season'), - season: seasonResponseSchema, +export const userCommentResponseSchema = z.object({ comment: commentResponseSchema, + type: z.enum(['movie', 'show', 'season', 'episode']), + movie: movieResponseSchema.optional(), + show: showResponseSchema.optional(), + season: seasonResponseSchema.optional(), + episode: episodeResponseSchema.optional(), }); - -const commentedEpisodeResponseSchema = z.object({ - type: z.literal('episode'), - episode: episodeResponseSchema, - show: showResponseSchema, - comment: commentResponseSchema, -}); - -export const userCommentResponseSchema = z.discriminatedUnion('type', [ - commentedMovieResponseSchema, - commentedShowResponseSchema, - commentedSeasonResponseSchema, - commentedEpisodeResponseSchema, -]); diff --git a/projects/api/src/contracts/users/subroutes/userLists.ts b/projects/api/src/contracts/users/subroutes/userLists.ts index 8d06edae..d42a80b8 100644 --- a/projects/api/src/contracts/users/subroutes/userLists.ts +++ b/projects/api/src/contracts/users/subroutes/userLists.ts @@ -216,7 +216,7 @@ Remove one or more items from a personal list. summary: 'Reorder items on a list', description: `#### 🔒 OAuth Required Reorder items on a personal list. Send the ordered list item IDs in the request body; the response returns the updated item order.`, - path: '/reorder', + path: '/items/reorder', method: 'POST', pathParams: profileParamsSchema .merge(listParamsSchema), From a3b6f1b801e70d5ddfcc6d5e0e464a3a2f8fa52c Mon Sep 17 00:00:00 2001 From: Michal Date: Mon, 29 Jun 2026 10:29:23 +0200 Subject: [PATCH 2/2] fix: revert my_ratings --- .../contracts/_internal/response/listMetadataResponseSchema.ts | 3 +-- .../users/schema/response/favoritedMoviesResponseSchema.ts | 3 +-- .../users/schema/response/favoritedShowsResponseSchema.ts | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/projects/api/src/contracts/_internal/response/listMetadataResponseSchema.ts b/projects/api/src/contracts/_internal/response/listMetadataResponseSchema.ts index 70ed0413..ae95cf2f 100644 --- a/projects/api/src/contracts/_internal/response/listMetadataResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/listMetadataResponseSchema.ts @@ -4,6 +4,5 @@ export const listMetadataResponseSchema = z.object({ rank: z.number().int(), id: z.number().int(), listed_at: z.string().datetime(), - notes: z.string().nullish(), - my_rating: z.number().int().nullish(), + notes: z.string().nullish() }); diff --git a/projects/api/src/contracts/users/schema/response/favoritedMoviesResponseSchema.ts b/projects/api/src/contracts/users/schema/response/favoritedMoviesResponseSchema.ts index fa03a3e5..683575b7 100644 --- a/projects/api/src/contracts/users/schema/response/favoritedMoviesResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/favoritedMoviesResponseSchema.ts @@ -5,6 +5,5 @@ export const favoritedMoviesResponseSchema = z.object({ id: z.number().int(), listed_at: z.string().datetime(), notes: z.string().nullish(), - rank: z.number().int(), - my_rating: z.number().int().nullish(), + rank: z.number().int() }).merge(typedMovieResponseSchema); diff --git a/projects/api/src/contracts/users/schema/response/favoritedShowsResponseSchema.ts b/projects/api/src/contracts/users/schema/response/favoritedShowsResponseSchema.ts index ed847bf2..8254a519 100644 --- a/projects/api/src/contracts/users/schema/response/favoritedShowsResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/favoritedShowsResponseSchema.ts @@ -5,6 +5,5 @@ export const favoritedShowsResponseSchema = z.object({ id: z.number().int(), listed_at: z.string().datetime(), notes: z.string().nullish(), - rank: z.number().int(), - my_rating: z.number().int().nullish(), + rank: z.number().int() }).merge(typedShowResponseSchema);