Work on add contact to contact list

This commit is contained in:
2025-06-12 02:01:06 +03:30
parent 3fdee8c102
commit fb19b55593
17 changed files with 1035 additions and 142 deletions
@@ -0,0 +1,15 @@
package org.to.telegramfinalproject.Server;
import java.util.UUID;
import org.to.telegramfinalproject.Database.userDatabase;
import org.to.telegramfinalproject.Database.ContactDatabase;
public class ContactService {
public static boolean addContact(UUID userId, UUID contactId) {
if (userId.equals(contactId)) return false;
if (userDatabase.findByInternalUUID(contactId) == null) return false;
if (userDatabase.findByInternalUUID(userId) == null) return false;
if (ContactDatabase.existsContact(userId, contactId)) return false;
return ContactDatabase.addContact(userId, contactId);
}
}