flagon-io/g1t

public

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

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

19 lines841 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 { data } from "react-router";
2
3import type { Route } from "./+types/statement-entries";
4import { billing } from "../../lib/services.server";
5import { getViewer } from "../../lib/session.server";
6
7/** One statement line's entries, 50 at a time, for the billing page to open. */
8export async function loader({ params, context, request }: Route.LoaderArgs) {
9 const query = new URL(request.url).searchParams;
10 const entries = await billing.statementEntries(params.owner, getViewer(context), {
11 month: query.get("month") ?? "",
12 kind: query.get("kind") ?? "",
13 day: query.get("day"),
14 project: query.get("project"),
15 before: query.get("before"),
16 });
17 if (!entries.ok) throw data({ error: entries.error.message }, { status: 404 });
18 return Response.json(entries.value, { headers: { "cache-control": "no-store" } });
19}