mirror of
https://github.com/hanzoai/captable.git
synced 2026-10-16 14:21:29 +00:00
* feat: some changes on share flow * feat: render contact and recipient's avatars * chore: update badge color * feat: update Share to ShareModal * feat: use common router * feat: create data room recipients records * feat: reload page on success * fix: modal input ring * feat: getting started with async dataroom email job * feat: getting started with document share page layout * feat: render DataRoomFileExplorer on shared dataroom * feat: shorten url with (document) * feat: rendering dataroom preview page (layout) as well * feat: rename folder structure * feat: cleaning up env variables * feat: remove access to dataroom * feat: cleaning up share/access modal * feat: send a link shared data room with jwt token * feat: return a share link that can be copied on share modal * feat: secure shared dataroom page * feat: securing dataroom file preview page as well * chore: export/import ExtendedRecipientType
98 lines
2.3 KiB
TypeScript
98 lines
2.3 KiB
TypeScript
import type { MemberStatusEnum } from "@/prisma/enums";
|
|
import { db } from "@/server/db";
|
|
import { faker } from "@faker-js/faker";
|
|
import bcrypt from "bcryptjs";
|
|
import colors from "colors";
|
|
colors.enable();
|
|
|
|
type UserType = {
|
|
name: string;
|
|
email: string;
|
|
title?: string;
|
|
image?: string;
|
|
isOnboarded?: boolean;
|
|
status?: MemberStatusEnum;
|
|
};
|
|
|
|
const seedTeam = async () => {
|
|
const team = [
|
|
{
|
|
name: faker.person.fullName(),
|
|
email: "[email protected]",
|
|
// image: faker.image.avatar(),
|
|
title: "Co-Founder & CEO",
|
|
status: "ACTIVE",
|
|
isOnboarded: true,
|
|
},
|
|
|
|
{
|
|
name: faker.person.fullName(),
|
|
email: "[email protected]",
|
|
// image: faker.image.avatar(),
|
|
title: "Co-Founder & CTO",
|
|
status: "ACTIVE",
|
|
isOnboarded: true,
|
|
},
|
|
|
|
{
|
|
name: faker.person.fullName(),
|
|
email: "[email protected]",
|
|
// image: faker.image.avatar(),
|
|
title: "CFO",
|
|
status: "PENDING",
|
|
isOnboarded: false,
|
|
},
|
|
|
|
{
|
|
name: faker.person.fullName(),
|
|
email: "[email protected]",
|
|
// image: faker.image.avatar(),
|
|
title: "Lawyer at Law Firm LLP",
|
|
status: "PENDING",
|
|
},
|
|
{
|
|
name: faker.person.fullName(),
|
|
email: "[email protected]",
|
|
// image: faker.image.avatar(),
|
|
title: "Accountant at XYZ Accounting, Inc.",
|
|
status: "INACTIVE",
|
|
},
|
|
];
|
|
|
|
console.log(`Seeding ${team.length} team members`.blue);
|
|
const companies = await db.company.findMany();
|
|
|
|
team.forEach(async (t) => {
|
|
// const { name, email, image, title, status, isOnboarded } = t
|
|
const salt = await bcrypt.genSalt(10);
|
|
const hashedPassword = await bcrypt.hash("P@ssw0rd!", salt);
|
|
const { name, email, title, status, isOnboarded } = t;
|
|
const user = await db.user.create({
|
|
data: {
|
|
name,
|
|
email,
|
|
password: hashedPassword,
|
|
emailVerified: new Date(),
|
|
// image,
|
|
},
|
|
});
|
|
|
|
companies.forEach(async (company) => {
|
|
await db.member.create({
|
|
data: {
|
|
title,
|
|
isOnboarded,
|
|
status: status as MemberStatusEnum,
|
|
userId: user.id,
|
|
companyId: company.id,
|
|
},
|
|
});
|
|
});
|
|
});
|
|
|
|
console.log(`🎉 Seeded ${team.length} team members`.green);
|
|
return team;
|
|
};
|
|
|
|
export default seedTeam;
|