Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TEAMMANAGE-2784: Added digital post id filter on envelope list command #382

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ about writing changes to this log.

## [Unreleased]

- [PR-382](https://github.com/itk-dev/naevnssekretariatet/pull/382)
Added `--digital-post-id` filter on `tvist1:digital-post-envelope:list`.
- [PR-380](https://github.com/itk-dev/naevnssekretariatet/pull/380)
Updated `itk-dev/openid-connect-bundle` to use authorization code flow.
- [PR-380](https://github.com/itk-dev/naevnssekretariatet/pull/380)
Expand Down
9 changes: 9 additions & 0 deletions src/Command/DigitalPostEnvelopeListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ protected function configure()
{
$this
->addOption('status', null, InputOption::VALUE_REQUIRED, 'Show only envelopes with this status')
->addOption('digital-post-id', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Digital post id')
->addOption('digital-post-subject', null, InputOption::VALUE_REQUIRED, 'Show only envelopes with subject matching this LIKE expression')
->addOption('max-results', null, InputOption::VALUE_REQUIRED, 'Show at most this many envelopes', 10)
->addOption('id', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Envelope id')
Expand Down Expand Up @@ -134,6 +135,14 @@ private function findEnvelopes(InputInterface $input): array
->setParameter('status', $status)
;
}
if ($digitalPostIds = $input->getOption('digital-post-id')) {
$digitalPostIds = array_map(static fn (string $id) => Uuid::fromString($id)->toBinary(), $digitalPostIds);
$qb
->join('e.digitalPost', 'p_id')
->andWhere('p_id.id IN (:digitalPostIds)')
->setParameter('digitalPostIds', $digitalPostIds)
;
}
if ($subject = $input->getOption('digital-post-subject')) {
$qb
->join('e.digitalPost', 'p')
Expand Down
Loading