fix: change casing for apiKey schema
This commit is contained in:
@@ -2,7 +2,7 @@ import { desc, eq } from "drizzle-orm";
|
|||||||
import { v4 as uuidv4 } from "uuid";
|
import { v4 as uuidv4 } from "uuid";
|
||||||
|
|
||||||
import type { dbClient } from "@kan/db/client";
|
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) => {
|
export const getById = async (db: dbClient, userId: string) => {
|
||||||
return await db.query.users.findFirst({
|
return await db.query.users.findFirst({
|
||||||
@@ -20,7 +20,7 @@ export const getById = async (db: dbClient, userId: string) => {
|
|||||||
prefix: true,
|
prefix: true,
|
||||||
key: true,
|
key: true,
|
||||||
},
|
},
|
||||||
orderBy: desc(apiKey.createdAt),
|
orderBy: desc(apikey.createdAt),
|
||||||
limit: 1,
|
limit: 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ export const verification = pgTable("verification", {
|
|||||||
updatedAt: timestamp("updatedAt"),
|
updatedAt: timestamp("updatedAt"),
|
||||||
}).enableRLS();
|
}).enableRLS();
|
||||||
|
|
||||||
export const apiKey = pgTable("apiKey", {
|
export const apikey = pgTable("apiKey", {
|
||||||
id: bigserial("id", { mode: "number" }).primaryKey(),
|
id: bigserial("id", { mode: "number" }).primaryKey(),
|
||||||
name: text("name"),
|
name: text("name"),
|
||||||
start: text("start"),
|
start: text("start"),
|
||||||
@@ -77,9 +77,9 @@ export const apiKey = pgTable("apiKey", {
|
|||||||
metadata: text("metadata"),
|
metadata: text("metadata"),
|
||||||
}).enableRLS();
|
}).enableRLS();
|
||||||
|
|
||||||
export const apiKeyRelations = relations(apiKey, ({ one }) => ({
|
export const apiKeyRelations = relations(apikey, ({ one }) => ({
|
||||||
user: one(users, {
|
user: one(users, {
|
||||||
fields: [apiKey.userId],
|
fields: [apikey.userId],
|
||||||
references: [users.id],
|
references: [users.id],
|
||||||
}),
|
}),
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -8,5 +8,3 @@ export * from "./labels";
|
|||||||
export * from "./lists";
|
export * from "./lists";
|
||||||
export * from "./users";
|
export * from "./users";
|
||||||
export * from "./workspaces";
|
export * from "./workspaces";
|
||||||
|
|
||||||
export { apiKey as apikey } from "./auth";
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
varchar,
|
varchar,
|
||||||
} from "drizzle-orm/pg-core";
|
} from "drizzle-orm/pg-core";
|
||||||
|
|
||||||
import { apiKey } from "./auth";
|
import { apikey } from "./auth";
|
||||||
import { boards } from "./boards";
|
import { boards } from "./boards";
|
||||||
import { cards } from "./cards";
|
import { cards } from "./cards";
|
||||||
import { imports } from "./imports";
|
import { imports } from "./imports";
|
||||||
@@ -34,7 +34,7 @@ export const usersRelations = relations(users, ({ many }) => ({
|
|||||||
imports: many(imports),
|
imports: many(imports),
|
||||||
lists: many(lists),
|
lists: many(lists),
|
||||||
workspaces: many(workspaces),
|
workspaces: many(workspaces),
|
||||||
apiKeys: many(apiKey),
|
apiKeys: many(apikey),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export const usersToWorkspacesRelations = relations(
|
export const usersToWorkspacesRelations = relations(
|
||||||
|
|||||||
Reference in New Issue
Block a user