-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: DB scheme 작성 및 ORM 생성 * feat: db table 생성 스크립트 작성 * fix: ts-node 실행되도록 수정 * fix: 불필요 nodemon 삭제 및 스크립트 종료 수정
- Loading branch information
Showing
6 changed files
with
397 additions
and
290 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// This adapter exports a wrapper of the original `Kysely` class called `KyselyAuth`, | ||
// that can be used to provide additional type-safety. | ||
// While using it isn't required, it is recommended as it will verify | ||
// that the database interface has all the fields that Auth.js expects. | ||
import { Platform, PostCommentStatus } from "@lib/types/property"; | ||
import { createKysely } from "@vercel/postgres-kysely"; | ||
import type { GeneratedAlways } from "kysely"; | ||
|
||
interface Database { | ||
User: { | ||
id: GeneratedAlways<string>; | ||
name: string | null; | ||
email: string; | ||
emailVerified: Date | null; | ||
image: string | null; | ||
}; | ||
Account: { | ||
id: GeneratedAlways<string>; | ||
userId: string; | ||
type: string; | ||
provider: string; | ||
providerAccountId: string; | ||
refresh_token: string | null; | ||
access_token: string | null; | ||
expires_at: number | null; | ||
token_type: string | null; | ||
scope: string | null; | ||
id_token: string | null; | ||
session_state: string | null; | ||
}; | ||
Post: { | ||
id: GeneratedAlways<string>; | ||
userId: string | null; | ||
platform: Platform; | ||
targetNickname: string; | ||
tags: string[]; | ||
imageUrls: string[]; | ||
content: string; | ||
status: PostCommentStatus; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
anonymousUserNickname: string | null; | ||
etcPlatformName: string | null; | ||
}; | ||
Comment: { | ||
id: GeneratedAlways<string>; | ||
userId: string; | ||
postId: string; | ||
imageUrls: string[]; | ||
content: string; | ||
status: PostCommentStatus; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
}; | ||
} | ||
|
||
export const db = createKysely<Database>(); | ||
export { sql } from "kysely"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export type Platform = "daangn" | "bunjang" | "joongna" | "etc"; | ||
|
||
export type CategoryDirection = "up" | "down" | "left"; | ||
|
||
export type PostCommentStatus = "normal" | "debate" | "deleted"; |
Oops, something went wrong.