get started
continuous-integration/drone/push Build is passing Details

issue_a
David D'ALMEIDA 1 year ago
parent 5b75023a4d
commit 867cdb072b

@ -0,0 +1,6 @@
<?php
interface IFriendRequestService {
public function sendRequest($fromUserId, $toUserId);
public function acceptRequest($requestId);
public function declineRequest($requestId);
}

@ -0,0 +1,5 @@
<?php
interface INotificationService {
public function sendNotification($toUserId, $notification);
}

@ -4,7 +4,17 @@ use Model\Role;
// Data Class
/**
* Class User
*
* Represents a user in the system
*/
class User{
/**
* @var array List of friends associated with the user
*/
private array $friendsList;
public function __construct(
private int $id,
private string $nom,
@ -16,7 +26,9 @@ class User{
private float $poids,
private \DateTime $dateNaissance,
private Role $role,
) {}
) {
$this->friends = array();
}
public function getId(): int {
return $this->id;
}

@ -1,8 +1,10 @@
<?php
namespace Manager;
use IFriendRequestService;
use Model\Athlete;
use Model\Coach;
use Model\User;
use Network\IAuthService;
use Shared\Validation;
@ -11,7 +13,12 @@ use Shared\Validation;
class UserManager
{
private IAuthService $authService;
public function __construct(IAuthService $authService)
private IFriendRequestService $friendService;
private User $currentUser;
public function __construct(IAuthService $authService,IFriendRequestService $friendService)
{
$this->authService = $authService;
}
@ -27,6 +34,14 @@ class UserManager
return false;
}
public function addFriends($newFriendId) {
// should verifie si l'user exist si il existe pas return paas ajouter
// verifier si il est pas déja dans la liste des amis
//
$this->friendService->sendRequest($this->currentUser->getId(), $newFriendId);
// if est bien ajouter
}
public function register($loginUser, $passwordUser,$data): bool
{
// foreach ($data as $entry) {

Loading…
Cancel
Save