Skip to content

Commit 58483f5

Browse files
committed
fix build pls
1 parent 07544c8 commit 58483f5

2 files changed

Lines changed: 36 additions & 11 deletions

File tree

packages/api/src/routers/scheduler.ts

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { procedure, router } from "../trpc";
22
import { z } from "zod";
33
import { TRPCError } from "@trpc/server";
4+
import type { QueueDashScheduler } from "../utils/global.utils";
45
import { findQueueInCtxOrFail } from "../utils/global.utils";
56

67
export const schedulerRouter = router({
@@ -10,18 +11,23 @@ export const schedulerRouter = router({
1011
queueName: z.string(),
1112
}),
1213
)
13-
.query(async ({ input: { queueName }, ctx: { queues } }) => {
14-
const queueInCtx = findQueueInCtxOrFail({ queues, queueName });
14+
.query(
15+
async ({
16+
input: { queueName },
17+
ctx: { queues },
18+
}): Promise<QueueDashScheduler[]> => {
19+
const queueInCtx = findQueueInCtxOrFail({ queues, queueName });
1520

16-
if (queueInCtx.type !== "bullmq") {
17-
throw new TRPCError({
18-
code: "BAD_REQUEST",
19-
message: "Scheduled jobs are only supported for BullMQ queues",
20-
});
21-
}
21+
if (queueInCtx.type !== "bullmq") {
22+
throw new TRPCError({
23+
code: "BAD_REQUEST",
24+
message: "Scheduled jobs are only supported for BullMQ queues",
25+
});
26+
}
2227

23-
return queueInCtx.queue.getJobSchedulers();
24-
}),
28+
return queueInCtx.queue.getJobSchedulers();
29+
},
30+
),
2531

2632
add: procedure
2733
.input(
@@ -98,7 +104,10 @@ export const schedulerRouter = router({
98104
}),
99105
)
100106
.mutation(
101-
async ({ input: { jobSchedulerIds, queueName }, ctx: { queues } }) => {
107+
async ({
108+
input: { jobSchedulerIds, queueName },
109+
ctx: { queues },
110+
}): Promise<QueueDashScheduler[]> => {
102111
const queueInCtx = findQueueInCtxOrFail({
103112
queues,
104113
queueName,

packages/api/src/utils/global.utils.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,22 @@ type QueueDashJob = {
3636
retriedAt: Date | null;
3737
};
3838

39+
export type QueueDashScheduler = {
40+
key: string;
41+
name: string;
42+
id?: string | null;
43+
iterationCount?: number;
44+
limit?: number;
45+
endDate?: number;
46+
tz?: string;
47+
pattern?: string;
48+
every?: string;
49+
next?: number;
50+
template?: {
51+
data?: Record<string, unknown>;
52+
};
53+
};
54+
3955
export const formatJob = ({
4056
job,
4157
queueInCtx,

0 commit comments

Comments
 (0)