diff --git a/projects/api/src/contracts/_internal/response/listMetadataResponseSchema.ts b/projects/api/src/contracts/_internal/response/listMetadataResponseSchema.ts index 518796d7..ae95cf2f 100644 --- a/projects/api/src/contracts/_internal/response/listMetadataResponseSchema.ts +++ b/projects/api/src/contracts/_internal/response/listMetadataResponseSchema.ts @@ -4,5 +4,5 @@ export const listMetadataResponseSchema = z.object({ rank: z.number().int(), id: z.number().int(), listed_at: z.string().datetime(), - notes: z.string().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 07815300..683575b7 100644 --- a/projects/api/src/contracts/users/schema/response/favoritedMoviesResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/favoritedMoviesResponseSchema.ts @@ -5,5 +5,5 @@ export const favoritedMoviesResponseSchema = z.object({ id: z.number().int(), listed_at: z.string().datetime(), notes: z.string().nullish(), - rank: z.number().int(), + 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 be59e12d..8254a519 100644 --- a/projects/api/src/contracts/users/schema/response/favoritedShowsResponseSchema.ts +++ b/projects/api/src/contracts/users/schema/response/favoritedShowsResponseSchema.ts @@ -5,5 +5,5 @@ export const favoritedShowsResponseSchema = z.object({ id: z.number().int(), listed_at: z.string().datetime(), notes: z.string().nullish(), - rank: z.number().int(), + rank: z.number().int() }).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),