Compare commits

...
8 Commits
7 changed files with 755 additions and 648 deletions

No files matched your search

Generated
+700 -620
View File
File diff suppressed because it is too large. Load diff
-4
View File
@@ -28,10 +28,6 @@ zenstruck_schedule:
frequency: '30 * * * *'
description: "Removes orphaned uploads"
- task: messenger:consume async -t 60
frequency: '*/15 * * * *'
description: "Starts messenger queue"
- task: app:cleanup:xml-dumps
frequency: "0 2 * * *"
description: "Removes outdated XML dumps of requests/responses to BPN API for debugging"
+2 -1
View File
@@ -118,7 +118,8 @@ task('deploy:stop-workers', function () {
});
task('deploy:assets', function () {
runLocally('npm i && npm run build');
runLocally('ddev exec npm ci');
runLocally('ddev exec npm run build');
});
after('deploy:failed', 'deploy:unlock');
@@ -5,13 +5,18 @@ namespace App\BusProNet\DataProvider;
use App\BusProNet\ApiClient;
use App\BusProNet\ApiClientException;
use App\BusProNet\Model\Country;
use App\BusProNet\Model\NotificationResponse;
use Psr\Log\LoggerInterface;
use Symfony\Contracts\Cache\CacheInterface;
use Symfony\Contracts\Cache\ItemInterface;
class CountryDataProvider
{
public function __construct(private readonly ApiClient $apiClient, private readonly CacheInterface $cache)
{
public function __construct(
private readonly ApiClient $apiClient,
private readonly CacheInterface $cache,
private readonly LoggerInterface $logger,
) {
}
public function getAll(): array
@@ -20,11 +25,15 @@ class CountryDataProvider
$countries = $this->cache->get('bpn_countries', function (ItemInterface $item) {
$item->expiresAfter(3600);
return $this
->apiClient
->getBaseData(ApiClient::TYPE_BASE_DATA_COUNTRIES)
->getItems()
;
$response = $this->apiClient->getBaseData(ApiClient::TYPE_BASE_DATA_COUNTRIES);
if ($response instanceof NotificationResponse) {
$this->logger->error('Unable to fetch country base data from BusProNet. Code: '.$response->getCode().', Message: '.$response->getMessage());
throw new ApiClientException('Unable to fetch country base data from BusProNet');
}
return $response->getItems();
});
} catch (ApiClientException $e) {
$countries = [];
@@ -5,14 +5,19 @@ namespace App\BusProNet\DataProvider;
use App\BusProNet\ApiClient;
use App\BusProNet\ApiClientException;
use App\BusProNet\Model\Hotel;
use App\BusProNet\Model\NotificationResponse;
use Psr\Cache\InvalidArgumentException;
use Psr\Log\LoggerInterface;
use Symfony\Contracts\Cache\CacheInterface;
use Symfony\Contracts\Cache\ItemInterface;
class HotelDataProvider
{
public function __construct(private readonly ApiClient $apiClient, private readonly CacheInterface $cache)
{
public function __construct(
private readonly ApiClient $apiClient,
private readonly CacheInterface $cache,
private readonly LoggerInterface $logger,
) {
}
public function getAll(): array
@@ -21,11 +26,15 @@ class HotelDataProvider
$hotels = $this->cache->get('bpn_hotels', function (ItemInterface $item) {
$item->expiresAfter(3600);
return $this
->apiClient
->getBaseData(ApiClient::TYPE_BASE_DATA_HOTELS)
->getItems()
;
$response = $this->apiClient->getBaseData(ApiClient::TYPE_BASE_DATA_HOTELS);
if ($response instanceof NotificationResponse) {
$this->logger->error('Unable to fetch hotel base data from BusProNet. Code: '.$response->getCode().', Message: '.$response->getMessage());
throw new ApiClientException('Unable to fetch hotel base data from BusProNet');
}
return $response->getItems();
});
} catch (ApiClientException|InvalidArgumentException $e) {
$hotels = [];
@@ -4,14 +4,19 @@ namespace App\BusProNet\DataProvider;
use App\BusProNet\ApiClient;
use App\BusProNet\ApiClientException;
use App\BusProNet\Model\NotificationResponse;
use App\BusProNet\Model\Pickup;
use Psr\Log\LoggerInterface;
use Symfony\Contracts\Cache\CacheInterface;
use Symfony\Contracts\Cache\ItemInterface;
class PickupDataProvider
{
public function __construct(private readonly ApiClient $apiClient, private readonly CacheInterface $cache)
{
public function __construct(
private readonly ApiClient $apiClient,
private readonly CacheInterface $cache,
private readonly LoggerInterface $logger,
) {
}
public function getAll(): array
@@ -20,11 +25,15 @@ class PickupDataProvider
$pickups = $this->cache->get('bpn_pickups', function (ItemInterface $item) {
$item->expiresAfter(3600);
return $this
->apiClient
->getBaseData(ApiClient::TYPE_BASE_DATA_PICKUPS)
->getItems()
;
$response = $this->apiClient->getBaseData(ApiClient::TYPE_BASE_DATA_PICKUPS);
if ($response instanceof NotificationResponse) {
$this->logger->error('Unable to fetch pickup base data from BusProNet. Code: '.$response->getCode().', Message: '.$response->getMessage());
throw new ApiClientException('Unable to fetch pickup base data from BusProNet');
}
return $response->getItems();
});
} catch (ApiClientException $e) {
$pickups = [];
+5 -2
View File
@@ -345,13 +345,16 @@ class AssignmentRepository extends ServiceEntityRepository
$qb->expr()->in('assignment.jobProfile', ':jobProfiles'),
$qb->expr()->isNull('application'),
$qb->expr()->isNull('disposition'),
$qb->expr()->in('assignment.id', $availableAssignmentsIds)
))
->setParameter('staffingStatus', Assignment::STATUS_STAFFED)
->setParameter('jobProfiles', $teamer->getJobProfiles())
->setParameter('teamer', $teamer)
;
if ([] !== $availableAssignmentsIds) {
$qb->andWhere($qb->expr()->in('assignment.id', $availableAssignmentsIds));
}
if (0 === $teamer->getTrainingAttendances()->count() && 0 === $teamer->getLicenses()->count()) {
$qb
->andWhere($qb->expr()->eq('job_profile.requiredLicenses', ':requiredLicenses'))
@@ -361,7 +364,7 @@ class AssignmentRepository extends ServiceEntityRepository
}
return $qb
->orderBy('assignment.createdAt', 'DESC')
->orderBy('destination.dateFrom', 'ASC')
->setMaxResults($limit)
->getQuery()
->getResult()