diff --git a/src/modules/cards/domain/Card.ts b/src/modules/cards/domain/Card.ts index 0ca90374..ce6a2849 100644 --- a/src/modules/cards/domain/Card.ts +++ b/src/modules/cards/domain/Card.ts @@ -270,7 +270,7 @@ export class Card extends AggregateRoot { addedAt: membershipAddedAt, }); this.props.libraryCount = this.props.libraryMemberships.length; - this.props.updatedAt = new Date(); + this.props.updatedAt = addedAt ?? new Date(); // Raise domain event const domainEvent = CardAddedToLibraryEvent.create( @@ -323,7 +323,6 @@ export class Card extends AggregateRoot { public markAsPublished(publishedRecordId: PublishedRecordId): void { this.props.publishedRecordId = publishedRecordId; - this.props.updatedAt = new Date(); this.markCardInLibraryAsPublished(this.props.curatorId, publishedRecordId); } @@ -344,8 +343,6 @@ export class Card extends AggregateRoot { this.props.publishedRecordId = publishedRecordId; } - this.props.updatedAt = new Date(); - return ok(undefined); } diff --git a/src/modules/cards/domain/CardFactory.ts b/src/modules/cards/domain/CardFactory.ts index c87140e6..31eb6063 100644 --- a/src/modules/cards/domain/CardFactory.ts +++ b/src/modules/cards/domain/CardFactory.ts @@ -125,6 +125,7 @@ export class CardFactory { parentCardId, viaCardId, createdAt: props.createdAt, + updatedAt: props.createdAt, }); } catch (error) { return err(