From ee5cbd1e7f81b81ac9f4e734f47df935cde3bef8 Mon Sep 17 00:00:00 2001 From: Henry Date: Sun, 1 Jun 2025 23:07:21 +0100 Subject: [PATCH] fix: change casing for apiKey schema --- packages/db/src/repository/user.repo.ts | 4 ++-- packages/db/src/schema/auth.ts | 6 +++--- packages/db/src/schema/index.ts | 2 -- packages/db/src/schema/users.ts | 4 ++-- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/db/src/repository/user.repo.ts b/packages/db/src/repository/user.repo.ts index df104cd6..193b82d2 100644 --- a/packages/db/src/repository/user.repo.ts +++ b/packages/db/src/repository/user.repo.ts @@ -2,7 +2,7 @@ import { desc, eq } from "drizzle-orm"; import { v4 as uuidv4 } from "uuid"; import type { dbClient } from "@kan/db/client"; -import { apiKey, users } from "@kan/db/schema"; +import { apikey, users } from "@kan/db/schema"; export const getById = async (db: dbClient, userId: string) => { return await db.query.users.findFirst({ @@ -20,7 +20,7 @@ export const getById = async (db: dbClient, userId: string) => { prefix: true, key: true, }, - orderBy: desc(apiKey.createdAt), + orderBy: desc(apikey.createdAt), limit: 1, }, }, diff --git a/packages/db/src/schema/auth.ts b/packages/db/src/schema/auth.ts index fe0786cb..dae110ba 100644 --- a/packages/db/src/schema/auth.ts +++ b/packages/db/src/schema/auth.ts @@ -51,7 +51,7 @@ export const verification = pgTable("verification", { updatedAt: timestamp("updatedAt"), }).enableRLS(); -export const apiKey = pgTable("apiKey", { +export const apikey = pgTable("apiKey", { id: bigserial("id", { mode: "number" }).primaryKey(), name: text("name"), start: text("start"), @@ -77,9 +77,9 @@ export const apiKey = pgTable("apiKey", { metadata: text("metadata"), }).enableRLS(); -export const apiKeyRelations = relations(apiKey, ({ one }) => ({ +export const apiKeyRelations = relations(apikey, ({ one }) => ({ user: one(users, { - fields: [apiKey.userId], + fields: [apikey.userId], references: [users.id], }), })); diff --git a/packages/db/src/schema/index.ts b/packages/db/src/schema/index.ts index 5568a3d3..b94e20c1 100644 --- a/packages/db/src/schema/index.ts +++ b/packages/db/src/schema/index.ts @@ -8,5 +8,3 @@ export * from "./labels"; export * from "./lists"; export * from "./users"; export * from "./workspaces"; - -export { apiKey as apikey } from "./auth"; diff --git a/packages/db/src/schema/users.ts b/packages/db/src/schema/users.ts index 00e91d88..8dbed536 100644 --- a/packages/db/src/schema/users.ts +++ b/packages/db/src/schema/users.ts @@ -7,7 +7,7 @@ import { varchar, } from "drizzle-orm/pg-core"; -import { apiKey } from "./auth"; +import { apikey } from "./auth"; import { boards } from "./boards"; import { cards } from "./cards"; import { imports } from "./imports"; @@ -34,7 +34,7 @@ export const usersRelations = relations(users, ({ many }) => ({ imports: many(imports), lists: many(lists), workspaces: many(workspaces), - apiKeys: many(apiKey), + apiKeys: many(apikey), })); export const usersToWorkspacesRelations = relations(