Skip to content

Commit

Permalink
Merge pull request #72 from boostcampwm-2022/feat/recruit
Browse files Browse the repository at this point in the history
feat: hCode ๋ฐ ์ „์ฒด ๋ชฉ๋ก ์กฐํšŒ API ์ˆ˜์ •์‚ฌํ•ญ ๋ฐ˜์˜
  • Loading branch information
claycat authored Nov 24, 2022
2 parents 6b75e35 + 0ce2df9 commit 21d83f5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
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 @@ -13,11 +13,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 @@ -21,12 +21,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 @@ -35,13 +37,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

0 comments on commit 21d83f5

Please sign in to comment.