From b00dd4f1f07173f6d36eed31cc44e0d2f2224090 Mon Sep 17 00:00:00 2001 From: ColinBuyck <53269332+ColinBuyck@users.noreply.github.com> Date: Tue, 19 Nov 2024 16:43:53 -0500 Subject: [PATCH] fix: publishedAt on create (#4479) --- api/src/services/listing.service.ts | 2 ++ api/test/unit/services/listing.service.spec.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/api/src/services/listing.service.ts b/api/src/services/listing.service.ts index 9b56bc5217..9feae96b80 100644 --- a/api/src/services/listing.service.ts +++ b/api/src/services/listing.service.ts @@ -895,6 +895,8 @@ export class ListingService implements OnModuleInit { } : undefined, requestedChangesUser: undefined, + publishedAt: + dto.status === ListingsStatusEnum.active ? new Date() : undefined, contentUpdatedAt: new Date(), copyOf: copyOfId ? { diff --git a/api/test/unit/services/listing.service.spec.ts b/api/test/unit/services/listing.service.spec.ts index a5c97e43a6..3d2c18c124 100644 --- a/api/test/unit/services/listing.service.spec.ts +++ b/api/test/unit/services/listing.service.spec.ts @@ -1895,6 +1895,7 @@ describe('Testing listing service', () => { data: { ...val, contentUpdatedAt: expect.anything(), + publishedAt: expect.anything(), assets: { create: [exampleAsset], },