feat(qbittorrent): add configurable server-side sort order as widget option

This commit is contained in:
Thomas Camlong committed 2026-07-15 16:51:48 +02:00
1 parent 9ced0ab7d0
commit 064d1842de
7 files changed
+84 -8

No files matched your search

+12 -2
View File
@@ -22,10 +22,20 @@ export const downloadsRouter = createTRPCRouter({
},
})
.concat(createDownloadClientIntegrationMiddleware("query"))
.input(z.object({ limitPerIntegration: z.number().default(50) }))
.input(
z.object({
limitPerIntegration: z.number().default(50),
qbittorrentSort: z.string().optional(),
qbittorrentSortReverse: z.boolean().optional(),
}),
)
.query(async ({ ctx, input }) => {
return await settleIntegrationQueries(ctx.integrations, async (integration) => {
const innerHandler = downloadClientRequestHandler.handler(integration, { limit: input.limitPerIntegration });
const innerHandler = downloadClientRequestHandler.handler(integration, {
limit: input.limitPerIntegration,
qbittorrentSort: input.qbittorrentSort,
qbittorrentSortReverse: input.qbittorrentSortReverse,
});
const { data, timestamp } = await innerHandler.getDataAsync();
return {
integration: { id: integration.id, name: integration.name, kind: integration.kind, updatedAt: timestamp },