Skip to content

Commit

Permalink
TEAMMANAGE-2784: Added digital post id filter on envelope list command
Browse files Browse the repository at this point in the history
  • Loading branch information
rimi-itk committed Oct 5, 2023
1 parent 4c32c96 commit 885b455
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
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

0 comments on commit 885b455

Please sign in to comment.