-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from depromeet/refactor/rooms
Refactor/rooms
- Loading branch information
Showing
20 changed files
with
261 additions
and
335 deletions.
There are no files selected for viewing
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,98 +1,91 @@ | ||
import { Room } from 'src/models/room.model'; | ||
import { ApiProperty, PickType } from '@nestjs/swagger'; | ||
import { Expose, plainToClass, plainToInstance } from 'class-transformer'; | ||
import { Types } from 'mongoose'; | ||
import { CATEGORY_TYPE } from 'src/common/consts/enum'; | ||
import { Expose, Transform } from 'class-transformer'; | ||
|
||
export class ResFindOneRoomDto extends PickType(Room, [ | ||
'_id', | ||
'name', | ||
'category', | ||
'radius', | ||
'userList', | ||
'geometry', | ||
'userCount', | ||
] as const) { | ||
@ApiProperty({ description: '내가 즐겨찾기 했는지', type: Boolean }) | ||
@Expose() | ||
iFavorite: boolean; | ||
|
||
@ApiProperty({ description: '내가 들어가 있는지', type: Boolean }) | ||
@Expose() | ||
iJoin: boolean; | ||
|
||
import { UserProfileDto } from 'src/common/dtos/UserProfile.dto'; | ||
import { Room } from 'src/models/room.model'; | ||
@ApiProperty({ description: '위도 가로선', type: Number }) | ||
@Expose() | ||
get lat(): number { | ||
return this.geometry.coordinates[0]; | ||
} | ||
|
||
export class ResFindOneRoomDto { | ||
constructor(room: Room, iFavoriteRoom: boolean, iAlarm: boolean) { | ||
this._id = room._id; | ||
this.category = room.category; | ||
this.name = room.name; | ||
this.radius = room.radius; | ||
this.lat = room.geometry.coordinates[0]; | ||
this.lng = room.geometry.coordinates[1]; | ||
this.iFavoriteRoom = iFavoriteRoom; | ||
this.iAlarm = iAlarm; | ||
this.userCount = room.userList.length; | ||
this.userList = room.userList; | ||
@ApiProperty({ description: '경도 세로선', type: Number }) | ||
@Expose() | ||
get lng(): number { | ||
return this.geometry.coordinates[1]; | ||
} | ||
@ApiProperty() | ||
_id: string; | ||
|
||
@ApiProperty() | ||
name: string; | ||
@ApiProperty({ description: '내가 채팅방 알림 켰는지여부' }) | ||
@Expose() | ||
iAlarm: boolean; | ||
|
||
@ApiProperty({ description: '유저명수' }) | ||
@Transform((value) => value.obj.userList.length, { toPlainOnly: true }) | ||
@Expose() | ||
userCount: number; | ||
// get userCount(): number { | ||
// return 0; | ||
// } | ||
} | ||
// export class ResFindOneRoomDto { | ||
// constructor(room: Room, iFavoriteRoom: boolean, iAlarm: boolean) { | ||
// this._id = room._id; | ||
// this.category = room.category; | ||
// this.name = room.name; | ||
// this.radius = room.radius; | ||
// this.lat = room.geometry.coordinates[0]; | ||
// this.lng = room.geometry.coordinates[1]; | ||
// this.iFavoriteRoom = iFavoriteRoom; | ||
// this.iAlarm = iAlarm; | ||
// this.userCount = room.userList.length; | ||
// this.userList = room.userList; | ||
// } | ||
// @ApiProperty() | ||
// _id: string; | ||
|
||
@ApiProperty() | ||
radius: number; | ||
// @ApiProperty() | ||
// name: string; | ||
|
||
@ApiProperty({ enum: CATEGORY_TYPE }) | ||
category: CATEGORY_TYPE; | ||
// @ApiProperty() | ||
// radius: number; | ||
|
||
@ApiProperty() | ||
lat: number; | ||
// @ApiProperty({ enum: CATEGORY_TYPE }) | ||
// category: CATEGORY_TYPE; | ||
|
||
@ApiProperty() | ||
lng: number; | ||
// @ApiProperty() | ||
// lat: number; | ||
|
||
@ApiProperty({ type: [UserProfileDto], required: false }) | ||
userList: UserProfileDto[]; | ||
// @ApiProperty() | ||
// lng: number; | ||
|
||
@ApiProperty({ description: '유저 숫자' }) | ||
userCount: number; | ||
// @ApiProperty({ type: [UserProfileDto], required: false }) | ||
// userList: UserProfileDto[]; | ||
|
||
@ApiProperty({ description: '내가 즐겨찾기 했는지' }) | ||
iFavoriteRoom: boolean; | ||
// @ApiProperty({ description: '유저 숫자' }) | ||
// userCount: number; | ||
|
||
@ApiProperty({ description: '내가 들어가 있는지' }) | ||
iJoin: boolean; | ||
// @ApiProperty({ description: '내가 즐겨찾기 했는지' }) | ||
// iFavoriteRoom: boolean; | ||
|
||
@ApiProperty({ description: '내가 채팅방 알림 켰는지여부' }) | ||
iAlarm: boolean; | ||
} | ||
// @ApiProperty({ description: '내가 들어가 있는지' }) | ||
// iJoin: boolean; | ||
|
||
// '_id', | ||
// 'name', | ||
// 'radius', | ||
// 'category', | ||
|
||
// export class UserShowDto { | ||
// // (1) | ||
// @Exclude() private readonly _id: number; | ||
// @Exclude() private readonly _firstName: string; | ||
// @Exclude() private readonly _lastName: string; | ||
// @Exclude() private readonly _orderDateTime: LocalDateTime; | ||
|
||
// constructor(user: User) { | ||
// this._id = user.id; | ||
// this._firstName = user.firstName; | ||
// this._lastName = user.lastName; | ||
// this._orderDateTime = user.orderDateTime.plusDays(1); // (2) | ||
// } | ||
|
||
// @ApiProperty() | ||
// @Expose() // (3) | ||
// get id(): number { | ||
// return this._id; | ||
// } | ||
|
||
// @ApiProperty() | ||
// @Expose() | ||
// get firstName(): string { | ||
// return this._firstName; | ||
// } | ||
|
||
// @ApiProperty() | ||
// @Expose() | ||
// get lastName(): string { | ||
// return this._lastName; | ||
// } | ||
|
||
// @ApiProperty() | ||
// @Expose() | ||
// get orderDateTime(): string { | ||
// return DateTimeUtil.toString(this._orderDateTime); // (4) | ||
// } | ||
// } | ||
// @ApiProperty({ description: '내가 채팅방 알림 켰는지여부' }) | ||
// iAlarm: boolean; | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { Expose } from 'class-transformer'; | ||
|
||
export class LeftRoomResultResDto { | ||
@ApiProperty({ | ||
example: true, | ||
description: '방떠난거 성공여부', | ||
}) | ||
@Expose() | ||
leftSuccess: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.