upd
This commit is contained in:
@@ -13,6 +13,7 @@ import { serversTable } from "./servers";
|
||||
import { clientsTable } from "./clients";
|
||||
import { appsTable } from "./apps";
|
||||
import { sql } from "drizzle-orm";
|
||||
import { commentsTable } from "./comments";
|
||||
|
||||
export const sessionsTable = pgTable(
|
||||
"sessions",
|
||||
@@ -54,7 +55,7 @@ export const sessionsTable = pgTable(
|
||||
})
|
||||
);
|
||||
|
||||
export const sessionsRelations = relations(sessionsTable, ({ one }) => ({
|
||||
export const sessionsRelations = relations(sessionsTable, ({ one, many }) => ({
|
||||
owner: one(usersTable, {
|
||||
fields: [sessionsTable.ownerId],
|
||||
references: [usersTable.id],
|
||||
@@ -75,4 +76,5 @@ export const sessionsRelations = relations(sessionsTable, ({ one }) => ({
|
||||
fields: [sessionsTable.appId],
|
||||
references: [appsTable.id],
|
||||
}),
|
||||
comments: many(commentsTable),
|
||||
}));
|
||||
|
||||
@@ -2,6 +2,7 @@ import { relations } from "drizzle-orm";
|
||||
import { pgTable, text, timestamp, uuid, varchar } from "drizzle-orm/pg-core";
|
||||
import { tokensTable } from "./tokens";
|
||||
import { companiesTable } from "./companies";
|
||||
import { commentsTable } from "./comments";
|
||||
|
||||
export const usersTable = pgTable("users", {
|
||||
id: uuid("id").defaultRandom().primaryKey(),
|
||||
@@ -27,4 +28,5 @@ export const usersRelations = relations(usersTable, ({ one, many }) => ({
|
||||
references: [companiesTable.id],
|
||||
}),
|
||||
tokens: many(tokensTable),
|
||||
comments: many(commentsTable),
|
||||
}));
|
||||
|
||||
@@ -22,6 +22,15 @@ async function getSessions(
|
||||
client: true,
|
||||
app: true,
|
||||
server: true,
|
||||
comments: {
|
||||
with: {
|
||||
owner: {
|
||||
columns: {
|
||||
fullname: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
owner: {
|
||||
columns: {
|
||||
password: false,
|
||||
|
||||
Reference in New Issue
Block a user