generated from CS196Illinois/SP24-Project-Template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from CS196Illinois/matching_algo
adding users to one way and two way tables
- Loading branch information
Showing
5 changed files
with
160 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
Project/backend/java-server/app/src/main/java/org/server/OneAndTwoWayMatches.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.server; | ||
|
||
public class OneAndTwoWayMatches { | ||
|
||
public boolean updateMatches(String discordId, String matchedId) { | ||
PostgreSQLController pgController = new PostgreSQLController(); | ||
boolean exists = pgController.existsInOneWay(discordId, matchedId); | ||
if (exists) { | ||
boolean deleted = pgController.deleteOneWayMatched(discordId, matchedId); | ||
if (!deleted) { | ||
return false; | ||
} | ||
boolean added_to_two_way = pgController.updateTwoWayMatched(discordId, matchedId); | ||
if (!added_to_two_way) { | ||
return false; | ||
} | ||
} else { | ||
boolean added = pgController.updateOneWayMatched(discordId, matchedId); | ||
if (!added) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters