-
Notifications
You must be signed in to change notification settings - Fork 0
chore: update package dependencies and fix schema relations #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -9,6 +9,7 @@ import { | |||||||||||||||||||||||||||||||||||||||||||||||||||
| AvailableNodes, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| TriggerSchema, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| WorkflowSchema, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| NodeSchema, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } from "@repo/common/zod"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { GoogleSheetsNodeExecutor } from "@repo/nodes"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| const router: Router = Router(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -34,16 +35,18 @@ const router: Router = Router(); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| // } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| // }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| router.post("/createNode", async (req: AuthRequest, res: Response) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| // ------------------- AVALIABLE TRIGGERS AND NODES CREATION AND FETCHING ROUTES -------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| router.post("/createAvaliableNode", async (req: AuthRequest, res: Response) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| const Data = req.body; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.log("Thi is the Data from Normal Data", Data); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| // console.log("Thi is the Data from Normal Data", Data); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| const parseData = AvailableNodes.safeParse(Data); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.log("This is the ParsedData", parseData.data); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| // console.log("This is the ParsedData", parseData.data); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| // if(!parseData) return | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!parseData.success) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| return res.status(statusCodes.BAD_REQUEST).json({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| message: "Invalid Inpput in node creating", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| message: "Invalid Input in node creating", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| const createNode = await prismaClient.availableNode.create({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -58,7 +61,7 @@ router.post("/createNode", async (req: AuthRequest, res: Response) => { | |||||||||||||||||||||||||||||||||||||||||||||||||||
| Data: createNode, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } catch (e) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.log("This is the error from Node creatig", e); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.log("This is the error from Node creating", e); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| return res.status(statusCodes.INTERNAL_SERVER_ERROR).json({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| message: "Internal server Error from Node creation", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -90,7 +93,7 @@ router.get("/getAvailableNodes", | |||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| router.post("/createTriggers", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| router.post("/createAvaliableTriggers", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| userMiddleware, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| async (req: AuthRequest, res: Response) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -148,6 +151,8 @@ router.get("/getAvailableTriggers", | |||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| //------------------------------ GET CREDENTIALS ----------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| router.get('/getCredentials/:type', | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| userMiddleware, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| async (req: AuthRequest, res) =>{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -195,6 +200,7 @@ router.get('/getCredentials/:type', | |||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| // ----------------------------------- CREATE WORKFLOW --------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| router.post("/create/workflow", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| userMiddleware, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -219,57 +225,18 @@ router.post("/create/workflow", | |||||||||||||||||||||||||||||||||||||||||||||||||||
| // Example JSON body to test this route: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| /* | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "Name": "My Workflow Trigger", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "AvailableTriggerId": "trigger123", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "Config": { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "key1": "value1", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "key2": 42, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "key3": true | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "AvailableNodes": [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "name": "First Node", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "config": { "foo": "bar" }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "type": "TypeA", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "id": "nodeA1" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "name": "Second Node", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "config": { "baz": 123 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "type": "TypeB", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "nodeId": "nodeB2" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "name": "Third Node", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "config": { "example": false }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "type": "TypeC", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "AvailabeNodeID": "nodeC3" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "Name":"workflow-1", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "UserId": "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "Config":[{}] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| data: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| user: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| connect: { id: UserID }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| description: "First Workflow", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| description: "Workflow-generated", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: ParsedData.data.Name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| config: ParsedData.data.Config, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Trigger: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| create: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: ParsedData.data.Name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| AvailableTriggerID: ParsedData.data.AvailableTriggerId, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| config: ParsedData.data.Config, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| nodes: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| create: ParsedData.data.AvailableNodes.map((x, index) => ({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: x.Name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| AvailabeNodeID: x.AvailableNodeId, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| config: x.Config, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| position: index, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| })), | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| return res.status(statusCodes.CREATED).json({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -285,6 +252,8 @@ router.post("/create/workflow", | |||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| // ------------------------------------ FETCHING WORKFLOWS ----------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| router.get("/workflows", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| userMiddleware, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| async (req: AuthRequest, res: Response) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -313,6 +282,34 @@ router.get("/workflows", | |||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| router.get('/empty/workflow', userMiddleware, async(req:AuthRequest, res: Response)=>{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| try{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!req.user) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| return res | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| .status(statusCodes.UNAUTHORIZED) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| .json({ message: "User is not logged in /not authorized" }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| const userId = req.user.id; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| const workflow = await prismaClient.workflow.findFirst({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| where:{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| userId: userId, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| isEmpty: true | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| orderBy: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| createdAt: 'desc' | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| return res | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| .status(statusCodes.OK) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| .json({ message: "Workflow fetched succesful", Data: workflow }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| }catch(e){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.log("The error is from getting wrkflows", e instanceof Error ? e.message : "UNKNOWN ERROR"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| return res.status(statusCodes.INTERNAL_SERVER_ERROR).json({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| meesage: "Internal Server Error From getting workflows for the user", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| router.get("/workflow/:workflowId", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| userMiddleware, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| async (req: AuthRequest, res: Response) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -329,6 +326,10 @@ router.get("/workflow/:workflowId", | |||||||||||||||||||||||||||||||||||||||||||||||||||
| id: workflowId, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| userId: userId, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| include:{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Trigger: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| nodes: { orderBy: {position: 'asc'}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!getWorkflow) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| return res.status(statusCodes.UNAUTHORIZED).json({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -347,6 +348,110 @@ router.get("/workflow/:workflowId", | |||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| // ---------------------------------------- INSERTING DATA INTO NODES/ TRIGGER TABLE----------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| router.post('/create/trigger', userMiddleware, async(req: AuthRequest, res: Response)=>{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!req.user) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| return res.status(statusCodes.BAD_REQUEST).json({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| message: "User is not logged in ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| const data = req.body; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| const dataSafe = TriggerSchema.safeParse(data) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if(!dataSafe.success) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| return res.status(statusCodes.BAD_REQUEST).json({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| message: "Invalid input" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| const createdTrigger = await prismaClient.trigger.create({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| data:{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: dataSafe.data.Name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| AvailableTriggerID: dataSafe.data.AvailableTriggerID, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| config: dataSafe.data.Config, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| workflowId: dataSafe.data.WorkflowId, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| // trigger type pettla db lo ledu aa column | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| if(createdTrigger){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| return res.status(statusCodes.CREATED).json({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| message: "Trigger created", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| data: createdTrigger | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }catch(e){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.log("This is the error from Trigger creatig", e); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| return res.status(statusCodes.INTERNAL_SERVER_ERROR).json({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| message: "Internal server Error from Trigger creation ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| // INPUT FORMAT | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| // { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| // "Name": "test-1", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| // "AvailableTriggerID": "153c62fb-d61e-4e10-a8f4-d54780883200", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| // "Config": {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| // "WorkflowId": "d0216fca-ca9b-4f3f-b01c-0a29b4305708", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| // "TriggerType":"" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| // } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| router.post('/create/node', userMiddleware, async(req: AuthRequest, res: Response)=>{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| try{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if(!req.user){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| return res.status(statusCodes.BAD_REQUEST).json({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| message: "User is not logged in ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| const data = req.body; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.log(data," from http-backeden" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| const dataSafe = NodeSchema.safeParse(data) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if(!dataSafe.success) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| return res.status(statusCodes.BAD_REQUEST).json({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| message: "Invalid input" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| const createdNode = await prismaClient.node.create({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| data:{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: dataSafe.data.Name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| workflowId: dataSafe.data.WorkflowId, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| AvailableNodeID: dataSafe.data.AvailableNodeId, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| // AvailabeNodeID: dataSafe.data.AvailableNodeId, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| config: dataSafe.data.Config, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| position: dataSafe.data.Position | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| if(createdNode) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| return res.status(statusCodes.CREATED).json({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| message: "Node created", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| data: createdNode | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }catch(e){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.log("This is the error from Node creating", e); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| return res.status(statusCodes.INTERNAL_SERVER_ERROR).json({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| message: "Internal server Error from Node creation", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+427
to
+437
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing response when node creation returns falsy value. Same issue as with trigger creation - if 🔎 Suggested fix if(createdNode)
return res.status(statusCodes.CREATED).json({
message: "Node created",
data: createdNode
})
+ return res.status(statusCodes.INTERNAL_SERVER_ERROR).json({
+ message: "Failed to create node"
+ });
}catch(e){📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| // ----------------------- GET WORKFLOW DATA(NODES, TRIGGER)--------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| // router.get('/getworkflowData', userMiddleware, async(req: AuthRequest, res: Response)=>{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| // try{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| // if(!req.user){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| // return res.status(statusCodes.BAD_REQUEST).json({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| // message: "User is not logged in ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| // }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| // } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| // }catch(e){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| // } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| // }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| router.get("/protected", userMiddleware, (req: AuthRequest, res) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| return res.json({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ok: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| {"root":["./src/index.ts","./src/routes/nodes.routes.ts","./src/routes/userRoutes/userMiddleware.ts","./src/routes/userRoutes/userRoutes.ts"],"version":"5.7.3"} | ||
| {"root":["./src/index.ts","./src/routes/google_callback.ts","./src/routes/nodes.routes.ts","./src/routes/userroutes/usermiddleware.ts","./src/routes/userroutes/userroutes.ts"],"version":"5.7.3"} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# 1. Find any imports still referencing old casing patterns
echo "=== Checking for old casing in imports ==="
rg -i "from.*['\"].*userRoutes|from.*['\"].*userMiddleware|import.*['\"].*userRoutes|import.*['\"].*userMiddleware" --type=ts --type=js apps/http-backend/ 2>/dev/null || echo "No matches found for old casing"
echo ""
echo "=== Checking for imports of routes (any casing) ==="
rg "from.*['\"].*userroute|from.*['\"].*usermiddleware|import.*userroute|import.*usermiddleware" --type=ts --type=js apps/http-backend/ 2>/dev/null | head -20 || echo "No matches found"
# 2. Verify google_callback.ts exists
echo ""
echo "=== Checking for google_callback.ts ==="
fd "google_callback.ts" apps/http-backend/ 2>/dev/null || echo "google_callback.ts not found"
# 3. Verify the new userroutes directory structure
echo ""
echo "=== Checking userroutes directory structure ==="
fd "userroutes" apps/http-backend/src/ 2>/dev/null || echo "userroutes directory not found"
# 4. Check if old casing directory exists
echo ""
echo "=== Checking if old userRoutes directory still exists ==="
fd "userRoutes" apps/http-backend/src/ 2>/dev/null || echo "userRoutes directory not found"
# 5. List actual files in src/routes/
echo ""
echo "=== Contents of src/routes/ directory ==="
ls -la apps/http-backend/src/routes/ 2>/dev/null || echo "Directory not found"Repository: Dev-Pross/BuildFlow Length of output: 1344 🏁 Script executed: #!/bin/bash
echo "=== Verifying source files referenced in tsconfig.tsbuildinfo ==="
cd apps/http-backend || exit
# Check each file mentioned in tsconfig.tsbuildinfo
echo "1. Checking ./src/index.ts:"
test -f src/index.ts && echo "✓ exists" || echo "✗ not found"
echo "2. Checking ./src/routes/google_callback.ts:"
test -f src/routes/google_callback.ts && echo "✓ exists" || echo "✗ not found"
echo "3. Checking ./src/routes/nodes.routes.ts:"
test -f src/routes/nodes.routes.ts && echo "✓ exists" || echo "✗ not found"
echo "4. Checking ./src/routes/userroutes/usermiddleware.ts:"
test -f src/routes/userroutes/usermiddleware.ts && echo "✓ exists" || echo "✗ not found"
echo "5. Checking ./src/routes/userroutes/userroutes.ts:"
test -f src/routes/userroutes/userroutes.ts && echo "✓ exists" || echo "✗ not found"
echo ""
echo "=== Full directory tree of src/routes ==="
find src/routes -type f -name "*.ts" | sortRepository: Dev-Pross/BuildFlow Length of output: 576 Critical: tsconfig.tsbuildinfo references non-existent file paths — build will fail. The auto-generated
This mismatch will cause TypeScript compilation to fail. Either rename the actual directories/files to lowercase and update all imports, or revert the case changes in 🤖 Prompt for AI Agents |
||
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing response when trigger creation returns falsy value.
If
createdTriggeris falsy (e.g.,nullorundefined), the route handler doesn't send a response, leaving the client hanging. While Prisma typically throws on failure, this is still a defensive coding gap.🔎 Suggested fix
if(createdTrigger){ return res.status(statusCodes.CREATED).json({ message: "Trigger created", data: createdTrigger }) } + return res.status(statusCodes.INTERNAL_SERVER_ERROR).json({ + message: "Failed to create trigger" + }); }catch(e){🤖 Prompt for AI Agents