Skip to content

Commit

Permalink
Refactor and dedupe schema
Browse files Browse the repository at this point in the history
  • Loading branch information
ruchernchong committed Dec 25, 2024
1 parent 43b798d commit d02cc21
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 72 deletions.
2 changes: 1 addition & 1 deletion packages/api/src/lib/getCarsByFuelType.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import db from "@/config/db";
import { getLatestMonth } from "@/lib/getLatestMonth";
import { cars } from "@/schema";
import type { FuelType } from "@/types";
import getTrailingTwelveMonths from "@/utils/getTrailingTwelveMonths";
import { and, asc, between, desc, eq, ilike, or } from "drizzle-orm";
import { cars } from "../../../schema";

const HYBRID_TYPES = [
"Diesel-Electric",
Expand Down
54 changes: 0 additions & 54 deletions packages/api/src/schema.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/api/src/v1/routes/cars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import redis from "@/config/redis";
import { getLatestMonth } from "@/lib/getLatestMonth";
import { getUniqueMonths } from "@/lib/getUniqueMonths";
import { groupMonthsByYear } from "@/lib/groupMonthsByYear";
import { cars } from "@/schema";
import { CarQuerySchema, MonthsQuerySchema } from "@/schemas";
import type { Make } from "@/types";
import getTrailingTwelveMonths from "@/utils/getTrailingTwelveMonths";
import { zValidator } from "@hono/zod-validator";
import { and, asc, between, desc, eq, ilike } from "drizzle-orm";
import { Hono } from "hono";
import { cars } from "../../../../schema";

const app = new Hono();

Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/v1/routes/coe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import redis from "@/config/redis";
import { getLatestMonth } from "@/lib/getLatestMonth";
import { getUniqueMonths } from "@/lib/getUniqueMonths";
import { groupMonthsByYear } from "@/lib/groupMonthsByYear";
import { coe } from "@/schema";
import { type COE, COEQuerySchema, MonthsQuerySchema } from "@/schemas";
import { zValidator } from "@hono/zod-validator";
import { and, asc, desc, eq, gte, lte } from "drizzle-orm";
import { Hono } from "hono";
import { coe } from "../../../schema";

const app = new Hono();

Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/v1/routes/makes.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { CACHE_TTL } from "@/config";
import db from "@/config/db";
import redis from "@/config/redis";
import { cars } from "@/schema";
import { MakeParamSchema, MakeQuerySchema } from "@/schemas";
import { zValidator } from "@hono/zod-validator";
import { and, asc, desc, eq, ilike } from "drizzle-orm";
import { Hono } from "hono";
import { cars } from "../../../../schema";

const app = new Hono();

Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/v1/routes/months.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { getLatestMonth } from "@/lib/getLatestMonth";
import { cars, coe } from "@/schema";
import { LatestMonthQuerySchema } from "@/schemas";
import { zValidator } from "@hono/zod-validator";
import { Hono } from "hono";
import { cars, coe } from "../../../../schema";

const app = new Hono();

Expand Down
27 changes: 14 additions & 13 deletions packages/schema/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"name": "@sgcarstrends/schema",
"version": "1.0.0-beta.1",
"description": "",
"private": true,
"dependencies": {
"dotenv": "^16.4.7",
"drizzle-orm": "^0.38.2"
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
"@types/node": "^22.10.2",
"drizzle-kit": "^0.30.1"
}
"name": "@sgcarstrends/schema",
"version": "1.0.0-beta.1",
"description": "",
"main": "src/schema.ts",
"private": true,
"dependencies": {
"dotenv": "^16.4.7",
"drizzle-orm": "^0.38.2"
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
"@types/node": "^22.10.2",
"drizzle-kit": "^0.30.1"
}
}

0 comments on commit d02cc21

Please sign in to comment.