Package restapi.services
Class MatchService
java.lang.Object
restapi.services.MatchService
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate @NonNull DateService
private @NonNull MatchRepository
private @NonNull UserService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancelRequest
(long userId, long matchId) Saves match as active if previously sentgetActiveMatches
(long user) Returns list of active matches with usergetDtoFromEntityAndUserId
(MatchEntity entity, long userId) getMatchById
(long id) Get Match By IdgetOutdatedMatches
(long user) getRecentMatchBetweenUsers
(long u1, long u2) Returns list of active matches between u1 and u2getUsers10LastMatches
(long user) boolean
isThereARecentMatchBetweenUsers
(long u1, long u2) Returns true if there is a match between userslong
saveMatch
(long u1, long u2, long range, double lat, double lon) Saves match on dbsendRequest
(long userId, MatchEntity entity) Saves match as requested
-
Field Details
-
dateService
-
matchRepository
-
userService
-
-
Constructor Details
-
MatchService
public MatchService()
-
-
Method Details
-
getRecentMatchBetweenUsers
Returns list of active matches between u1 and u2- Parameters:
u1
-u2
-- Returns:
-
isThereARecentMatchBetweenUsers
public boolean isThereARecentMatchBetweenUsers(long u1, long u2) Returns true if there is a match between users- Parameters:
u1
-u2
-- Returns:
-
saveMatch
public long saveMatch(long u1, long u2, long range, double lat, double lon) Saves match on db- Parameters:
u1
-u2
-range
-lat
-lon
-- Returns:
-
getUsers10LastMatches
-
getDtoFromEntityAndUserId
public LocationMatch getDtoFromEntityAndUserId(MatchEntity entity, long userId) throws CustomNotFoundException - Throws:
CustomNotFoundException
-
getMatchById
Get Match By Id- Parameters:
id
-- Returns:
- Throws:
CustomNotFoundException
-
getActiveMatches
Returns list of active matches with user- Parameters:
user
-- Returns:
-
getOutdatedMatches
-
sendRequest
Saves match as requested- Parameters:
userId
-entity
-- Returns:
- Throws:
CustomInternalErrorException
-
cancelRequest
public void cancelRequest(long userId, long matchId) throws CustomInternalErrorException, CustomNotFoundException, CustomConflictException Saves match as active if previously sent- Parameters:
userId
-matchId
-- Throws:
CustomInternalErrorException
CustomNotFoundException
CustomConflictException
-