Web app: new entities (Image, RenderedAsset, SharedImage, Token, DeviceImageHistory), enums, repositories, controllers, message handlers, migrations, tests, frontend upload/library/sticker UI, Vue components. Firmware: EPD background screen binaries + gen scripts, setup_bg header. Infra: ddev config, test bundle, gitignore coverage dir. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Token;
|
||||
use App\Enum\TokenType;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/** @extends ServiceEntityRepository<Token> */
|
||||
class TokenRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Token::class);
|
||||
}
|
||||
|
||||
public function findValidToken(string $uuid, TokenType $type): ?Token
|
||||
{
|
||||
return $this->createQueryBuilder('t')
|
||||
->where('t.uuid = :uuid')
|
||||
->andWhere('t.type = :type')
|
||||
->andWhere('t.usedAt IS NULL')
|
||||
->andWhere('t.expiresAt > :now')
|
||||
->setParameter('uuid', $uuid)
|
||||
->setParameter('type', $type)
|
||||
->setParameter('now', new \DateTimeImmutable())
|
||||
->getQuery()
|
||||
->getOneOrNullResult();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user