mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 15:56:57 +00:00
feature/Make a new message is prepended to a previous one at table MappedConsent.note field
This commit is contained in:
parent
3c4e6c4556
commit
d4ce908f8b
@ -1139,13 +1139,14 @@ object Consent extends MdcLoggable {
|
||||
By(MappedConsent.mConsumerId, consent.consumerId), // from the same TPP
|
||||
).filterNot(_.consentId == consent.consentId) // Exclude current consent
|
||||
.map{ c => // Set to terminatedByTpp
|
||||
val note = s"|---> Changed status from ${c.status} to ${ConsentStatus.terminatedByTpp.toString} for consent ID: ${c.id}"
|
||||
val message = s"|---> Changed status from ${c.status} to ${ConsentStatus.terminatedByTpp.toString} for consent ID: ${c.id}"
|
||||
val newNote = s"$currentDate\n$message\n" + consent.note // Prepend to existing note if any
|
||||
val changedStatus =
|
||||
c.mStatus(ConsentStatus.terminatedByTpp.toString)
|
||||
.mNote(s"$currentDate\n$note")
|
||||
.mNote(newNote)
|
||||
.mLastActionDate(new Date())
|
||||
.save
|
||||
if(changedStatus) logger.warn(note)
|
||||
if(changedStatus) logger.warn(message)
|
||||
changedStatus
|
||||
}.forall(_ == true)
|
||||
} else {
|
||||
|
||||
@ -66,9 +66,10 @@ object ConsentScheduler extends MdcLoggable {
|
||||
outdatedConsents.foreach { consent =>
|
||||
Try {
|
||||
val message = s"|---> Changed status from ${consent.status} to ${ConsentStatus.rejected} for consent ID: ${consent.id}"
|
||||
val newNote = s"$currentDate\n$message\n" + consent.note // Prepend to existing note if any
|
||||
consent
|
||||
.mStatus(ConsentStatus.rejected.toString)
|
||||
.mNote(s"$currentDate\n$message")
|
||||
.mNote(newNote)
|
||||
.mStatusUpdateDateTime(new Date())
|
||||
.save
|
||||
logger.warn(message)
|
||||
@ -105,9 +106,10 @@ object ConsentScheduler extends MdcLoggable {
|
||||
expiredConsents.foreach { consent =>
|
||||
Try {
|
||||
val message = s"|---> Changed status from ${consent.status} to ${ConsentStatus.expired} for consent ID: ${consent.id}"
|
||||
val newNote = s"$currentDate\n$message\n" + consent.note // Prepend to existing note if any
|
||||
consent
|
||||
.mStatus(ConsentStatus.expired.toString)
|
||||
.mNote(s"$currentDate\n$message")
|
||||
.mNote(newNote)
|
||||
.mStatusUpdateDateTime(new Date())
|
||||
.save
|
||||
logger.warn(message)
|
||||
@ -136,9 +138,10 @@ object ConsentScheduler extends MdcLoggable {
|
||||
expiredConsents.foreach { consent =>
|
||||
Try {
|
||||
val message = s"|---> Changed status from ${consent.status} to ${ConsentStatus.EXPIRED.toString} for consent ID: ${consent.id}"
|
||||
val newNote = s"$currentDate\n$message\n" + consent.note // Prepend to existing note if any
|
||||
consent
|
||||
.mStatus(ConsentStatus.EXPIRED.toString)
|
||||
.mNote(s"$currentDate\n$message")
|
||||
.mNote(newNote)
|
||||
.mStatusUpdateDateTime(new Date())
|
||||
.save
|
||||
logger.warn(message)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user