added a /api/food_orders/latest/ endpoint to recieve the latest food order
Some checks failed
/ ls (pull_request) Successful in 2m6s
/ ls (release) Successful in 1m18s
/ ls (push) Failing after 1m25s

This commit is contained in:
Jan Felix Wiebe 2025-06-17 21:26:05 +02:00
parent ee32852789
commit 300c8cafc9
4 changed files with 64 additions and 0 deletions

View file

@ -62,4 +62,16 @@ final class FoodOrderRepository extends ServiceEntityRepository
->getQuery()
->getResult();
}
/**
* @return FoodOrder|null
*/
public function findLatestOrder(): ?FoodOrder
{
return $this->createQueryBuilder('alias')
->orderBy('alias.id', 'DESC')
->setMaxResults(1)
->getQuery()
->getOneOrNullResult();
}
}