Package restapi.services
Class ContactService
java.lang.Object
restapi.services.ContactService
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate @NonNull ContactPreferencesService
private @NonNull ContactRepository
private @NonNull DateService
private @NonNull UserService
private @NonNull UserSessionService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addContact
(long sender, long receiver) boolean
areFriends
(long user1, long user2) Returns True if users are friends, False otherwisefindActiveContacts
(long userId) Return contacts that don't have me blocked, that I don't have blocked, and that are online.findContact
(long user1, long user2) Find Contact Entity between user 1 and user 2findUsersContacts
(long id) Get a list of user's contacts' ids
-
Field Details
-
contactRepository
-
contactPreferencesService
-
userSessionService
-
userService
-
dateService
-
-
Constructor Details
-
ContactService
public ContactService()
-
-
Method Details
-
findUsersContacts
Get a list of user's contacts' ids- Parameters:
id
- Id of user to retrieve the contacts of- Returns:
- list of user's contacts' ids
-
findContact
Find Contact Entity between user 1 and user 2- Parameters:
user1
- Id of user 1user2
- Id of user 2- Returns:
- Optional of ContactEntity
-
areFriends
public boolean areFriends(long user1, long user2) Returns True if users are friends, False otherwise- Parameters:
user1
- Id of user 1user2
- Id of user 2- Returns:
- True if users are friends, False otherwise
-
addContact
public void addContact(long sender, long receiver) -
findActiveContacts
Return contacts that don't have me blocked, that I don't have blocked, and that are online.- Parameters:
userId
- Current user to find contacts of- Returns:
- HashMap ( CONTACT_ID : PARAM )
- Throws:
CustomNotFoundException
- When contact not found
-