-
Notifications
You must be signed in to change notification settings - Fork 0
Implement Match & MatchCycle Repo #53
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
Open
rootandroo
wants to merge
8
commits into
main
Choose a base branch
from
api-match-history
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
882c45a
Align match schema types: cycle_id INT, feedback TEXT
b745513
Init design doc
fc2b8c9
Comments on design of api
44a3dff
Create domain models for matches
c967b65
Remove stale api/matches/ directory
9ef9d63
Add match repos, models, and filter criteria
197bc1c
Update MatchCycleRepo.java
rootandroo d748d19
Apply changes from code browser
rootandroo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
src/main/java/org/patinanetwork/patchats/api/match/db/models/Match.java
This file contains hidden or 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,41 @@ | ||
| package org.patinanetwork.patchats.api.match.db.models; | ||
|
|
||
| import java.time.Instant; | ||
| import java.util.UUID; | ||
| import lombok.Builder; | ||
| import lombok.EqualsAndHashCode; | ||
| import lombok.Getter; | ||
| import lombok.Setter; | ||
| import lombok.ToString; | ||
|
|
||
| @Getter | ||
| @Builder | ||
| @ToString | ||
| @EqualsAndHashCode(of = "id") | ||
| public class Match { | ||
|
|
||
| private UUID id; | ||
|
|
||
| @Setter | ||
| private UUID memberAId; | ||
|
|
||
| @Setter | ||
| private UUID memberBId; | ||
|
|
||
| @Setter | ||
| private Integer matchCycleId; | ||
|
|
||
| @Setter | ||
| private Double matchScore; | ||
|
|
||
| @Setter | ||
| private String status; | ||
|
|
||
| @Setter | ||
| private String feedbackA; | ||
|
|
||
| @Setter | ||
| private String feedbackB; | ||
|
|
||
| private Instant createdAt; | ||
| } |
34 changes: 34 additions & 0 deletions
34
src/main/java/org/patinanetwork/patchats/api/match/db/models/MatchCycle.java
This file contains hidden or 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,34 @@ | ||
| package org.patinanetwork.patchats.api.match.db.models; | ||
|
|
||
| import java.time.Instant; | ||
| import java.util.List; | ||
| import java.util.UUID; | ||
| import lombok.Builder; | ||
| import lombok.EqualsAndHashCode; | ||
| import lombok.Getter; | ||
| import lombok.Setter; | ||
| import lombok.ToString; | ||
|
|
||
| @Getter | ||
| @Builder | ||
| @ToString | ||
| @EqualsAndHashCode(of = "id") | ||
| public class MatchCycle { | ||
|
|
||
| private Integer id; | ||
|
|
||
| @Setter | ||
| private String period; | ||
|
|
||
| @Setter | ||
| private Instant runAt; | ||
|
|
||
| @Setter | ||
| private Integer totalMembers; | ||
|
|
||
| @Setter | ||
| private Integer totalMatched; | ||
|
|
||
| @Setter | ||
| private List<UUID> unmatchedIds; | ||
| } |
12 changes: 12 additions & 0 deletions
12
src/main/java/org/patinanetwork/patchats/api/match/db/repos/MatchCycleFilterCriteria.java
This file contains hidden or 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,12 @@ | ||
| package org.patinanetwork.patchats.api.match.db.repos; | ||
|
|
||
| import java.time.Instant; | ||
| import java.util.Optional; | ||
|
|
||
| public record MatchCycleFilterCriteria( | ||
| Optional<String> period, Optional<Instant> startTime, Optional<Instant> endTime) { | ||
|
|
||
| public static MatchCycleFilterCriteria empty() { | ||
| return new MatchCycleFilterCriteria(Optional.empty(), Optional.empty(), Optional.empty()); | ||
| } | ||
| } |
44 changes: 44 additions & 0 deletions
44
src/main/java/org/patinanetwork/patchats/api/match/db/repos/MatchCycleRepo.java
This file contains hidden or 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,44 @@ | ||
| package org.patinanetwork.patchats.api.match.db.repos; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Optional; | ||
| import org.patinanetwork.patchats.api.match.db.models.MatchCycle; | ||
|
|
||
| public interface MatchCycleRepo { | ||
|
|
||
| /** | ||
| * @note - The provided object's methods will be overridden with any returned data from the database. | ||
| * @param matchCycle - required fields: | ||
| * <ul> | ||
| * <li>runAt | ||
| * </ul> | ||
| * Optional fields: | ||
| * <ul> | ||
| * <li>period | ||
| * <li>totalMembers | ||
| * <li>totalMatched | ||
| * <li>unmatchedIds | ||
| * </ul> | ||
| * The id field will be auto-generated by the database. | ||
| */ | ||
| MatchCycle createMatchCycle(MatchCycle matchCycle); | ||
|
|
||
| /** | ||
| * @note - The provided object's methods will be overridden with any returned data from the database. | ||
| * @param matchCycle - overridden fields: | ||
| * <ul> | ||
| * <li>period | ||
| * <li>runAt | ||
| * <li>totalMembers | ||
| * <li>totalMatched | ||
| * <li>unmatchedIds | ||
| * </ul> | ||
| */ | ||
| Optional<MatchCycle> updateMatchCycle(MatchCycle matchCycle); | ||
|
|
||
| Optional<MatchCycle> getMatchCycleById(Integer id); | ||
|
|
||
| Optional<MatchCycle> deleteMatchCycleById(Integer id); | ||
|
|
||
| List<MatchCycle> filterMatchCycles(MatchCycleFilterCriteria criteria); | ||
| } | ||
26 changes: 26 additions & 0 deletions
26
src/main/java/org/patinanetwork/patchats/api/match/db/repos/MatchFilterCriteria.java
This file contains hidden or 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,26 @@ | ||
| package org.patinanetwork.patchats.api.match.db.repos; | ||
|
|
||
| import java.time.Instant; | ||
| import java.util.Optional; | ||
| import java.util.UUID; | ||
|
|
||
| public record MatchFilterCriteria( | ||
| Optional<Instant> startTime, | ||
| Optional<Instant> endTime, | ||
| Optional<String> period, | ||
| Optional<UUID> memberId, | ||
| Optional<Integer> matchCycleId, | ||
| Optional<String> memberIndustry, | ||
| Optional<String> status) { | ||
|
|
||
| public static MatchFilterCriteria empty() { | ||
| return new MatchFilterCriteria( | ||
| Optional.empty(), | ||
| Optional.empty(), | ||
| Optional.empty(), | ||
| Optional.empty(), | ||
| Optional.empty(), | ||
| Optional.empty(), | ||
| Optional.empty()); | ||
| } | ||
| } |
45 changes: 45 additions & 0 deletions
45
src/main/java/org/patinanetwork/patchats/api/match/db/repos/MatchRepo.java
This file contains hidden or 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,45 @@ | ||
| package org.patinanetwork.patchats.api.match.db.repos; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Optional; | ||
| import java.util.UUID; | ||
| import org.patinanetwork.patchats.api.match.db.models.Match; | ||
|
|
||
| public interface MatchRepo { | ||
| /** | ||
| * @note - The provided object's methods will be overridden with any returned data from the database. | ||
| * @param match - required fields: | ||
| * <ul> | ||
| * <li>id | ||
| * <li>memberAId | ||
| * <li>memberBId | ||
| * <li>matchCycleId | ||
| * </ul> | ||
| */ | ||
| Match createMatch(Match match); | ||
|
|
||
| /** | ||
| * @note - The provided object's methods will be overridden with any returned data from the database. | ||
| * @param match - overridden fields: | ||
| * <ul> | ||
| * <li>memberAId | ||
| * <li>memberBId | ||
| * <li>matchCycleId | ||
| * <li>matchScore | ||
| * <li>status | ||
| * <li>feedbackA | ||
| * <li>feedbackB | ||
| * </ul> | ||
| */ | ||
| Optional<Match> updateMatch(Match match); | ||
|
|
||
| Optional<Match> getMatchById(UUID id); | ||
|
|
||
| Optional<Match> setMatchStatus(UUID id, String status); | ||
|
|
||
| Optional<Match> deleteMatchById(UUID id); | ||
|
|
||
| Optional<Match> recordFeedback(UUID id, UUID memberId, String feedback); | ||
|
|
||
| List<Match> filterMatches(MatchFilterCriteria criteria); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.