Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dickeyy committed Jun 1, 2024
1 parent e9a6d6f commit b26e522
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 15 deletions.
Binary file modified .DS_Store
Binary file not shown.
40 changes: 40 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
node_modules
.next

apps/web/node_modules
apps/web/.next
app/web/next-env.d.ts

.env.*
.env.local

/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
14 changes: 14 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"singleQuote": false,
"printWidth": 100,
"editor.formatOnSave": true,
"proseWrap": "always",
"tabWidth": 4,
"requireConfig": false,
"useTabs": false,
"trailingComma": "none",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"semi": true,
"plugins": ["prettier-plugin-tailwindcss"]
}
Binary file modified apps/.DS_Store
Binary file not shown.
13 changes: 13 additions & 0 deletions apps/api/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"singleQuote": false,
"printWidth": 100,
"editor.formatOnSave": true,
"proseWrap": "always",
"tabWidth": 4,
"requireConfig": false,
"useTabs": false,
"trailingComma": "none",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"semi": true
}
4 changes: 2 additions & 2 deletions apps/api/drizzle.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ export default defineConfig({
schema: "./src/db/schema.ts",
out: "./drizzle",
dbCredentials: {
url: config.db.url,
url: config.db.url
},
verbose: true,
strict: true,
dialect: "postgresql",
dialect: "postgresql"
});
26 changes: 13 additions & 13 deletions apps/api/src/db/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,38 @@ import { relations } from "drizzle-orm";
import { text, pgTable, varchar, bigint } from "drizzle-orm/pg-core";

export const users = pgTable("users", {
id: varchar("id", {length: 36}).primaryKey(),
email: varchar("email", {length: 255}).notNull().unique(),
id: varchar("id", { length: 36 }).primaryKey(),
email: varchar("email", { length: 255 }).notNull(),
image_url: text("image_url"),
username: varchar("username", {length: 255}).unique(),
username: varchar("username", { length: 255 }).unique(),
created_at: bigint("created_at", {
mode: "number"
}).notNull(),
updated_at: bigint("updated_at", {
mode: "number"
}).notNull(),
}).notNull()
});

export const usersRelations = relations(users, ({ many }) => ({
posts: many(documents),
posts: many(documents)
}));

export const documents = pgTable("documents", {
id: varchar("id", {length: 255}).primaryKey(),
owner_id: varchar("owner_id", {length: 255}).notNull(),
id: varchar("id", { length: 255 }).primaryKey(),
owner_id: varchar("owner_id", { length: 255 }).notNull(),
title: text("title"),
content: text("content"),
created_at: bigint("created_at", {
mode: "number"
}).notNull(),
updated_at: bigint("updated_at", {
mode: "number"
}).notNull(),
})
}).notNull()
});

export const documentRelations = relations(documents, ({ one }) => ({
author: one(users, {
fields: [documents.owner_id],
references: [users.id],
}),
author: one(users, {
fields: [documents.owner_id],
references: [users.id]
})
}));

0 comments on commit b26e522

Please sign in to comment.