Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
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
1,147 changes: 777 additions & 370 deletions apps/server/docs/swagger.json

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions apps/server/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,16 @@ import { JwtCookieGuard } from './modules/auth/guard/jwt-cookie.guard'
import { MockAuthGuard } from './modules/auth/guard/mock-auth-guard'
import { CoursesModule } from './modules/courses/courses.module'
import { DepartmentsModule } from './modules/departments/departments.module'
import { DepartmentsModuleV2 } from './modules/departments/v2/departments.v2.module'
import { FeedsModule } from './modules/feeds/feeds.module'
import { LecturesModule } from './modules/lectures/lectures.module'
import { NoticesModule } from './modules/notices/notices.module'
import { PlannersModule } from './modules/planners/planners.module'
import { RatesModule } from './modules/rates/rates.module'
import { ReviewsModule } from './modules/reviews/reviews.module'
import { SchedulesModule } from './modules/schedules/schedules.module'
import { SemestersModule } from './modules/semesters/semesters.module'
import { SemestersModuleV2 } from './modules/semesters/v2/semesters.v2.module'
import { SessionModule } from './modules/session/session.module'
import { ShareModule } from './modules/share/share.module'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코드 패치를 검토한 결과 다음과 같은 몇 가지 우려사항이 있습니다:

  1. 의존성 관리: SchedulesModule을 추가하였는데, 이 모듈이 다른 모듈에 의존하는 경우가 발생할 수 있습니다. 모든 의존성이 올바르게 해결되었는지 확인해야 합니다.

  2. 테스트 부족: 새로운 모듈을 추가할 때, 해당 기능이 올바르게 동작하는지 확인하는 테스트가 필요합니다. 테스트가 없다면 새로운 모듈이 기존 기능과 충돌하는 위험이 있습니다.

  3. 주석 및 문서화 부족: 코드 변경 사항에 대해 설명하는 주석이 부족합니다. 특히 새로운 모듈을 도입하는 경우, 그에 대한 설명이나 목적을 추가하는 것이 좋습니다.

  4. 코드 일관성: 전체 코드베이스에서 모듈들을 임포트할 때 일관된 패턴을 유지하는 것이 중요합니다. 예를 들어, 모듈 간의 정렬이나 에러 처리 방식이统一되어 있는지 확인해야 합니다.

이러한 점들을 개선하면 코드 품질이 더욱 향상될 것입니다.

