Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified bun.lockb
Binary file not shown.
16 changes: 8 additions & 8 deletions src/generated/graphql/schema.executable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const spec_userOrganization = {
}),
description: undefined,
extensions: {
oid: "77872",
oid: "92823",
isTableLike: true,
pg: {
serviceName: "main",
Expand Down Expand Up @@ -200,7 +200,7 @@ const spec_downvote = {
}),
description: undefined,
extensions: {
oid: "78725",
oid: "92888",
isTableLike: true,
pg: {
serviceName: "main",
Expand Down Expand Up @@ -280,7 +280,7 @@ const spec_upvote = {
}),
description: undefined,
extensions: {
oid: "77850",
oid: "92801",
isTableLike: true,
pg: {
serviceName: "main",
Expand Down Expand Up @@ -360,7 +360,7 @@ const spec_organization = {
}),
description: undefined,
extensions: {
oid: "77812",
oid: "92763",
isTableLike: true,
pg: {
serviceName: "main",
Expand Down Expand Up @@ -452,7 +452,7 @@ const spec_comment = {
}),
description: undefined,
extensions: {
oid: "78467",
oid: "92868",
isTableLike: true,
pg: {
serviceName: "main",
Expand Down Expand Up @@ -556,7 +556,7 @@ const spec_post = {
}),
description: undefined,
extensions: {
oid: "77826",
oid: "92777",
isTableLike: true,
pg: {
serviceName: "main",
Expand Down Expand Up @@ -672,7 +672,7 @@ const spec_project = {
}),
description: undefined,
extensions: {
oid: "77836",
oid: "92787",
isTableLike: true,
pg: {
serviceName: "main",
Expand Down Expand Up @@ -776,7 +776,7 @@ const spec_user = {
}),
description: undefined,
extensions: {
oid: "77860",
oid: "92811",
isTableLike: true,
pg: {
serviceName: "main",
Expand Down
15 changes: 0 additions & 15 deletions src/lib/drizzle/schema/comment.table.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { relations } from "drizzle-orm";
import { pgTable, text, uuid } from "drizzle-orm/pg-core";

import { defaultDate, defaultId } from "./constants";
Expand Down Expand Up @@ -27,20 +26,6 @@ export const comments = pgTable("comment", {
updatedAt: defaultDate(),
});

/**
* Relations for the comment table.
*/
export const commentRelations = relations(comments, ({ one }) => ({
post: one(posts, {
fields: [comments.postId],
references: [posts.id],
}),
user: one(users, {
fields: [comments.userId],
references: [users.id],
}),
}));

/**
* Type helpers related to the comment table.
*/
Expand Down
15 changes: 0 additions & 15 deletions src/lib/drizzle/schema/downvote.table.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { relations } from "drizzle-orm";
import { pgTable, unique, uuid } from "drizzle-orm/pg-core";

import { defaultDate, defaultId } from "./constants";
Expand Down Expand Up @@ -30,20 +29,6 @@ export const downvotes = pgTable(
(table) => [unique().on(table.postId, table.userId)]
);

/**
* Relations for the downvote table.
*/
export const downvoteRelations = relations(downvotes, ({ one }) => ({
post: one(posts, {
fields: [downvotes.postId],
references: [posts.id],
}),
user: one(users, {
fields: [downvotes.userId],
references: [users.id],
}),
}));

/**
* Type helpers related to the downvote table.
*/
Expand Down
11 changes: 0 additions & 11 deletions src/lib/drizzle/schema/organization.table.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { relations } from "drizzle-orm";
import { pgTable, text } from "drizzle-orm/pg-core";

import { defaultDate, defaultId } from "./constants";
import { projects } from "./project.table";
import { usersToOrganizations } from "./userToOrganization.table";

import type { InferInsertModel, InferSelectModel } from "drizzle-orm";

Expand All @@ -18,14 +15,6 @@ export const organizations = pgTable("organization", {
updatedAt: defaultDate(),
});

/**
* Relations for the organization table.
*/
export const organizationRelations = relations(organizations, ({ many }) => ({
projects: many(projects),
users: many(usersToOrganizations),
}));

/**
* Type helpers related to the organization table.
*/
Expand Down
21 changes: 0 additions & 21 deletions src/lib/drizzle/schema/post.table.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { relations } from "drizzle-orm";
import { pgTable, text, uuid } from "drizzle-orm/pg-core";

import { comments } from "./comment.table";
import { defaultDate, defaultId } from "./constants";
import { downvotes } from "./downvote.table";
import { projects } from "./project.table";
import { upvotes } from "./upvote.table";
import { users } from "./user.table";

import type { InferInsertModel, InferSelectModel } from "drizzle-orm";
Expand All @@ -31,23 +27,6 @@ export const posts = pgTable("post", {
updatedAt: defaultDate(),
});

/**
* Relations for the post table.
*/
export const postRelations = relations(posts, ({ one, many }) => ({
project: one(projects, {
fields: [posts.projectId],
references: [projects.id],
}),
user: one(users, {
fields: [posts.userId],
references: [users.id],
}),
comments: many(comments),
upvotes: many(upvotes),
downvotes: many(downvotes),
}));

/**
* Type helpers related to the post table.
*/
Expand Down
13 changes: 0 additions & 13 deletions src/lib/drizzle/schema/project.table.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { relations } from "drizzle-orm";
import { pgTable, text, unique, uuid } from "drizzle-orm/pg-core";

import { defaultDate, defaultId } from "./constants";
import { organizations } from "./organization.table";
import { posts } from "./post.table";

import type { InferInsertModel, InferSelectModel } from "drizzle-orm";

Expand All @@ -29,17 +27,6 @@ export const projects = pgTable(
(table) => [unique().on(table.slug, table.organizationId)]
);

/**
* Relations for the project table.
*/
export const projectRelations = relations(projects, ({ one, many }) => ({
organization: one(organizations, {
fields: [projects.organizationId],
references: [organizations.id],
}),
posts: many(posts),
}));

/**
* Type helpers related to the project table.
*/
Expand Down
15 changes: 0 additions & 15 deletions src/lib/drizzle/schema/upvote.table.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { relations } from "drizzle-orm";
import { pgTable, unique, uuid } from "drizzle-orm/pg-core";

import { defaultDate, defaultId } from "./constants";
Expand Down Expand Up @@ -30,20 +29,6 @@ export const upvotes = pgTable(
(table) => [unique().on(table.postId, table.userId)]
);

/**
* Relations for the upvote table.
*/
export const upvoteRelations = relations(upvotes, ({ one }) => ({
post: one(posts, {
fields: [upvotes.postId],
references: [posts.id],
}),
user: one(users, {
fields: [upvotes.userId],
references: [users.id],
}),
}));

/**
* Type helpers related to the upvote table.
*/
Expand Down
17 changes: 0 additions & 17 deletions src/lib/drizzle/schema/user.table.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import { relations } from "drizzle-orm";
import { pgTable, text, uuid } from "drizzle-orm/pg-core";

import { comments } from "./comment.table";
import { defaultDate, defaultId } from "./constants";
import { downvotes } from "./downvote.table";
import { posts } from "./post.table";
import { upvotes } from "./upvote.table";
import { usersToOrganizations } from "./userToOrganization.table";

import type { InferInsertModel, InferSelectModel } from "drizzle-orm";

Expand All @@ -24,17 +18,6 @@ export const users = pgTable("user", {
updatedAt: defaultDate(),
});

/**
* Relations for the user table.
*/
export const userRelations = relations(users, ({ many }) => ({
organizations: many(usersToOrganizations),
posts: many(posts),
comments: many(comments),
upvotes: many(upvotes),
downvotes: many(downvotes),
}));

/**
* Type helpers related to the user table.
*/
Expand Down
24 changes: 2 additions & 22 deletions src/lib/drizzle/schema/userToOrganization.table.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import {
type InferInsertModel,
type InferSelectModel,
relations,
} from "drizzle-orm";
import { pgTable, unique, uuid } from "drizzle-orm/pg-core";

import { defaultDate } from "./constants";
import { organizations } from "./organization.table";
import { users } from "./user.table";

import type { InferInsertModel, InferSelectModel } from "drizzle-orm";

/**
* Users to organizations join table.
*/
Expand All @@ -30,23 +27,6 @@ export const usersToOrganizations = pgTable(
(table) => [unique().on(table.userId, table.organizationId)]
);

/**
* Relations for the users to organizations join table.
*/
export const usersToOrganizationsRelations = relations(
usersToOrganizations,
({ one }) => ({
user: one(users, {
fields: [usersToOrganizations.userId],
references: [users.id],
}),
organization: one(organizations, {
fields: [usersToOrganizations.organizationId],
references: [organizations.id],
}),
})
);

/**
* Type helpers related to the users to organizations join table.
*/
Expand Down