ci: trigga på master + formatfix inför Gitea Actions
CI / Typecheck, test & build (push) Failing after 2s

This commit is contained in:
Sven (AAMOS AI)
2026-08-13 17:25:14 +07:00
parent 61d60931ad
commit c32a7e33c7
141 changed files with 40555 additions and 45210 deletions
+17 -4
View File
@@ -21,7 +21,9 @@ export async function adminAnalyticsRoutes(app: FastifyInstance) {
/** Compute a funnel between two UTC dates (YYYY-MM-DD). */
app.get("/admin/v1/analytics/funnels/:name", admin, async (req) => {
const params = z.object({ name: z.enum(Object.keys(FUNNELS) as [string, ...string[]]) }).parse(req.params);
const params = z
.object({ name: z.enum(Object.keys(FUNNELS) as [string, ...string[]]) })
.parse(req.params);
const query = z
.object({
startDate: z.string().regex(/^\d{4}-\d{2}-\d{2}$/),
@@ -69,7 +71,10 @@ export async function adminAnalyticsRoutes(app: FastifyInstance) {
const querySql = `WITH ${ctes.join(", ")} SELECT ${selects.join(", ")}`;
const result = await app.db.execute(sql.raw(querySql));
const row = (Array.isArray(result) ? result[0] : (result.rows[0] ?? {})) as Record<string, number>;
const row = (Array.isArray(result) ? result[0] : (result.rows[0] ?? {})) as Record<
string,
number
>;
const stepCounts = steps.map((event, i) => ({
step: i + 1,
@@ -97,7 +102,10 @@ export async function adminAnalyticsRoutes(app: FastifyInstance) {
const query = z
.object({
startDate: z.string().regex(/^\d{4}-\d{2}-\d{2}$/),
endDate: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional(),
endDate: z
.string()
.regex(/^\d{4}-\d{2}-\d{2}$/)
.optional(),
})
.parse(req.query);
@@ -147,7 +155,12 @@ export async function adminAnalyticsRoutes(app: FastifyInstance) {
string,
{ cohortSize: number; retention: Array<{ day: number; active: number; rate: number }> }
> = {};
for (const r of rows as Array<{ cohort_date: string; day: number; cohort_size: number; active_users: number }>) {
for (const r of rows as Array<{
cohort_date: string;
day: number;
cohort_size: number;
active_users: number;
}>) {
const key = String(r.cohort_date).slice(0, 10);
if (!cohorts[key]) {
cohorts[key] = { cohortSize: Number(r.cohort_size), retention: [] };