-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ad16f8b
commit 26cc890
Showing
24 changed files
with
203 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,3 @@ const ENV = { | |
}; | ||
|
||
export default ENV; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import ENV from "./env"; | ||
import ENV from "./env"; | ||
|
||
const ERRORS = { | ||
INVALID_COOKIE: new Error(`Invalid Cookie (Php Session Id) '${ENV.PHPSESSID}'`) | ||
} | ||
INVALID_COOKIE: new Error(`Invalid Cookie (Php Session Id) '${ENV.PHPSESSID}'`), | ||
}; | ||
|
||
export default ERRORS; | ||
export default ERRORS; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,3 @@ | ||
const WEEK_DAYS_NAME = [ | ||
'Monday', | ||
'Tuesday', | ||
'Wednesday', | ||
'Thursday', | ||
'Friday', | ||
'Saturday', | ||
'Sunday' | ||
]; | ||
const WEEK_DAYS_NAME = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]; | ||
|
||
export default WEEK_DAYS_NAME; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
import { ERRORS } from "./constants"; | ||
import {ERRORS} from "./constants"; | ||
import Worker from "./lib/worker"; | ||
import TimetableRepository from "./lib/TimetableRepository"; | ||
import { logOnCrawlTimetable } from "./lib/logger"; | ||
import {logOnCrawlTimetable} from "./lib/logger"; | ||
|
||
new Worker() | ||
|
||
.onCrawlMetaData(({metaData, timeTableRequestPayloads}) => { | ||
if(timeTableRequestPayloads.length == 0) throw ERRORS.INVALID_COOKIE; | ||
TimetableRepository.writeMetaData(metaData) | ||
}) | ||
.onCrawlMetaData(({metaData, timeTableRequestPayloads}) => { | ||
if (timeTableRequestPayloads.length == 0) throw ERRORS.INVALID_COOKIE; | ||
TimetableRepository.writeMetaData(metaData); | ||
}) | ||
|
||
.onCrawlTimetable(logOnCrawlTimetable) | ||
.onCrawlTimetable(logOnCrawlTimetable) | ||
|
||
.onFinish((allTimetables) => TimetableRepository | ||
.writeTimetables(allTimetables) | ||
.writeTeachersTimetable(allTimetables) | ||
.writeRoomsTimetable(allTimetables) | ||
) | ||
.onFinish((allTimetables) => | ||
TimetableRepository.writeTimetables(allTimetables) | ||
.writeTeachersTimetable(allTimetables) | ||
.writeRoomsTimetable(allTimetables) | ||
) | ||
|
||
.start(); | ||
.start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import TimetableDocType from "../types/TimetableDocType"; | ||
import pc from "picocolors" | ||
import pc from "picocolors"; | ||
|
||
export function logOnCrawlTimetable(timetable: TimetableDocType) { | ||
console.log(`🎯 ${pc.cyan('successfully crawled')} ${pc.magenta(timetable.uid)}`) | ||
console.log(`🎯 ${pc.cyan("successfully crawled")} ${pc.magenta(timetable.uid)}`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
import initLocalDB from "./initDB"; | ||
import { writeDB } from "./writeDB"; | ||
import { readDB } from "./readDB"; | ||
import {writeDB} from "./writeDB"; | ||
import {readDB} from "./readDB"; | ||
|
||
initLocalDB(); | ||
|
||
export { | ||
writeDB, readDB | ||
} | ||
|
||
export {writeDB, readDB}; |
Oops, something went wrong.