support limitPercent for smart playlists

This commit is contained in:
jeffvli
2026-03-31 21:09:13 -07:00
parent de403ea6ac
commit d3881ee3be
6 changed files with 134 additions and 21 deletions
+10 -2
View File
@@ -600,6 +600,14 @@ const songListParameters = paginationParameters.extend({
year: z.number().optional(),
});
const playlistRules = z
.object({
limit: z.number().optional(),
limitPercent: z.number().optional(),
sort: z.string().optional(),
})
.catchall(z.any());
const playlist = z.object({
comment: z.string(),
createdAt: z.string(),
@@ -611,7 +619,7 @@ const playlist = z.object({
ownerName: z.string(),
path: z.string(),
public: z.boolean(),
rules: z.record(z.string(), z.any()),
rules: playlistRules,
size: z.number(),
songCount: z.number(),
sync: z.boolean(),
@@ -643,7 +651,7 @@ const createPlaylistParameters = z.object({
name: z.string(),
ownerId: z.string().optional(),
public: z.boolean().optional(),
rules: z.record(z.any()).optional(),
rules: playlistRules.optional(),
sync: z.boolean().optional(),
});
+9 -3
View File
@@ -340,7 +340,7 @@ export type Playlist = {
owner: null | string;
ownerId: null | string;
public: boolean | null;
rules?: null | Record<string, any>;
rules?: null | PlaylistRules;
size: null | number;
songCount: null | number;
sync?: boolean | null;
@@ -947,7 +947,7 @@ export type CreatePlaylistBody = {
name: string;
ownerId?: string;
public?: boolean;
queryBuilderRules?: Record<string, any>;
queryBuilderRules?: PlaylistRules;
sync?: boolean;
};
@@ -1009,6 +1009,12 @@ export interface PlaylistListQuery extends BaseQuery<PlaylistListSort> {
// Playlist List
export type PlaylistListResponse = BasePaginatedResponse<Playlist[]>;
export type PlaylistRules = Record<string, any> & {
limit?: number;
limitPercent?: number;
sort?: string;
};
export type RatingQuery = {
id: string[];
rating: number;
@@ -1089,7 +1095,7 @@ export type UpdatePlaylistBody = {
name: string;
ownerId?: string;
public?: boolean;
queryBuilderRules?: Record<string, any>;
queryBuilderRules?: PlaylistRules;
sync?: boolean;
};