forked from bai/curriculum-project-hub
feat: redesign Feishu project console
This commit is contained in:
@@ -55,19 +55,33 @@ export async function seedTestOrganization(
|
||||
id: string = DEFAULT_ORG_ID,
|
||||
slug: string = "test-default",
|
||||
): Promise<void> {
|
||||
await prisma.organization.upsert({
|
||||
where: { id },
|
||||
update: {},
|
||||
create: {
|
||||
id,
|
||||
slug,
|
||||
name: "Test Default Organization",
|
||||
},
|
||||
});
|
||||
await prisma.organizationProjectSettings.upsert({
|
||||
where: { organizationId: id },
|
||||
update: {},
|
||||
create: { organizationId: id, membersCanCreateProjects: true },
|
||||
await prisma.$transaction(async (tx) => {
|
||||
await tx.organization.upsert({
|
||||
where: { id },
|
||||
update: {},
|
||||
create: { id, slug, name: "Test Default Organization" },
|
||||
});
|
||||
await tx.organizationProjectSettings.upsert({
|
||||
where: { organizationId: id },
|
||||
update: {},
|
||||
create: { organizationId: id, membersCanCreateProjects: true },
|
||||
});
|
||||
const defaultRole = await tx.organizationAgentRole.upsert({
|
||||
where: { organizationId_roleId: { organizationId: id, roleId: "draft" } },
|
||||
update: { label: "草稿", isDefault: true, disabledAt: null },
|
||||
create: {
|
||||
id: `agent_role_draft_${id}`,
|
||||
organizationId: id,
|
||||
roleId: "draft",
|
||||
label: "草稿",
|
||||
sortOrder: 10,
|
||||
isDefault: true,
|
||||
},
|
||||
});
|
||||
await tx.organizationAgentRole.updateMany({
|
||||
where: { organizationId: id, id: { not: defaultRole.id }, isDefault: true },
|
||||
data: { isDefault: false },
|
||||
});
|
||||
});
|
||||
const inbox = await prisma.folder.findFirst({
|
||||
where: { organizationId: id, kind: "SYSTEM_INBOX", archivedAt: null },
|
||||
@@ -400,6 +414,12 @@ export async function seedProject(
|
||||
},
|
||||
});
|
||||
await prisma.projectGroupBinding.create({
|
||||
data: { projectId, chatId, createdByUserId: "u_" + projectId },
|
||||
data: {
|
||||
organizationId: DEFAULT_ORG_ID,
|
||||
projectId,
|
||||
chatId,
|
||||
createdByUserId: "u_" + projectId,
|
||||
selectedAgentRoleId: `agent_role_draft_${DEFAULT_ORG_ID}`,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user