Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -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(),
});
Original file line number Diff line number Diff line change
Expand Up @@ -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(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be removed, please don't expose.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted for now.

}).merge(typedMovieResponseSchema);
Original file line number Diff line number Diff line change
Expand Up @@ -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);
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