Skip to content
This repository has been archived by the owner on Jul 18, 2022. It is now read-only.

Commit

Permalink
Merge pull request #38 from rmagur1203/develop
Browse files Browse the repository at this point in the history
edit schedule loader
  • Loading branch information
rmagur1203 authored Mar 30, 2022
2 parents 58a53cf + c9d888c commit 0dc5255
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/entities/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ export class UserEntity {
@Column({ type: 'int', default: 0, nullable: false })
accountType: number;

@Column({ type: 'bigint', default: 0, nullable: false })
role: number;

@Column({ length: 200, nullable: true, select: false })
refreshToken: string;

Expand Down
24 changes: 24 additions & 0 deletions src/modules/neis/SchoolSchedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,30 @@ export class SchoolSchedule {
reqParams.AA_TO_YMD = end.toFormat('yyyyMM');
return await this.fetchJSON(defParams, reqParams);
}
async fetchByMonthFullRange(
defParams: DefaultParameter,
reqParams: SchoolScheduleParameter,
start: DateTime | Date,
end: DateTime | Date
) {
if (start instanceof Date) start = DateTime.fromJSDate(start);
if (end instanceof Date) end = DateTime.fromJSDate(end);
reqParams.AA_FROM_YMD = start.startOf('month').toFormat('yyyyMMdd');
reqParams.AA_TO_YMD = end.endOf('month').toFormat('yyyyMMdd');
return await this.fetchJSON(defParams, reqParams);
}
async fetchByRange(
defParams: DefaultParameter,
reqParams: SchoolScheduleParameter,
start: DateTime | Date,
end: DateTime | Date
) {
if (start instanceof Date) start = DateTime.fromJSDate(start);
if (end instanceof Date) end = DateTime.fromJSDate(end);
reqParams.AA_FROM_YMD = start.toFormat('yyyyMMdd');
reqParams.AA_TO_YMD = end.toFormat('yyyyMMdd');
return await this.fetchJSON(defParams, reqParams);
}
/**
* 학사일정
* @param defParams 기본 인자
Expand Down
2 changes: 1 addition & 1 deletion src/modules/synchronizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class NeisOpenAPI {
static async SchoolSchedule(start: DateTime, end: DateTime) {
const scheduleRepository =
Container.get<Repository<ScheduleEntity>>(ScheduleEntity);
const result = await this.parser.fetchByMonthRange(
const result = await this.parser.fetchByRange(
DefaultParameterPreset,
{
SD_SCHUL_CODE: '',
Expand Down

0 comments on commit 0dc5255

Please sign in to comment.