Skip to content

Commit

Permalink
hotfix 페이지네이션 API 데이트 관련 자료 형태
Browse files Browse the repository at this point in the history
  • Loading branch information
jhj9109 committed Dec 14, 2023
1 parent f9484ee commit 16c28eb
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion project/backend/src/channel/channel.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export class ChannelController {
const result = await this.channelService.getChannelMessages(
channelId,
userId,
cursorTimestamp,
cursorTimestamp ? new Date(cursorTimestamp) : undefined,
pageSize,
);
if (!result.ok) {
Expand Down
2 changes: 1 addition & 1 deletion project/backend/src/channel/channel.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ export class ChannelService {
try {
const blockList = await this.dmService.getBlockUserList(userId.value);
const whereClause = cursorTimestamp
? { createdAt: { lt: cursorTimestamp } }
? { sentAt: { lt: cursorTimestamp } }
: {};
let result = await this.prismaService.channelMessage.findMany({
where: {
Expand Down
5 changes: 2 additions & 3 deletions project/backend/src/channel/dto/message-pagination.dto.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ApiProperty } from '@nestjs/swagger';
import { Transform, Type } from 'class-transformer';
import { Type } from 'class-transformer';
import { IsDateString, IsInt, IsOptional, Min } from 'class-validator';

export class MessagePaginationDto {
Expand All @@ -11,8 +11,7 @@ export class MessagePaginationDto {
})
@IsOptional()
@IsDateString()
@Transform(({ value }) => (value ? new Date(value) : undefined))
cursorTimestamp?: Date;
cursorTimestamp?: string;

@ApiProperty({
description: '페이지당 메시지 수',
Expand Down
2 changes: 1 addition & 1 deletion project/backend/src/dm/dm.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class DmController {
const res = await this.dmService.getDMChannelMessagesByNickname(
userId,
nickname || '',
cursorTimestamp,
cursorTimestamp ? new Date(cursorTimestamp) : undefined,
pageSize,
);
return res!.data;
Expand Down
2 changes: 1 addition & 1 deletion project/backend/src/dm/dm.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export class DmService {
return { ok: false, error: channelResult.error };
}
const whereClause = cursorTimestamp
? { createdAt: { lt: cursorTimestamp } }
? { sentAt: { lt: cursorTimestamp } }
: {};
const result = await this.prisma.$transaction(
async (prismaTransaction) => {
Expand Down

0 comments on commit 16c28eb

Please sign in to comment.