Scaffold web app

This commit was merged in pull request #1.
This commit is contained in:
tedspare
2025-11-18 16:05:05 -05:00
parent 15dce46be2
commit 51a8916a4c
40 changed files with 808 additions and 1 deletions

72
prisma/auth.prisma Normal file
View File

@@ -0,0 +1,72 @@
model User {
id String @id @default(nanoid(6))
email String @unique
oAuth2AuthenticationAccounts OAuth2AuthenticationAccount[]
oAuth2AuthorizationAccounts OAuth2AuthorizationAccount[]
apiKeyAuthorizationAccounts ApiKeyAuthorizationAccount[]
sessions Session[]
tasks Task[]
}
model OAuth2AuthenticationRequest {
token String @id
callbackUrl String
expiresAt DateTime
}
model OAuth2AuthorizationRequest {
token String @id
userId String
callbackUrl String
expiresAt DateTime
}
model MagicLinkRequest {
token String @id
email String
expiresAt DateTime
}
model OAuth2AuthenticationAccount {
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
provider String
accountId String
accessToken String
refreshToken String
expiresAt DateTime
@@id([userId, provider, accountId])
}
model OAuth2AuthorizationAccount {
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
provider String
accountId String
accessToken String
refreshToken String
expiresAt DateTime
@@id([userId, provider, accountId])
}
model ApiKeyAuthorizationAccount {
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
provider String
accountId String
apiKey String
@@id([userId, provider, accountId])
}
model Session {
key String @id @default(cuid())
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
expiresAt DateTime
}

18
prisma/schema.prisma Normal file
View File

@@ -0,0 +1,18 @@
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model Task {
id Int @id @default(autoincrement())
title String
createdAt DateTime @default(now())
status Boolean @default(false)
user User? @relation(fields: [userId], references: [id])
userId String?
}

14
prisma/seed.ts Normal file
View File

@@ -0,0 +1,14 @@
#!/usr/bin/env bun
import db from '~/db'
async function seed() {
await db.task.create({
data: {
status: false,
title: 'Create your first task'
}
})
}
seed()