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

add GraphQL documentation (except computation) #101

Open
wants to merge 3 commits into
base: beta
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion src/common/scalars/date.scalar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { Kind, ValueNode } from 'graphql'

@Scalar('Date')
export class DateScalar implements CustomScalar<string, Date> {
description = 'Date custom scalar type'
description =
'Date custom scalar type, for (de)serializing Date values from/to ISO8601 representation.'

parseValue(value: string): Date {
return new Date(value) // value from the client
Expand Down
36 changes: 18 additions & 18 deletions src/computation/computation.graphql
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
type Query {
recommend(req: CourseRecommendationRequest!): CourseRecommendationResponse!
recommend(req: CourseRecommendationRequest!): CourseRecommendationResponse!
}

input CourseEntryInput {
courseId: String!
studyProgram: String!
courseId: String!
studyProgram: String!
}

type CourseEntry {
courseId: String!
studyProgram: String!
courseId: String!
studyProgram: String!
}

input CourseRecommendationRequest {
variant: String!
semesterKey: CourseGroupInput!
selectedCourses: [CourseKeyInput!]!
variant: String!
semesterKey: CourseGroupInput!
selectedCourses: [CourseKeyInput!]!
}

input CourseKeyInput {
courseNo: String!
semesterKey: CourseGroupInput!
courseNo: String!
semesterKey: CourseGroupInput!
}

type SemesterKey {
studyProgram: String!
semester: String!
academicYear: String!
studyProgram: String!
semester: String!
academicYear: String!
}

type CourseKey {
courseNo: String!
semesterKey: SemesterKey!
courseNo: String!
semesterKey: SemesterKey!
}

type CourseDetail {
key: CourseKey!
courseNameEn: String!
key: CourseKey!
courseNameEn: String!
}

type CourseRecommendationResponse {
courses: [CourseDetail!]!
courses: [CourseDetail!]!
}
59 changes: 39 additions & 20 deletions src/course/course.enum.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,58 @@ enum DayOfWeek {
FR
SA
SU

"""
Individually Arranged (Different for each student)
"""
IA

"""
To be Arranged (Faculty will announce later)
"""
AR
}

enum StudyProgram {
"""
Semester
"""
S

"""
Trimester
"""
T
I
}

enum ClassType {
LECT
LAB
DISC
FWK
PRAC
IDPS
SMNA
STU
"L/T"
IA
OTHER
IDVS
AR
CLIN
TUT
REFL
"""
International
"""
I
}

enum GenEdType {
"""
Social Science
"""
SO
SC

"""
Humanities
"""
HU

"""
Science-Mathematics
"""
SC

"""
Interdisciplinary
"""
IN

"""
Not GenEd
"""
NO
}
66 changes: 65 additions & 1 deletion src/course/course.graphql
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
"""
Pair of start and end time. Format is `HH:MM`.
"""
type Period {
start: String!
end: String!
}

"""
Pair of exam date and period.
"""
type ExamPeriod {
"""
Date of the exam. The value is formatted as ISO8601 representation: `YYYY-MM-DDT00:00:00.000Z`.
"""
date: String!
period: Period!
}
Expand All @@ -28,6 +37,9 @@ type Section {
capacity: Capacity!
note: String
classes: [Class!]!
"""
`GenEdType` of this section. If this section is not a GenEd section, the value will be `NO`.
"""
genEdType: GenEdType!
}

Expand All @@ -49,6 +61,9 @@ type Course {
credit: Float!
creditHours: String!
courseCondition: String!
"""
`GenEdType` of this course. If this course is not a GenEd course, the value will be `NO`.
"""
genEdType: GenEdType!

# Exam
Expand All @@ -66,34 +81,83 @@ type Course {
@deprecated(reason: "Use courseDescTh or courseDescEn instead")
}

"""
Filter for searching courses that have class inside the given time period.
"""
input PeriodRangeInput {
start: String!
end: String!
}

"""
Filters for searching courses. If a filter is not specified, it will not be used in the search.
"""
input FilterInput {
"""
Keyword to search for courses. This filter is passed IF any of `courseNo`, `abbrName`,
`courseNameTh`, or `courseNameEn` contains the keyword as a substring (except for `courseNo`
which checks if value **starts with** the keyword).
"""
keyword: String

"""
List of `GenEdTypes`. This filter is passed IF the course's `genEdType` matches ANY of the `genEdTypes` in the list.
"""
genEdTypes: [GenEdType!]

"""
List of `DayOfWeeks`. This filter is passed IF ANY of the course's sections have class in ANY of the `dayOfWeeks` in the list.
"""
dayOfWeeks: [DayOfWeek!]

"""
Range of the classes' period. This filter is passed IF ANY of the course's sections
have class that intersects with the `periodRange`.
"""
periodRange: PeriodRangeInput

"""
Number of courses to return in this query. Used for pagination.
"""
limit: Int

"""
Number of courses to skip through. Used for pagination.
"""
offset: Int
periodRange: PeriodRangeInput
}

"""
Combination of `semester`, `academicYear`, and `studyProgram`. Used to differentiate courses between time periods and program.
"""
input CourseGroupInput {
semester: String!
academicYear: String!
studyProgram: StudyProgram!
}

"""
List of all course nos. in all `studyPrograms`.
"""
type CourseNosOutput {
S: [String!]!
T: [String!]!
I: [String!]!
}

type Query {
"""
Returns a list of all course nos.
"""
courseNos: CourseNosOutput

"""
Find a course and returns it
"""
course(courseNo: String!, courseGroup: CourseGroupInput!): Course!

"""
Search courses using the given course filters. Supports pagination with limit and offset fields in `FilterInput`.
"""
search(filter: FilterInput!, courseGroup: CourseGroupInput!): [Course!]!
}
Loading