Skip to content

Commit

Permalink
PIN-4739: Add PurposeVersionRejected event (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
galales authored Mar 25, 2024
1 parent b2f376a commit b6e4192
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ object PurposeEventsConverter {
case PurposeVersionUpdated(purposeId, _) => getMessageIdFromDynamo(dynamoIndexService)(purposeId).map(_.some)
case PurposeVersionDeleted(purposeId, _) => getMessageIdFromDynamo(dynamoIndexService)(purposeId).map(_.some)
case PurposeDeleted(purposeId) => getMessageIdFromDynamo(dynamoIndexService)(purposeId).map(_.some)
case PurposeVersionRejected(purpose, _) =>
getMessageIdFromDynamo(dynamoIndexService)(purpose.id.toString).map(_.some)
}

def asNotificationPayload: PartialFunction[ProjectableEvent, Either[ComponentError, Option[NotificationPayload]]] = {
Expand All @@ -68,6 +70,7 @@ object PurposeEventsConverter {
case PurposeVersionWaitedForApproval(purpose) =>
PurposePayload(purpose.id.toString(), WAITING_FOR_APPROVAL.toString).some
case PurposeVersionArchived(purpose) => PurposePayload(purpose.id.toString(), ARCHIVED.toString()).some
case PurposeVersionRejected(purpose, _) => PurposePayload(purpose.id.toString(), REJECTED.toString()).some
// Only on Drafts, should not be notified
case _: PurposeVersionUpdated => None
// Only on Drafts, should not be notified
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ package object converters {

object EventType extends Enumeration {
type EventType = Value
val ADDED, CREATED, CLONED, DELETED, UPDATED, SUSPENDED, ACTIVATED, ARCHIVED, WAITING_FOR_APPROVAL = Value
val ADDED, CREATED, CLONED, DELETED, UPDATED, SUSPENDED, ACTIVATED, ARCHIVED, WAITING_FOR_APPROVAL, REJECTED = Value
}

def getMessageIdFromDynamo(
Expand Down

0 comments on commit b6e4192

Please sign in to comment.