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

feat: hCode 및 전체 목록 조회 API 수정사항 반영 #72

Merged
merged 1 commit into from
Nov 24, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 3 additions & 1 deletion server/src/common/type/raw-recruit-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ export interface RawRecruitData {
course_img: string;
course_path: string;
course_pathLength: number;
course_hCode: string;
course_name: string;
course_createdAt: Date;
id: number;
title: string;
startTime: Date;
maxPpl: number;
currentPpl: string;
userId: number;
createdAt: Date;
}
4 changes: 2 additions & 2 deletions server/src/entities/recruit.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class Recruit {
pace: number;

@Column({ type: "varchar", length: 10 })
hCode: string;
name: string;

@CreateDateColumn()
createdAt: Date;
Expand Down Expand Up @@ -69,7 +69,7 @@ export class Recruit {
recruit.startTime = startTime;
recruit.maxPpl = maxPpl;
recruit.pace = pace;
recruit.hCode = hCode;
recruit.name = hCode;
recruit.userId = userId;
recruit.courseId = courseId;
return recruit;
Expand Down
3 changes: 3 additions & 0 deletions server/src/recruit/recruit.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ export class RecruitRepository extends Repository<Recruit> {
return this.createQueryBuilder("recruit")
.innerJoinAndSelect("recruit.course", "course")
.leftJoinAndSelect("recruit.userRecruits", "user_recruit")
.innerJoinAndSelect("recruit.user", "user")
.select([
"recruit.id AS id",
"recruit.title AS title",
"recruit.startTime AS startTime",
"recruit.maxPpl AS maxPpl",
"recruit.createdAt AS createdAt",
"user.userId AS userId",
"COUNT(user_recruit.id) AS currentPpl",
"course.id",
"course.title",
Expand Down
10 changes: 8 additions & 2 deletions server/src/recruit/recruit.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ export class RecruitService {
startTime,
maxPpl,
currentPpl,
createdAt,
userId,
course_id,
course_title,
course_img,
course_path,
course_pathLength,
course_hCode,
course_name,
course_createdAt,
}) => {
return {
Expand All @@ -34,13 +36,17 @@ export class RecruitService {
startTime,
maxPpl,
currentPpl: parseInt(currentPpl),
userId,
createdAt,
course: {
id: course_id,
title: course_title,
img: course_img,
path: JSON.parse(course_path),
pathLength: course_pathLength,
hCode: course_hCode,
hDong: {
course_name,
},
createdAt: course_createdAt,
},
};
Expand Down