From c5bc91e79d0a282426a14b4512226127f476d8d1 Mon Sep 17 00:00:00 2001 From: ssoxong Date: Wed, 1 May 2024 22:22:44 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20event=20=EC=9E=85=EA=B8=88=EA=B8=B0?= =?UTF-8?q?=ED=95=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/event/dto/create-event.dto.ts | 12 ++++++++++++ src/event/entities/event.entity.ts | 2 ++ src/event/interfaces/event.interface.ts | 2 ++ src/event/schemas/event.schema.ts | 2 ++ src/group/group.service.ts | 4 ++-- src/transaction/transaction.repository.ts | 4 ++-- 6 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/event/dto/create-event.dto.ts b/src/event/dto/create-event.dto.ts index fbb7d5e..4968db1 100644 --- a/src/event/dto/create-event.dto.ts +++ b/src/event/dto/create-event.dto.ts @@ -25,6 +25,18 @@ export class CreateEventDto { }) endDate: Date; + @ApiProperty({ + description: '이벤트 입금 시작일', + example: new Date().toISOString(), + }) + transactionStartDate: Date; + + @ApiProperty({ + description: '이벤트 입금 마감일', + example: new Date(), + }) + transactionEndDate: Date; + @ApiProperty({ description: '이벤트 참가비', example: 10000, diff --git a/src/event/entities/event.entity.ts b/src/event/entities/event.entity.ts index 28c4839..03acaa0 100644 --- a/src/event/entities/event.entity.ts +++ b/src/event/entities/event.entity.ts @@ -4,6 +4,8 @@ export class Event { description: string; startDate: Date; endDate: Date; + transactionStartDate: Date; + transactionEndDate: Date; fee: number; attendees: string[]; } diff --git a/src/event/interfaces/event.interface.ts b/src/event/interfaces/event.interface.ts index 2979249..559d757 100644 --- a/src/event/interfaces/event.interface.ts +++ b/src/event/interfaces/event.interface.ts @@ -5,6 +5,8 @@ export interface EventInterface extends Document { description: string; startDate: Date; endDate: Date; + transactionStartDate: Date; + transactionEndDate: Date; fee: number; attendees: string[]; } diff --git a/src/event/schemas/event.schema.ts b/src/event/schemas/event.schema.ts index ad9608e..ebe53fb 100644 --- a/src/event/schemas/event.schema.ts +++ b/src/event/schemas/event.schema.ts @@ -5,6 +5,8 @@ export const EventSchema = new Schema({ description: String, startDate: Date, endDate: Date, + transactionStartDate: Date, + transactionEndDate: Date, fee: Number, attendees: { type: [String], default: [] }, }); diff --git a/src/group/group.service.ts b/src/group/group.service.ts index 93f7f6f..0f7887a 100644 --- a/src/group/group.service.ts +++ b/src/group/group.service.ts @@ -122,8 +122,8 @@ export class GroupService { //eventId로 eventTransaction 정보 가져오기 const event = await this.eventService.getOne(eventId); // startTransactionDate, endTransactionDate로 변경 필요 - const eventStart = event.startDate; - const eventEnd = event.endDate; + const eventStart = event.transactionStartDate; + const eventEnd = event.transactionEndDate; return this.transactionService.getTransactionsByPeriod( groupId, diff --git a/src/transaction/transaction.repository.ts b/src/transaction/transaction.repository.ts index 820caf5..83a5df4 100644 --- a/src/transaction/transaction.repository.ts +++ b/src/transaction/transaction.repository.ts @@ -28,8 +28,8 @@ export class TransactionRepository { .find({ 'metadata.groupId': groupId, timestamp: { - $gte: new Date(startDate), - $lt: new Date(endDate), + $gte: new Date(startDate).toISOString(), + $lt: new Date(endDate).toISOString(), }, }) .exec();