Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
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;
}
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());
}
}
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);
Comment thread
rootandroo marked this conversation as resolved.

/**
* @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);
}
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());
}
}
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);
}
Loading
Loading