Kaynağa Gözat

feat!: Merge schemas of module and module-history

Sean Blackburn 1 yıl önce
ebeveyn
işleme
00803b0cd8

+ 20 - 14
src/components/examples/api/modules/{module}/history.yaml

@@ -1,28 +1,34 @@
-- term: 12HS
-  revision: korr_8
+- pk: 5
+  name: oop1
+  revision_pk: 15
   weekday: 1
   weekday: 1
   class: 1Ia
   class: 1Ia
-  from: 45900
-  to: 54600
+  starts: 45900
+  ends: 54600
   lecturers:
   lecturers:
-    - Syn
-  teaching_type: on_site
+    - 12
+  lecture_type: on_site
   rooms:
   rooms:
     - "4.417"
     - "4.417"
   pages:
   pages:
     - 3
     - 3
-  pk: 1Ia-afana-1-45900-54600
-- term: 12HS
-  revision: korr_8
+  dates: []
+  course_pk: 1
+  module_execution_method: term_weekly
+- pk: 651
+  name: oop1
+  revision_pk: 16
   weekday: 1
   weekday: 1
   class: 1Ib
   class: 1Ib
-  from: 33000
-  to: 42300
+  starts: 33000
+  ends: 42300
   lecturers:
   lecturers:
-    - Syn
-  teaching_type: on_site
+    - 12
+  lecture_type: on_site
   rooms:
   rooms:
     - "4.427"
     - "4.427"
   pages:
   pages:
     - 4
     - 4
-  pk: 1Ib-afana-1-33000-42300
+  dates: []
+  course_pk: 1
+  module_execution_method: term_weekly

+ 2 - 0
src/components/examples/api/terms/{term}/index.yaml

@@ -1,4 +1,6 @@
 term: 24FS
 term: 24FS
+start_date: 1728175749
+end_date: 1728375749
 revisions:
 revisions:
   - korr_2
   - korr_2
   - korr_2_1
   - korr_2_1

+ 18 - 14
src/components/examples/api/terms/{term}/revisions/{revision}/lecture-series.yaml

@@ -1,32 +1,36 @@
-- weekday: 0
-  from: 29700
-  to: 64800
+- pk: 1
+  revision_pk: 1
+  weekday: 0
+  starts: 29700
+  ends: 64800
   class: 1Da
   class: 1Da
   name: dummy
   name: dummy
   rooms:
   rooms:
     - 5.3B51
     - 5.3B51
   lecturers:
   lecturers:
-    - Cur
-  teaching_type: on_site
+    - 14
+  lecture_type: on_site
   module_execution_method: term_weekly
   module_execution_method: term_weekly
   pages:
   pages:
     - 1
     - 1
-  course: Data Science
+  course_pk: 2
   part_of_other_classes: []
   part_of_other_classes: []
-  pk: 1Da-dummy-0-29700-64800
-- weekday: 1
-  from: 29700
-  to: 36000
+  dates: []
+- pk: 2
+  revision_pk: 1
+  weekday: 1
+  starts: 29700
+  ends: 36000
   class: 1Da
   class: 1Da
   name: eda
   name: eda
   rooms:
   rooms:
     - 5.3B51
     - 5.3B51
   lecturers:
   lecturers:
-    - Ped
-  teaching_type: on_site
+    - 10
+  lecture_type: on_site
   module_execution_method: term_weekly
   module_execution_method: term_weekly
   pages:
   pages:
     - 1
     - 1
-  course: Data Science
+  course_pk: 2
   part_of_other_classes: []
   part_of_other_classes: []
-  pk: 1Da-eda-1-29700-36000
+  dates: []

+ 3 - 1
src/components/responses/api/modules/{module}/history-get-200.yaml

@@ -2,6 +2,8 @@ description: OK
 content:
 content:
   application/json:
   application/json:
     schema:
     schema:
-      $ref: ../../../../schemas/api/module-history.yaml
+      type: array
+      items:
+        $ref: ../../../../schemas/api/lecture-series.yaml
     example:
     example:
       $ref: ../../../../examples/api/modules/{module}/history.yaml
       $ref: ../../../../examples/api/modules/{module}/history.yaml

+ 21 - 19
src/components/schemas/api/lecture-series.yaml

@@ -2,16 +2,17 @@ type: object
 description: Single lecture series definition of a specific revision
 description: Single lecture series definition of a specific revision
 properties:
 properties:
   pk:
   pk:
