From 70168918a6a04fa99177dd4c65df6a0d0f1c2132 Mon Sep 17 00:00:00 2001 From: Sergey Elpashev Date: Mon, 27 Nov 2023 00:23:45 +0300 Subject: [PATCH] Added edit_timestamp col to post --- backend/libs/database/post.entity.ts | 3 +++ backend/src/modules/post/post.service.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/libs/database/post.entity.ts b/backend/libs/database/post.entity.ts index f58dc2a..739d593 100644 --- a/backend/libs/database/post.entity.ts +++ b/backend/libs/database/post.entity.ts @@ -22,6 +22,9 @@ export class Post { @Column({ type: 'timestamptz' }) public timestamp!: Date; + @Column({ type: 'timestamptz', nullable: true }) + public edit_timestamp?: Date; + @Column({ nullable: false }) public from_user_id!: string; diff --git a/backend/src/modules/post/post.service.ts b/backend/src/modules/post/post.service.ts index 34045e1..4b714b4 100644 --- a/backend/src/modules/post/post.service.ts +++ b/backend/src/modules/post/post.service.ts @@ -41,7 +41,7 @@ export class PostService { } if (post.text !== data.text) { post.text = data.text; - post.timestamp = new Date(); + post.edit_timestamp = new Date(); await this.postRepository.save(post); } return post;