From 001b1aab0f504e131c514682c8324e3c577500b0 Mon Sep 17 00:00:00 2001 From: Anjonghun <58875626+JonghunAn@users.noreply.github.com> Date: Sun, 21 Jul 2024 00:04:21 +0900 Subject: [PATCH] refactor: isRead field to readAt --- .../classification/dto/classification.dto.ts | 4 ++-- src/modules/posts/posts.repository.ts | 20 ++++--------------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/src/modules/classification/dto/classification.dto.ts b/src/modules/classification/dto/classification.dto.ts index 5c9ebb7..d747bbe 100644 --- a/src/modules/classification/dto/classification.dto.ts +++ b/src/modules/classification/dto/classification.dto.ts @@ -22,7 +22,7 @@ export interface PostListInClassificationFolder { createdAt: Date; - isRead: boolean; + readAt: Date; } export interface ClassificationPostList { @@ -40,7 +40,7 @@ export interface ClassificationPostList { createdAt: Date; - isRead: boolean; + readAt: Date; } export class UpdateAIClassificationDto { diff --git a/src/modules/posts/posts.repository.ts b/src/modules/posts/posts.repository.ts index 8867950..037c4ca 100644 --- a/src/modules/posts/posts.repository.ts +++ b/src/modules/posts/posts.repository.ts @@ -167,14 +167,8 @@ export class PostsRepository { url: 1, description: 1, createdAt: 1, - isRead: { - $cond: { - if: { $eq: ['$readAt', null] }, - then: false, - else: true, - }, - }, - keywords: '$aiClassification.keywords', + readAt: 1, + 'aiClassification.keywords': 1, }, }, ]) @@ -266,14 +260,8 @@ export class PostsRepository { url: 1, description: 1, createdAt: 1, - isRead: { - $cond: { - if: { $eq: ['$readAt', null] }, - then: false, - else: true, - }, - }, - keywords: '$aiClassification.keywords', + readAt: 1, + 'aiClassification.keywords': 1, }, }, ])