Skip to content

Commit

Permalink
update post submission
Browse files Browse the repository at this point in the history
  • Loading branch information
thebkht committed Oct 25, 2023
1 parent 8e60a48 commit 8c121dc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
11 changes: 8 additions & 3 deletions app/api/posts/submit/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,16 @@ export async function POST(req: NextRequest) {
data: {
title: title,
content: content,
cover: coverImage || '',
cover: coverImage ? coverImage : null,
visibility: visibility,
url: url,
subtitle: subtitle,
authorId: authorId,
subtitle: subtitle ? subtitle : null,
authorId: Number(authorId),
author: {
connect: {
id: Number(authorId),
}
}
}
})

Expand Down
10 changes: 5 additions & 5 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,16 @@ model User {

model Post {
id Int @id @default(autoincrement())
title String?
title String
//content Text in postgresql
content String? @db.Text
subtitle String @db.VarChar(280)
cover String
content String @db.Text
subtitle String? @db.VarChar(280)
cover String?
views Int @default(0)
author User @relation(fields: [authorId], references: [id])
authorId Int
url String? @unique
url String @unique
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
visibility String @default("public")
Expand Down

0 comments on commit 8c121dc

Please sign in to comment.