fix: typescript support fix, add some params to editor, etc

This commit is contained in:
2024-02-28 22:32:31 +00:00
parent 7bdd995394
commit 543260479a
16 changed files with 136 additions and 34 deletions
+16
View File
@@ -116,6 +116,17 @@ const projectRouter = router({
const projectId = projectData.id;
if (input.forkFromId) {
const forkProject = await tx.query.project.findFirst({
where: and(
eq(project.id, input.forkFromId),
isNull(project.deletedAt)
),
});
if (!forkProject) {
throw new Error("Fork Project not found!");
}
const forkFiles = await tx.query.file.findMany({
where: and(
eq(file.projectId, input.forkFromId),
@@ -132,6 +143,11 @@ const projectRouter = router({
await tx
.insert(file)
.values(forkFiles.map((file) => ({ ...file, projectId })));
await tx
.update(project)
.set({ settings: forkProject.settings })
.where(eq(project.id, projectData.id));
} else {
await tx.insert(file).values([
{