import { StatusModule } from './modules/status/status.module'
Expand Down Expand Up @@ -83,7 +86,9 @@ async function createCacheStoreWithFallback(): Promise<Keyv> {
LecturesModule,
ReviewsModule,
UserModule,
SchedulesModule,
SemestersModule,
SemestersModuleV2,
TimetablesModule,
TimetablesModuleV2,
RatesModule,
Expand All @@ -93,6 +98,7 @@ async function createCacheStoreWithFallback(): Promise<Keyv> {
NoticesModule,
SessionModule,
DepartmentsModule,
DepartmentsModuleV2,
PlannersModule,
TracksModule,
ShareModule,
Expand Down
6 changes: 0 additions & 6 deletions apps/server/src/common/interfaces/IDepartmentV2.ts

This file was deleted.

150 changes: 0 additions & 150 deletions apps/server/src/common/interfaces/ILectureV2.ts

This file was deleted.

6 changes: 0 additions & 6 deletions apps/server/src/common/interfaces/IProfessorV2.ts

This file was deleted.

8 changes: 8 additions & 0 deletions apps/server/src/common/interfaces/ISchedules.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export namespace ISchedules {
export interface Basic {
year: number
from: Date
to: Date
name: string
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 코드 패치에는 몇 가지 잠재적인 문제가 있습니다.

  1. 유효성 검사 부족: year, from, to, name 필드에 대한 유효성 검사 로직이 없습니다. 예를 들어, year는 음수일 수 없고, from 날짜는 to 날짜보다 이전이어야 합니다. 이러한 유효성 검사를 추가하는 것이 좋습니다.

  2. 날짜 처리: JavaScript의 Date 객체는 다양한 형식의 입력을 처리할 수 있지만, 다양한 브라우저 및 환경에서 일관되지 않은 동작을 할 수 있습니다. 날짜를 처리할 때는 Moment.js와 같은 라이브러리를 사용하여 일관성을 보장하는 것이 좋습니다.

  3. 네임스페이스 사용: 네임스페이스를 사용하는 것은 좋지만, ES6 모듈을 사용할 경우 불필요할 수 있습니다. 타입스크립트에서는 ES6 모듈 시스템을 활용하는 것이 더 현대적이고 선호됩니다.

  4. 주석 부족: 코드에 주석이 없기 때문에 다른 개발자가 이 코드의 목적을 이해하기 어렵습니다. 각 인터페이스와 필드에 대한 간단한 주석을 추가하는 것을 권장합니다.

이러한 문제를 해결하고 나면 코드가 더욱 견고하고 이해하기 쉬워질 것입니다.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코드 패치는 기본적으로 ISchedules.Basic 인터페이스를 정의하고 있으나, 몇 가지 잠재적 위험 요소와 개선 사항이 있습니다.

  1. 날짜 유효성: fromto 필드는 Date 객체로 정의되어 있지만, 실제로 유효한 날짜인지 확인하는 로직이 없습니다. 이를 검증하는 방법을 추가하는 것이 좋습니다.
  2. 범위 검사: from 날짜가 to 날짜보다 미래인 경우를 확인하는 로직이 필요할 수 있습니다. 이러한 유효성 검사가 없으면 데이터 무결성이 떨어질 수 있습니다.
  3. 문서화 부족: 인터페이스가 어떤 용도로 사용되는지에 대한 주석이나 설명이 없어서, 다른 개발자가 이 코드를 쉽게 이해하기 어렵습니다. 각 필드에 대한 주석을 추가해 주세요.

이러한 문제점을 해결하면 코드의 안정성과 가독성을 크게 향상시킬 수 있습니다.

5 changes: 1 addition & 4 deletions apps/server/src/common/interfaces/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
export * from './IAuth'
export * from './ICourse'
export * from './ICourseV2'
export * from './IDepartment'
export * from './IDepartmentV2'
export * from './IFeed'
export * from './ILecture'
export * from './ILectureV2'
export * from './INotice'
export * from './IPlanner'
export * from './IProfessor'
export * from './IProfessorV2'
export * from './IRate'
export * from './IReview'
export * from './ISchedules'
export * from './ISemester'
export * from './ISession'
export * from './IShare'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { ApiPropertyOptional } from '@nestjs/swagger'
import { IProfessorV2 } from '@otl/server-nest/common/interfaces/IProfessorV2'
import { Transform } from 'class-transformer'
import {
IsArray, IsIn, IsInt, IsNumber, IsOptional, IsString,
} from 'class-validator'

import { IDepartmentV2 } from './IDepartmentV2'
import { IProfessorV2 } from './IProfessorV2'

export type CourseOrderQuery = 'code' | 'popular' | 'studentCount'
export type level = 'ALL' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900'
Expand Down
6 changes: 6 additions & 0 deletions apps/server/src/common/interfaces/v2/IDepartmentV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,10 @@ export namespace IDepartmentV2 {
id: number
name: string
}

export interface Detail {
id: number
name: string
code: string
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 코드 패치는 타입스크립트 네임스페이스를 정의하고 있습니다. 다음과 같은 몇 가지 잠재적인 문제점과 개선 사항이 있습니다.

  1. 네임스페이스 사용: 현대의 타입스크립트 개발에서는 모듈 시스템을 선호합니다. 네임스페이스를 사용하는 대신, importexport를 활용하여 명확한 모듈 구조를 유지하는 것이 좋습니다.

  2. 인터페이스 명명 규칙: BasicResponse는 모호한 이름입니다. 더 구체적인 이름을 사용하여 코드의 가독성을 높이는 것이 좋습니다. 예를 들어, DepartmentBasicDepartmentResponse와 같은 네이밍이 바람직합니다.

  3. 프로퍼티의 타입: idname의 타입이 잘 정의되어 있지만, 향후 다른 타입 또는 추가 속성이 필요할 경우, 더욱 세분화된 타입 체계(예: 클래스나 다른 인터페이스)를 고려해볼 수 있습니다.

  4. 문서화 부족: 인터페이스에 대한 설명이 없습니다. 각 프로퍼티에 대한 주석을 추가하면 이해도를 높일 수 있습니다.

이러한 점들을 고려하여 코드를 수정하는 것이 바람직합니다.

Loading