Skip to content

Commit 3c7ff10

Browse files
committed
cors error
1 parent 3270f45 commit 3c7ff10

File tree

2 files changed

+41
-38
lines changed

2 files changed

+41
-38
lines changed

http-backend/src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ import { prismaClient } from './db';
66
const app = express();
77
app.use(express.json())
88
app.use(cors({
9-
origin: '*'
10-
}));
9+
origin: '*',
10+
methods: ['GET', 'POST'],
11+
allowedHeaders: ['Content-Type']
12+
}));
1113

1214
app.get('/', (req, res) => {
1315
res.send('Hello');

http-backend/src/router/project.ts

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -34,44 +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)
7373

74-
res.json({message: 'Success',project})
74+
//res.json({message: 'Success',project})
75+
res.json({message: 'Success'})
7576
})
7677

7778

0 commit comments

Comments
 (0)