From 297a07e2813b748e362d80e81210789882002105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Arturo=20Cabral=20Mej=C3=ADa?= Date: Mon, 16 Jan 2023 01:08:01 -0500 Subject: [PATCH] fix: deleted_at not saved in UTC tz MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ricardo Arturo Cabral Mejía --- src/repositories/event-repository.ts | 2 +- test/unit/repositories/event-repository.spec.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/repositories/event-repository.ts b/src/repositories/event-repository.ts index c1f4b16f..e9d1651c 100644 --- a/src/repositories/event-repository.ts +++ b/src/repositories/event-repository.ts @@ -245,7 +245,7 @@ export class EventRepository implements IEventRepository { event_signature: pipe(always(''), toBuffer), event_delegator: always(null), event_deduplication: pipe(always([pubkey, 5]), toJSON), - deleted_at: always(date), + deleted_at: always(date.toISOString()), }) ) ) diff --git a/test/unit/repositories/event-repository.spec.ts b/test/unit/repositories/event-repository.spec.ts index 6ea975cd..dace5c16 100644 --- a/test/unit/repositories/event-repository.spec.ts +++ b/test/unit/repositories/event-repository.spec.ts @@ -451,7 +451,7 @@ describe('EventRepository', () => { it('insert stubs by pubkey & event ids', () => { const query = repository.insertStubs('001122', ['aabbcc', 'ddeeff']).toString() - expect(query).to.equal('insert into "events" ("deleted_at", "event_content", "event_created_at", "event_deduplication", "event_delegator", "event_id", "event_kind", "event_pubkey", "event_signature", "event_tags") values (\'1970-01-20 03:57:15.425\', \'\', 1673835, \'["001122",5]\', NULL, X\'aabbcc\', 5, X\'001122\', X\'\', \'[]\'), (\'1970-01-20 03:57:15.425\', \'\', 1673835, \'["001122",5]\', NULL, X\'ddeeff\', 5, X\'001122\', X\'\', \'[]\') on conflict do nothing') + expect(query).to.equal('insert into "events" ("deleted_at", "event_content", "event_created_at", "event_deduplication", "event_delegator", "event_id", "event_kind", "event_pubkey", "event_signature", "event_tags") values (\'1970-01-20T08:57:15.425Z\', \'\', 1673835, \'["001122",5]\', NULL, X\'aabbcc\', 5, X\'001122\', X\'\', \'[]\'), (\'1970-01-20T08:57:15.425Z\', \'\', 1673835, \'["001122",5]\', NULL, X\'ddeeff\', 5, X\'001122\', X\'\', \'[]\') on conflict do nothing') }) })