delete backend, starting over
This commit is contained in:
parent
babf9eb855
commit
f6a33cf620
51 changed files with 0 additions and 6655 deletions
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Auth\UseCases\CreateSession;
|
||||
|
||||
use App\Auth\Clock;
|
||||
use App\Auth\CreateSessionDto;
|
||||
use App\Auth\Session;
|
||||
use App\Auth\SessionRepository;
|
||||
use App\Auth\TokenGenerator;
|
||||
use App\User\User;
|
||||
|
||||
class CreateSession
|
||||
{
|
||||
private const SESSION_LIFETIME = '+7 days';
|
||||
|
||||
public function __construct(
|
||||
private SessionRepository $sessionRepo,
|
||||
private TokenGenerator $tokenGenerator,
|
||||
private Clock $clock,
|
||||
) {
|
||||
}
|
||||
|
||||
public function execute(User $user): Session
|
||||
{
|
||||
$now = $this->clock->now();
|
||||
$expiresAt = $now->modify(self::SESSION_LIFETIME);
|
||||
|
||||
return $this->sessionRepo->create(new CreateSessionDto(
|
||||
token: $this->tokenGenerator->generate(),
|
||||
user: $user,
|
||||
createdAt: $now,
|
||||
expiresAt: $expiresAt,
|
||||
));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue