feat: seperate text for email when document is being sent from team

This commit is contained in:
Ephraim Atta-Duncan
2024-07-12 17:32:57 +00:00
committed by Mythie
parent 7a1341eb74
commit 7562a68cca
4 changed files with 97 additions and 3 deletions

View File

@ -4,7 +4,7 @@ import path from 'node:path';
import { hashSync } from '@documenso/lib/server-only/auth/hash';
import { prisma } from '..';
import { DocumentDataType, DocumentSource, Role } from '../client';
import { DocumentDataType, DocumentSource, Role, TeamMemberRole } from '../client';
export const seedDatabase = async () => {
const examplePdf = fs
@ -67,4 +67,64 @@ export const seedDatabase = async () => {
},
},
});
const testUsers = [
'test@documenso.com',
'test2@documenso.com',
'test3@documenso.com',
'test4@documenso.com',
];
const createdUsers = [];
for (const email of testUsers) {
const testUser = await prisma.user.upsert({
where: {
email: email,
},
create: {
name: 'Test User',
email: email,
emailVerified: new Date(),
password: hashSync('password'),
roles: [Role.USER],
},
update: {},
});
createdUsers.push(testUser);
}
const team1 = await prisma.team.create({
data: {
name: 'Team 1',
url: 'team1',
ownerUserId: createdUsers[0].id,
},
});
const team2 = await prisma.team.create({
data: {
name: 'Team 2',
url: 'team2',
ownerUserId: createdUsers[1].id,
},
});
for (const team of [team1, team2]) {
await prisma.teamMember.createMany({
data: [
{
teamId: team.id,
userId: createdUsers[1].id,
role: TeamMemberRole.MEMBER,
},
{
teamId: team.id,
userId: createdUsers[2].id,
role: TeamMemberRole.MEMBER,
},
],
});
}
};