Skip to content

Commit 2c5c36a

Browse files
committed
check passed
1 parent 9af3302 commit 2c5c36a

File tree

1 file changed

+37
-37
lines changed

1 file changed

+37
-37
lines changed

http-backend/src/router/project.ts

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -34,45 +34,45 @@ router.post("/create", async (req,res): Promise<any> => {
3434
return res.status(401).json({ error: "Unauthorized" });
3535
}
3636

37-
// const isproject = await prismaClient.project.findUnique({
38-
// where:{
39-
// name: zreq.data?.name
40-
// }
41-
// })
42-
43-
// if(isproject){
44-
// return res.status(401).json({ error: "Project already Exist" });
45-
// }
46-
47-
// const project = await prismaClient.project.create({
48-
// data:{
49-
// name: zreq.data?.name || "",
50-
// githubUrl: zreq.data?.githubUrl || "",
51-
// userToProject: {
52-
// create:{
53-
// userId: user?.id
54-
// }
55-
// }
56-
// }
57-
// })
58-
59-
// const memory = await createMemory(`${project.id}_${zreq.data?.name}` || "")
60-
// const pipe = await createPipe(`${project.id}_${zreq.data?.name}` || "", memory.name || "")
61-
// const questionagent = await prismaClient.questionAgent.create({
62-
// data:{
63-
// memoryName: memory.name,
64-
// pipename: pipe.name,
65-
// pipeDescription: pipe.description,
66-
// projectId: project.id
67-
// }
68-
// })
37+
const isproject = await prismaClient.project.findUnique({
38+
where:{
39+
name: zreq.data?.name
40+
}
41+
})
42+
43+
if(isproject){
44+
return res.status(401).json({ error: "Project already Exist" });
45+
}
46+
47+
const project = await prismaClient.project.create({
48+
data:{
49+
name: zreq.data?.name || "",
50+
githubUrl: zreq.data?.githubUrl || "",
51+
userToProject: {
52+
create:{
53+
userId: user?.id
54+
}
55+
}
56+
}
57+
})
58+
59+
const memory = await createMemory(`${project.id}_${zreq.data?.name}` || "")
60+
const pipe = await createPipe(`${project.id}_${zreq.data?.name}` || "", memory.name || "")
61+
const questionagent = await prismaClient.questionAgent.create({
62+
data:{
63+
memoryName: memory.name,
64+
pipename: pipe.name,
65+
pipeDescription: pipe.description,
66+
projectId: project.id
67+
}
68+
})
6969

70-
// await indexGithubRepo(project.id,zreq.data?.githubUrl || '', questionagent.memoryName || "", zreq.data?.githubToken || '')
71-
// await pollCommits(project.id)
72-
// await pollPullRequests(project.id)
70+
await indexGithubRepo(project.id,zreq.data?.githubUrl || '', questionagent.memoryName || "", zreq.data?.githubToken || '')
71+
await pollCommits(project.id)
72+
await pollPullRequests(project.id)
73+
74+
res.json({message: 'Success',project})
7375

74-
//res.json({message: 'Success',project})
75-
res.json({message: 'Success'})
7676
})
7777

7878

0 commit comments

Comments
 (0)