(req: Request, res: Response)
| 48 | } |
| 49 | |
| 50 | private async syncConnection(req: Request, res: Response) { |
| 51 | const schema = z.object({ |
| 52 | connectionId: z.number(), |
| 53 | }).strict(); |
| 54 | |
| 55 | const parsed = schema.safeParse(req.body); |
| 56 | if (!parsed.success) { |
| 57 | res.status(400).json({ error: parsed.error.message }); |
| 58 | return; |
| 59 | } |
| 60 | |
| 61 | const { connectionId } = parsed.data; |
| 62 | const connection = await this.prisma.connection.findUnique({ |
| 63 | where: { |
| 64 | id: connectionId, |
| 65 | } |
| 66 | }); |
| 67 | |
| 68 | if (!connection) { |
| 69 | res.status(404).json({ error: 'Connection not found' }); |
| 70 | return; |
| 71 | } |
| 72 | |
| 73 | const [jobId] = await this.connectionManager.createJobs([connection]); |
| 74 | |
| 75 | res.status(200).json({ jobId }); |
| 76 | } |
| 77 | |
| 78 | private async indexRepo(req: Request, res: Response) { |
| 79 | const schema = z.object({ |
nothing calls this directly
no test coverage detected