-
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 #94 from depromeet/dev
공지사항, 탈퇴작업 추가 배포
- Loading branch information
Showing
8 changed files
with
128 additions
and
3 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { IsBoolean } from 'class-validator'; | ||
import { Prop, Schema, SchemaFactory, SchemaOptions } from '@nestjs/mongoose'; | ||
import { Types } from 'mongoose'; | ||
|
||
import { TransformObjectIdToString } from 'src/common/decorators/Expose.decorator'; | ||
import { Expose, Transform, Type } from 'class-transformer'; | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { toKRTimeZone } from 'src/common/funcs/toKRTimezone'; | ||
|
||
const options: SchemaOptions = { | ||
collection: 'officialNoti', | ||
timestamps: true, | ||
}; | ||
|
||
@Schema(options) | ||
export class OfficialNoti { | ||
@ApiProperty({ | ||
description: '개별 공지사항의 고유 아이디', | ||
type: String, | ||
}) | ||
// 시리얼 라이제이션 할때 사용 | ||
@TransformObjectIdToString({ toClassOnly: true }) | ||
@Type(() => Types.ObjectId) | ||
@Expose() | ||
_id: Types.ObjectId; | ||
|
||
@ApiProperty({ | ||
type: String, | ||
description: '작성자', | ||
}) | ||
@Prop({ | ||
default: '', | ||
type: String, | ||
}) | ||
@Expose() | ||
nickname: string; | ||
|
||
@ApiProperty({ | ||
type: String, | ||
description: '글내용', | ||
}) | ||
@Prop({ | ||
type: String, | ||
}) | ||
@Expose() | ||
content: string; | ||
|
||
@ApiProperty({ | ||
type: String, | ||
nullable: true, | ||
default: null, | ||
description: '뎁스 넘어갈수있는 링크', | ||
}) | ||
@Prop({ | ||
default: null, | ||
type: String, | ||
}) | ||
@Expose() | ||
link: string; | ||
|
||
@ApiProperty({ | ||
type: String, | ||
description: '한국시간으로 보정된 시간값', | ||
}) | ||
@Transform(({ value }) => toKRTimeZone(value), { toClassOnly: true }) | ||
@Expose() | ||
createdAt: Date; | ||
} | ||
|
||
export const OfficialNotiSchema = SchemaFactory.createForClass(OfficialNoti); | ||
// 한달 간격 사라짐 |
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 |
---|---|---|
|
@@ -61,7 +61,6 @@ export class User { | |
}) | ||
@Prop({ | ||
required: true, | ||
unique: true, | ||
}) | ||
@IsPhoneNumber('KR') | ||
@IsNotEmpty() | ||
|
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,24 @@ | ||
import { InjectModel } from '@nestjs/mongoose'; | ||
import { Injectable } from '@nestjs/common'; | ||
import { Model } from 'mongoose'; | ||
|
||
import { Alarm } from 'src/models/alarm.model'; | ||
import { SaveAlarmDto } from 'src/apis/alarm/dto/saveAlarm.dto'; | ||
|
||
import { OfficialNoti } from 'src/models/officialNoti'; | ||
|
||
@Injectable() | ||
export class OfficialNotiRepository { | ||
constructor( | ||
@InjectModel(OfficialNoti.name) | ||
private readonly officialNotiModel: Model<Alarm>, | ||
) {} | ||
|
||
async getOfficialNotis(): Promise<OfficialNoti[]> { | ||
const notis = await this.officialNotiModel | ||
.find() | ||
.sort({ _id: -1 }) | ||
.lean<OfficialNoti[]>(); | ||
return notis; | ||
} | ||
} |