Skip to content

Commit

Permalink
fix build log mess/code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
QPixel committed Apr 3, 2024
1 parent 24eb0fd commit abeb96d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
2 changes: 0 additions & 2 deletions src/pages/api/counter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ async function getCounterWithQuarter(currentQuarter: string, env: ENV) {
}

export async function getCounterData(env: ENV) {
const db = getDB(env);
const kv = env.WOMP_KV;
let currentQuarter = await kv.get<string>("current_quarter");
if (!currentQuarter) {
Expand Down Expand Up @@ -59,7 +58,6 @@ export async function getCounterData(env: ENV) {
export type CounterData = typeof getCounterData extends (env: ENV) => Promise<infer T> ? T : never;

export const GET: APIRoute<CounterData> = async ({locals}) => {
const kv = locals.runtime.env.WOMP_KV;
const womps = await getCounterData(locals.runtime.env);

return new Response(
Expand Down
6 changes: 3 additions & 3 deletions src/pages/api/leaderboard/all.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import type { APIContext, APIRoute } from "astro";
import type { APIRoute } from "astro";
import { desc, sql } from "drizzle-orm";
import { getDB } from "src/db/drizzle";
import { Womps } from "src/db/schema";
import type { ENV } from "src/env";
import { desc, sql } from "drizzle-orm";

// import { getDB } from "src/db/drizzle";

export const prerendered = false;


export async function getLeaderboard(env: ENV) {
const {WOMP_KV: kv, WOMP_DB} = env;
const kv = env.WOMP_KV;
const db = getDB(env);
let wompTotals = await db.select({
updated_by: Womps.updated_by,
Expand Down
8 changes: 4 additions & 4 deletions src/pages/api/leaderboard/quarter.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { APIRoute } from "astro";
import { desc, eq, sql } from "drizzle-orm";
import { getDB } from "src/db/drizzle";
import type { ENV } from "src/env";
import { Womps } from "src/db/schema";
import { desc, eq, sql } from "drizzle-orm";
import type { ENV } from "src/env";



export async function getLeaderboardByQuarter(quarter: string, env: ENV) {
const { WOMP_KV: kv, WOMP_DB } = env;
const { WOMP_KV: kv } = env;
const db = getDB(env);
let wompTotals = await db.select({
updated_by: Womps.updated_by,
Expand All @@ -25,7 +25,7 @@ export async function getLeaderboardByQuarter(quarter: string, env: ENV) {
}

export async function getQuarters(env: ENV) {
const { WOMP_KV: kv, WOMP_DB } = env;
const { WOMP_KV: kv } = env;
const db = getDB(env);
let quartersData = await db.select({
quarter_id: Womps.quarter_id,
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"$lib": ["./src/lib"],
"$lib/*": ["./src/lib/*"]
}
}
},
"exclude": ["node_modules", "dist"]
}

0 comments on commit abeb96d

Please sign in to comment.