g1t/apps/web/app/routes/workspace/statement-entries.ts

19 lines981 bytesCodeBlame

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

The statement is a month at a time, a line per kind of charge1import type { Route } from "./+types/statement-entries";
2import { billing } from "../../lib/services.server";
3import { getViewer } from "../../lib/session.server";
4
5/** One statement line's entries, 50 at a time, for the billing page to open. */
6export async function loader({ params, context, request }: Route.LoaderArgs) {
7 const query = new URL(request.url).searchParams;
8 const entries = await billing.statementEntries(params.owner, getViewer(context), {
9 month: query.get("month") ?? "",
10 kind: query.get("kind") ?? "",
11 day: query.get("day"),
12 project: query.get("project"),
13 before: query.get("before"),
14 });
Merge branch 'worktree-agent-a985c01f43538af01'15 // Said beside the line that asked. As a 200: a fetcher shows any other
16 // status as an error page in place of the whole billing page.
17 if (!entries.ok) return Response.json({ error: entries.error.message }, { headers: { "cache-control": "no-store" } });
The statement is a month at a time, a line per kind of charge18 return Response.json(entries.value, { headers: { "cache-control": "no-store" } });
19}

This file's history is long; its oldest lines are credited to the oldest commit read.