Skip to content

Commit

Permalink
TVIST1-826: Added message-uuid filter on `tvist1:digital-post-envel…
Browse files Browse the repository at this point in the history
…ope:list` command
  • Loading branch information
rimi-itk committed May 3, 2023
1 parent 573e58a commit 3a42913
Show file tree
Hide file tree
Showing 2 changed files with 10 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-368](https://github.com/itk-dev/naevnssekretariatet/pull/368)
Added `message-uuid` filter on `tvist1:digital-post-envelope:list` command.
- [PR-367](https://github.com/itk-dev/naevnssekretariatet/pull/367)
Preselected party relation type upon edit
- [PR-363](https://github.com/itk-dev/naevnssekretariatet/pull/363)
Expand Down
8 changes: 8 additions & 0 deletions src/Command/DigitalPostEnvelopeListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ protected function configure()
->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')
->addOption('message-uuid', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Messaged uuid')
->addOption('show-throwable', null, InputOption::VALUE_NONE, 'show throwable')
->addOption('has-errors', null, InputOption::VALUE_NONE, 'Show envelopes with errors')
->addOption('show-errors', null, InputOption::VALUE_NONE, 'show errors')
Expand Down Expand Up @@ -119,6 +120,13 @@ private function findEnvelopes(InputInterface $input): array
->setParameter('ids', $ids)
;
}
if ($messageUuids = $input->getOption('message-uuid')) {
$messageUuids = array_map(static fn (string $id) => Uuid::fromString($id)->toRfc4122(), $messageUuids);
$qb
->andWhere('e.meMoMessageUuid IN (:messageUuids)')
->setParameter('messageUuids', $messageUuids)
;
}
if ($status = $input->getOption('status')) {
$qb
->andWhere('e.status = :status')
Expand Down

0 comments on commit 3a42913

Please sign in to comment.