fix: merge conflicts

This commit is contained in:
Ephraim Atta-Duncan
2024-09-21 09:07:16 +00:00
449 changed files with 28724 additions and 4841 deletions

View File

@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Document" ADD COLUMN "visibility" TEXT;

View File

@ -0,0 +1,5 @@
-- CreateEnum
CREATE TYPE "DocumentSigningOrder" AS ENUM ('PARALLEL', 'SEQUENTIAL');
-- AlterTable
ALTER TABLE "DocumentMeta" ADD COLUMN "signingOrder" "DocumentSigningOrder" NOT NULL DEFAULT 'PARALLEL';

View File

@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Recipient" ADD COLUMN "signingOrder" INTEGER;

View File

@ -0,0 +1,12 @@
/*
Warnings:
- The `visibility` column on the `Document` table would be dropped and recreated. This will lead to data loss if there is data in the column.
*/
-- CreateEnum
CREATE TYPE "DocumentVisibility" AS ENUM ('EVERYONE', 'MANAGER_AND_ABOVE', 'ADMIN');
-- AlterTable
ALTER TABLE "Document" DROP COLUMN "visibility",
ADD COLUMN "visibility" "DocumentVisibility" NOT NULL DEFAULT 'EVERYONE';

View File

@ -0,0 +1,8 @@
-- AlterTable
ALTER TABLE "TeamEmailVerification" ADD COLUMN "completed" BOOLEAN NOT NULL DEFAULT false;
-- AlterTable
ALTER TABLE "TeamTransferVerification" ADD COLUMN "completed" BOOLEAN NOT NULL DEFAULT false;
-- AlterTable
ALTER TABLE "VerificationToken" ADD COLUMN "completed" BOOLEAN NOT NULL DEFAULT false;

View File

@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "TemplateMeta" ADD COLUMN "signingOrder" "DocumentSigningOrder" DEFAULT 'PARALLEL';

View File

@ -149,6 +149,7 @@ model VerificationToken {
secondaryId String @unique @default(cuid())
identifier String
token String @unique
completed Boolean @default(false)
expires DateTime
createdAt DateTime @default(now())
userId Int
@ -281,6 +282,12 @@ enum DocumentSource {
TEMPLATE_DIRECT_LINK
}
enum DocumentVisibility {
EVERYONE
MANAGER_AND_ABOVE
ADMIN
}
model Document {
id Int @id @default(autoincrement())
externalId String?
@ -288,6 +295,7 @@ model Document {
User User @relation(fields: [userId], references: [id], onDelete: Cascade)
authOptions Json?
formValues Json?
visibility DocumentVisibility @default(EVERYONE)
title String
status DocumentStatus @default(DRAFT)
Recipient Recipient[]
@ -336,6 +344,11 @@ enum DocumentDataType {
BYTES_64
}
enum DocumentSigningOrder {
PARALLEL
SEQUENTIAL
}
model DocumentData {
id String @id @default(cuid())
type DocumentDataType
@ -346,15 +359,16 @@ model DocumentData {
}
model DocumentMeta {
id String @id @default(cuid())
subject String?
message String?
timezone String? @default("Etc/UTC") @db.Text
password String?
dateFormat String? @default("yyyy-MM-dd hh:mm a") @db.Text
documentId Int @unique
document Document @relation(fields: [documentId], references: [id], onDelete: Cascade)
redirectUrl String?
id String @id @default(cuid())
subject String?
message String?
timezone String? @default("Etc/UTC") @db.Text
password String?
dateFormat String? @default("yyyy-MM-dd hh:mm a") @db.Text
documentId Int @unique
document Document @relation(fields: [documentId], references: [id], onDelete: Cascade)
redirectUrl String?
signingOrder DocumentSigningOrder @default(PARALLEL)
}
enum ReadStatus {
@ -390,6 +404,7 @@ model Recipient {
expired DateTime?
signedAt DateTime?
authOptions Json?
signingOrder Int?
role RecipientRole @default(SIGNER)
readStatus ReadStatus @default(NOT_OPENED)
signingStatus SigningStatus @default(NOT_SIGNED)
@ -546,6 +561,7 @@ model TeamEmailVerification {
name String
email String
token String @unique
completed Boolean @default(false)
expiresAt DateTime
createdAt DateTime @default(now())
@ -558,6 +574,7 @@ model TeamTransferVerification {
name String
email String
token String @unique
completed Boolean @default(false)
expiresAt DateTime
createdAt DateTime @default(now())
clearPaymentMethods Boolean @default(false)
@ -584,15 +601,16 @@ enum TemplateType {
}
model TemplateMeta {
id String @id @default(cuid())
subject String?
message String?
timezone String? @default("Etc/UTC") @db.Text
password String?
dateFormat String? @default("yyyy-MM-dd hh:mm a") @db.Text
templateId Int @unique
template Template @relation(fields: [templateId], references: [id], onDelete: Cascade)
redirectUrl String?
id String @id @default(cuid())
subject String?
message String?
timezone String? @default("Etc/UTC") @db.Text
password String?
dateFormat String? @default("yyyy-MM-dd hh:mm a") @db.Text
signingOrder DocumentSigningOrder? @default(PARALLEL)
templateId Int @unique
template Template @relation(fields: [templateId], references: [id], onDelete: Cascade)
redirectUrl String?
}
model Template {

View File

@ -102,6 +102,44 @@ export const unseedTeam = async (teamUrl: string) => {
});
};
type SeedTeamMemberOptions = {
teamId: number;
role?: TeamMemberRole;
};
export const seedTeamMember = async ({
teamId,
role = TeamMemberRole.ADMIN,
}: SeedTeamMemberOptions) => {
const user = await seedUser();
await prisma.teamMember.create({
data: {
teamId,
role,
userId: user.id,
},
});
return user;
};
type UnseedTeamMemberOptions = {
teamId: number;
userId: number;
};
export const unseedTeamMember = async ({ teamId, userId }: UnseedTeamMemberOptions) => {
await prisma.teamMember.delete({
where: {
userId_teamId: {
userId,
teamId,
},
},
});
};
export const seedTeamTransfer = async (options: { newOwnerUserId: number; teamId: number }) => {
return await prisma.teamTransferVerification.create({
data: {

View File

@ -4,7 +4,7 @@ import path from 'node:path';
import {
DIRECT_TEMPLATE_RECIPIENT_EMAIL,
DIRECT_TEMPLATE_RECIPIENT_NAME,
} from '@documenso/lib/constants/template';
} from '@documenso/lib/constants/direct-templates';
import { prisma } from '..';
import type { Prisma, User } from '../client';