Skip to content

Commit

Permalink
modified history delete to delete related converations
Browse files Browse the repository at this point in the history
  • Loading branch information
TottySnowman committed Oct 29, 2023
1 parent b419509 commit 92678fc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions backend/src/controllers/index.ts
Expand Up @@ -62,9 +62,10 @@ app.delete("/history", async (req: Request, res: Response) => {
const driver = await createDriver();

const session = driver.session();

//"MATCH (h:History WHERE ID(h) = $history)-[:HAS_CONVERSATION]->(c:Conversation)-[r]->(relatedNode) DETACH DELETE h, relatedNode",

const result = await session.run(
"MATCH (h:History) WHERE ID(h) = $history DETACH DELETE h",
"MATCH (h:History WHERE ID(h) = $history)-[:HAS_CONVERSATION]->(c:Conversation) detach delete h, c",
{ history: Number(historyID) }
);
closeConnection(driver, session);
Expand Down Expand Up @@ -221,7 +222,7 @@ const getHistoryByUser = async (userID: Number) => {
{ userIDDB: Number(userID) }
);
closeConnection(driver, session);

if (records.length <= 0) {
return [];
}
Expand Down

0 comments on commit 92678fc

Please sign in to comment.