(connectionId: number)
| 10 | const WORKER_API_URL = 'http://localhost:3060'; |
| 11 | |
| 12 | export const syncConnection = async (connectionId: number) => sew(() => |
| 13 | withAuth(({ role }) => |
| 14 | withMinimumOrgRole(role, OrgRole.OWNER, async () => { |
| 15 | const response = await fetch(`${WORKER_API_URL}/api/sync-connection`, { |
| 16 | method: 'POST', |
| 17 | body: JSON.stringify({ |
| 18 | connectionId |
| 19 | }), |
| 20 | headers: { |
| 21 | 'Content-Type': 'application/json', |
| 22 | }, |
| 23 | }); |
| 24 | |
| 25 | if (!response.ok) { |
| 26 | return unexpectedError('Failed to sync connection'); |
| 27 | } |
| 28 | |
| 29 | const data = await response.json(); |
| 30 | const schema = z.object({ |
| 31 | jobId: z.string(), |
| 32 | }); |
| 33 | return schema.parse(data); |
| 34 | }) |
| 35 | ) |
| 36 | ); |
| 37 | |
| 38 | export const indexRepo = async (repoId: number) => sew(() => |
| 39 | withAuth(({ role }) => |
no test coverage detected