Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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()
});
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Original file line number Diff line number Diff line change
@@ -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,
]);
2 changes: 1 addition & 1 deletion projects/api/src/contracts/users/subroutes/userLists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Loading