hezarfen_frontend
Clone
https://git.tahinli.com/Hezarfen/hezarfen_frontend.git
0 watching0 forksTypeScript5.5 MiBdcf123aBurak Boduroğlu2 months ago674 commits
| 1 | import { client } from "../client"; |
| 2 | import type { AcceptedInsightRun } from "./postInsightsRefresh"; |
| 3 | |
| 4 | export type PostInsightComputeBody = { |
| 5 | /** Compute only these sections; omit for all of them. */ |
| 6 | sections?: string[]; |
| 7 | /** ISO-8601 date to compute from; omit for the dönem's beginning. */ |
| 8 | since?: string; |
| 9 | }; |
| 10 | |
| 11 | /** |
| 12 | * 202 — queued, not computed. The service works through the student's data on |
| 13 | * its own; poll `getInsightByUserId` and watch `summary.computed_at` move. |
| 14 | * 503 when no service offers `insight.student`, and then nothing was queued. |
| 15 | * Authorization is `getInsightByUserId`'s gate for gate, so a refusal is a 404. |
| 16 | */ |
| 17 | export function postInsightComputeByUserId( |
| 18 | userId: string, |
| 19 | body: PostInsightComputeBody = {}, |
| 20 | ): Promise<AcceptedInsightRun> { |
| 21 | return client<AcceptedInsightRun>(`/insights/students/${encodeURIComponent(userId)}`, { |
| 22 | method: "POST", |
| 23 | body, |
| 24 | }); |
| 25 | } |