Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

add updated and created at fields

Marc Seitz20d1fd4c6f7e
diff --git a/pages/api/documents/[id]/links.ts b/pages/api/documents/[id]/links.ts
index 6a634c6e..f0fb99a4 100644
--- a/pages/api/documents/[id]/links.ts
+++ b/pages/api/documents/[id]/links.ts
@@ -21,6 +21,9 @@ export default async function handle(
where: {
documentId: id,
},
+ orderBy: {
+ createdAt: "asc",
+ },
include: {
views: true,
_count: {
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index 95a78b15..e2a2df23 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -64,6 +64,7 @@ model Document {
owner User @relation(fields: [ownerId], references: [id])
ownerId String // This field holds the foreign key.
createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
links Link[]
views View[]
}
@@ -77,6 +78,8 @@ model Link {
password String? // Optional password for link protection
allowedEmails String[] // Array of emails allowed to view the document
views View[]
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
}
model View {