Skip to content

Commit

Permalink
feat: modify loginId type (#105)
Browse files Browse the repository at this point in the history
* feat: modify loginId type

* feat: modify loginId type 2

* chore: 엑셀양식 참고사항 수정

---------

Co-authored-by: hynseok <wefwef12e@naver.com>
  • Loading branch information
R3gardless and hynseok authored Apr 18, 2024
1 parent ac5e321 commit d8f6f0d
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions src/modules/professors/dtos/professor.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class ProfessorDto {
@ApiProperty({ description: "아이디" })
@Type(() => Number)
id: number;
@ApiProperty({ description: "내선번호" })
@ApiProperty({ description: "로그인 아이디" })
@Type(() => String)
loginId: string;
@ApiProperty({ description: "이름" })
Expand All @@ -43,7 +43,7 @@ export class ProfessorDto {

converDtoToExcelRecord() {
return {
내선번호: this.loginId,
로그인아이디: this.loginId,
이름: this.name,
이메일: this.email,
연락처: this.phone,
Expand Down
4 changes: 2 additions & 2 deletions src/modules/professors/dtos/professors-list-query.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { PageQuery } from "src/common/dtos/pagination.dto";

export class ProfessorListPaginationQuery extends PageQuery {
// 다중 상속이 안됨....
@ApiProperty({ description: "아이디", required: false })
@ApiProperty({ description: "로그인 아이디", required: false })
@IsOptional()
@IsNotEmpty()
@Type(() => String)
Expand Down Expand Up @@ -39,7 +39,7 @@ export class ProfessorListPaginationQuery extends PageQuery {
}

export class ProfessorListQuery {
@ApiProperty({ description: "아이디", required: false })
@ApiProperty({ description: "로그인 아이디", required: false })
@IsOptional()
@IsNotEmpty()
@Type(() => String)
Expand Down
4 changes: 2 additions & 2 deletions src/modules/professors/dtos/upload-professor.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import { IsKoreanPhoneNumber } from "src/common/decorators/is-kr-phone-number.de

export class UploadProfessorDto {
constructor(excelRecord) {
this.loginId = excelRecord["내선번호"].toString();
this.loginId = excelRecord["로그인아이디"].toString();
this.name = excelRecord["이름"];
this.password = excelRecord["비밀번호"] ? excelRecord["비밀번호"].toString() : undefined;
this.email = excelRecord["이메일"] ? excelRecord["이메일"].toString() : undefined;
this.phone = excelRecord["연락처"] ? excelRecord["연락처"].toString() : undefined;
this.departmentName = excelRecord["학과"];
}

@ApiProperty({ description: "내선번호" })
@ApiProperty({ description: "로그인 아이디" })
@Type(() => String)
loginId: string;

Expand Down
22 changes: 11 additions & 11 deletions src/modules/students/students.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,50 +291,50 @@ export class StudentsService {
}
}

// 교수들 내선번호 > Id로 변경
// 교수들 로그인아이디 > Id로 변경
let advisor1Id: number,
advisor2Id: number,
committee1Id: number,
committee2Id: number,
headReviewerId: number;
if (advisor1) {
const foundProfessor = await this.prismaService.user.findUnique({
where: { loginId: advisor1, type: UserType.PROFESSOR, deletedAt: null }, // 내선번호 사용
where: { loginId: advisor1, type: UserType.PROFESSOR, deletedAt: null }, // 로그인 아이디 사용
});
if (!foundProfessor)
throw new BadRequestException(`${index + 2}행 : 교수 내선번호 ${advisor1}를 확인하십시오.`);
throw new BadRequestException(`${index + 2}행 : 교수 로그인 아이디 ${advisor1}를 확인하십시오.`);
advisor1Id = foundProfessor.id;
}
if (advisor2) {
const foundProfessor = await this.prismaService.user.findUnique({
where: { loginId: advisor2, type: UserType.PROFESSOR, deletedAt: null }, // 내선번호 사용
where: { loginId: advisor2, type: UserType.PROFESSOR, deletedAt: null }, // 로그인 아이디 사용
});
if (!foundProfessor)
throw new BadRequestException(`${index + 2}행 : 교수 내선번호 ${advisor2}를 확인하십시오.`);
throw new BadRequestException(`${index + 2}행 : 교수 로그인 아이디 ${advisor2}를 확인하십시오.`);
advisor2Id = foundProfessor.id;
}
if (committee1) {
const foundProfessor = await this.prismaService.user.findUnique({
where: { loginId: committee1, type: UserType.PROFESSOR, deletedAt: null }, // 내선번호 사용
where: { loginId: committee1, type: UserType.PROFESSOR, deletedAt: null }, // 로그인 아이디 사용
});
if (!foundProfessor)
throw new BadRequestException(`${index + 2}행 : 교수 내선번호 ${committee1}를 확인하십시오.`);
throw new BadRequestException(`${index + 2}행 : 교수 로그인 아이디 ${committee1}를 확인하십시오.`);
committee1Id = foundProfessor.id;
}
if (committee2) {
const foundProfessor = await this.prismaService.user.findUnique({
where: { loginId: committee2, type: UserType.PROFESSOR, deletedAt: null }, // 내선번호 사용
where: { loginId: committee2, type: UserType.PROFESSOR, deletedAt: null }, // 로그인 아이디 사용
});
if (!foundProfessor)
throw new BadRequestException(`${index + 2}행 : 교수 내선번호 ${committee2}를 확인하십시오.`);
throw new BadRequestException(`${index + 2}행 : 교수 로그인 아이디 ${committee2}를 확인하십시오.`);
committee2Id = foundProfessor.id;
}
if (headReviewer) {
const foundProfessor = await this.prismaService.user.findUnique({
where: { loginId: headReviewer, type: UserType.PROFESSOR, deletedAt: null }, // 내선번호 사용
where: { loginId: headReviewer, type: UserType.PROFESSOR, deletedAt: null }, // 로그인 아이디 사용
});
if (!foundProfessor)
throw new BadRequestException(`${index + 2}행 : 교수 내선번호 ${headReviewer}를 확인하십시오.`);
throw new BadRequestException(`${index + 2}행 : 교수 로그인 아이디 ${headReviewer}를 확인하십시오.`);
headReviewerId = foundProfessor.id;
}

Expand Down

0 comments on commit d8f6f0d

Please sign in to comment.