Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/#369 eslint, 알림 string 리턴 수정, swagger 성공하게 조건 변경 #370

Merged
merged 19 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
630df7a
💄 style: eslint 깨지는 파일 수정
swkim12345 Dec 4, 2024
05f6fab
📝 docs: stockId 잘못 들어 있던 데코레이터 수정
swkim12345 Dec 4, 2024
dbf358f
📝 docs: response alarmresponse 로 수정
swkim12345 Dec 4, 2024
5be5b32
🐛 fix: bigint가 런타임때는 string으로 작동, decimal 15,2로 변경
swkim12345 Dec 4, 2024
9671941
🐛 fix: stock id를 이상하게 호출하는 문제 해결, express 와 동일한 구조로 되어있어 라우터 등록 순서에 영…
swkim12345 Dec 4, 2024
9b66696
🐛 fix: put 에러 수정, alarmDate -\> alarmExpiredDate로 명확화
swkim12345 Dec 4, 2024
f574cec
📝 docs: reqeust 업데이트
swkim12345 Dec 4, 2024
fab01e2
🐛 fix: alarmDate 업데이트
swkim12345 Dec 4, 2024
fc21237
🐛 fix: alarmExpiredDate로 변환, 이에 맞춰 docs도 업데이트
swkim12345 Dec 4, 2024
660cd55
✨ feat: 알림 서비스 검증 로직 구현
swkim12345 Dec 4, 2024
56df4e4
📝 docs: 알림 docs 에러 수정
swkim12345 Dec 4, 2024
fec6e1b
🐛 fix: expired date 논리 오류 수정
swkim12345 Dec 4, 2024
9c9a66c
💄 style: merge from dev-be
swkim12345 Dec 4, 2024
5dcf2e4
📝 docs: 원 추가
swkim12345 Dec 4, 2024
7215b99
🐛 fix: api/alarm/stock 받아올 때 중복 stock 수정
swkim12345 Dec 4, 2024
0f29bba
Merge branch 'dev-be' into feature/#365
swkim12345 Dec 4, 2024
13a9617
📝 docs: swagger 성공하게 변경
swkim12345 Dec 4, 2024
570189b
💄 style: 줄 제약으로 인한 커스텀 데코레이터 적용
swkim12345 Dec 4, 2024
d892479
🐛 fix: response에 number 추가
swkim12345 Dec 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 5 additions & 27 deletions packages/backend/src/alarm/alarm.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import {
UseGuards,
} from '@nestjs/common';
import {
ApiBadRequestResponse,
ApiOkResponse,
ApiOperation,
ApiParam,
ApiResponse,
} from '@nestjs/swagger';
import { AlarmService } from './alarm.service';
import { WrongAlarmApi } from './decorator/wrong.decorator';
import { AlarmRequest } from './dto/alarm.request';
import { AlarmResponse, AlarmSuccessResponse } from './dto/alarm.response';
import SessionGuard from '@/auth/session/session.guard';
Expand All @@ -36,18 +36,7 @@ export class AlarmController {
description: '알림 생성 완료',
type: AlarmResponse,
})
@ApiBadRequestResponse({
description: '유효하지 않은 알람 입력값으로 인해 예외가 발생했습니다.',
schema: {
type: 'object',
properties: {
statusCode: { type: 'number', example: 400 },
message: { type: 'string', example: '알람 조건을 다시 확인해주세요.' },
error: { type: 'string', example: 'Bad Request' },
},
},
})
@UseGuards(SessionGuard)
@WrongAlarmApi()
async create(
@Body() alarmRequest: AlarmRequest,
@GetUser() user: User,
Expand Down Expand Up @@ -84,13 +73,13 @@ export class AlarmController {
type: [AlarmResponse],
})
@ApiParam({
name: 'id',
name: 'stockId',
type: String,
description: '주식 아이디',
example: '005930',
})
@UseGuards(SessionGuard)
async getByStockId(@Param('id') stockId: string, @GetUser() user: User) {
async getByStockId(@Param('stockId') stockId: string, @GetUser() user: User) {
const userId = user.id;

return await this.alarmService.findByStockId(stockId, userId);
Expand Down Expand Up @@ -131,18 +120,7 @@ export class AlarmController {
description: '알림 아이디',
example: 1,
})
@ApiBadRequestResponse({
description: '유효하지 않은 알람 입력값으로 인해 예외가 발생했습니다.',
schema: {
type: 'object',
properties: {
statusCode: { type: 'number', example: 400 },
message: { type: 'string', example: '알람 조건을 다시 확인해주세요.' },
error: { type: 'string', example: 'Bad Request' },
},
},
})
@UseGuards(SessionGuard)
@WrongAlarmApi()
async update(
@Param('id') alarmId: number,
@Body() updateData: AlarmRequest,
Expand Down
23 changes: 23 additions & 0 deletions packages/backend/src/alarm/decorator/wrong.decorator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { applyDecorators, UseGuards } from '@nestjs/common';
import { ApiBadRequestResponse } from '@nestjs/swagger';
import SessionGuard from '@/auth/session/session.guard';

export const WrongAlarmApi = () => {
return applyDecorators(
ApiBadRequestResponse({
description: '유효하지 않은 알람 입력값으로 인해 예외가 발생했습니다.',
schema: {
type: 'object',
properties: {
statusCode: { type: 'number', example: 400 },
message: {
type: 'string',
example: '알람 조건을 다시 확인해주세요.',
},
error: { type: 'string', example: 'Bad Request' },
},
},
}),
UseGuards(SessionGuard),
);
};
4 changes: 2 additions & 2 deletions packages/backend/src/alarm/dto/alarm.request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ export class AlarmRequest {

@ApiProperty({
description: '목표 가격',
example: 150.0,
example: 100000,
required: false,
})
targetPrice?: number;

@ApiProperty({
description: '목표 거래량',
example: 1000,
example: 1000000000,
required: false,
})
targetVolume?: number;
Expand Down
4 changes: 2 additions & 2 deletions packages/backend/src/alarm/dto/alarm.response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ export class AlarmResponse {
constructor(alarm: Alarm) {
this.alarmId = alarm.id;
this.stockId = alarm.stock.id;
this.targetPrice = alarm.targetPrice;
this.targetVolume = alarm.targetVolume;
this.targetPrice = Number(alarm.targetPrice);
this.targetVolume = Number(alarm.targetVolume);
this.alarmExpiredDate = alarm.alarmExpiredDate;
}
}
Expand Down
Loading