-    description: A unique ID for this module and the time it is taught
-    type: string
+    $ref: ../common/pk.yaml
+  revision_pk:
+    $ref: ../relations/term-revision.yaml
   weekday:
   weekday:
     description: The weekday the module took place on
     description: The weekday the module took place on
     $ref: ../../enums/weekday.yaml
     $ref: ../../enums/weekday.yaml
-  from:
+  starts:
     description: Start time of the module, in seconds since midnight
     description: Start time of the module, in seconds since midnight
     type: integer
     type: integer
     format: u32
     format: u32
-  to:
+  ends:
     description: End time of the module, in seconds since midnight
     description: End time of the module, in seconds since midnight
     type: integer
     type: integer
     format: u32
     format: u32
@@ -20,42 +21,44 @@ properties:
     type: string
     type: string
   name:
   name:
     description: Short name of the module
     description: Short name of the module
+    type: string
   rooms:
   rooms:
     description: List of rooms reserved for this module
     description: List of rooms reserved for this module
     type: array
     type: array
     items:
     items:
+      description: Name / room identifier
       type: string
       type: string
   lecturers:
   lecturers:
     description: List of lecturers teaching this module
     description: List of lecturers teaching this module
     type: array
     type: array
     items:
     items:
-      type: string
-  teaching_type:
-    description: The type of teaching
+      $ref: ../relations/lecturer.yaml
+  lecture_type:
     $ref: ../../enums/teaching-type.yaml
     $ref: ../../enums/teaching-type.yaml
   module_execution_method:
   module_execution_method:
     $ref: ../../enums/module-execution-type.yaml
     $ref: ../../enums/module-execution-type.yaml
   pages:
   pages:
     description: List of pages, on which the module can be found in the PDF
     description: List of pages, on which the module can be found in the PDF
     type: array
     type: array
+    default: []
     items:
     items:
+      description: Page number, starting at 1 for the 1st page
       type: integer
       type: integer
       format: u16
       format: u16
-  course:
-    description: Name of the course this module is part of
-    type: string
+  course_pk:
+    $ref: ../relations/course.yaml
   part_of_other_classes:
   part_of_other_classes:
     description: List of other classes, where this module is also taught
     description: List of other classes, where this module is also taught
     type: array
     type: array
+    default: []
     items:
     items:
       type: string
       type: string
   dates:
   dates:
     description: |
     description: |
       List of specific dates, when the lectures are held. This is used for
       List of specific dates, when the lectures are held. This is used for
       block lectures and not regular lectures.
       block lectures and not regular lectures.
-    type:
-      - array
-      - "null"
+    type: array
+    default: []
     items:
     items:
       type: object
       type: object
       properties:
       properties:
@@ -71,15 +74,14 @@ properties:
         - start
         - start
         - end
         - end
 required:
 required:
+  - revision_pk
   - weekday
   - weekday
-  - from
-  - to
+  - starts
+  - ends
   - class
   - class
   - name
   - name
   - rooms
   - rooms
   - lecturers
   - lecturers
-  - teaching_type
+  - lecture_type
   - module_execution_method
   - module_execution_method
-  - pages
-  - course
-  - part_of_other_classes
+  - course_pk

+ 0 - 59
src/components/schemas/api/module-history.yaml

@@ -1,59 +0,0 @@
-description: History of past lecture series of this module
-type: array
-items:
-  type: object
-  properties:
-    term:
-      description: The term this module took place in
-      type: string
-    revision:
-      description: The revision of the term plan
-      type: string
-    weekday:
-      description: The weekday the module took place on
-      $ref: ../../enums/weekday.yaml
-    class:
-      description: Name of the class this module is part of
-      type: string
-    from:
-      description: Start time of the module, in seconds since midnight
-      type: integer
-      format: u32
-    to:
-      description: End time of the module, in seconds since midnight
-      type: integer
-      format: u32
-    lecturers:
-      description: List of lecturers teaching this module
-      type: array
-      items:
-        type: string
-    teaching_type:
-      description: The type of teaching
-      $ref: ../../enums/teaching-type.yaml
-    rooms:
-      description: List of rooms reserved for this module
-      type: array
-      items:
-        type: string
-    pages:
-      description: List of pages, on which the module can be found in the PDF
-      type: array
-      items:
-        type: integer
-        format: u16
-    pk:
-      description: A unique ID for this module and the time it is taught
-      type: string
-  required:
-    - term
-    - revision
-    - weekday
-    - class
-    - from
-    - to
-    - lecturers
-    - teaching_type
-    - rooms
-    - pages
-    - pk

+ 3 - 0
src/components/schemas/relations/lecturer.yaml

@@ -0,0 +1,3 @@
+description: Lecturer PK
+type: integer
+format: u32