Эх сурвалжийг харах

feat!: Merge schemas of module and module-history

Sean Blackburn 1 жил өмнө
parent
commit
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
   class: 1Ia
-  from: 45900
-  to: 54600
+  starts: 45900
+  ends: 54600
   lecturers:
-    - Syn
-  teaching_type: on_site
+    - 12
+  lecture_type: on_site
   rooms:
     - "4.417"
   pages:
     - 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
   class: 1Ib
-  from: 33000
-  to: 42300
+  starts: 33000
+  ends: 42300
   lecturers:
-    - Syn
-  teaching_type: on_site
+    - 12
+  lecture_type: on_site
   rooms:
     - "4.427"
   pages:
     - 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
+start_date: 1728175749
+end_date: 1728375749
 revisions:
   - korr_2
   - 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
   name: dummy
   rooms:
     - 5.3B51
   lecturers:
-    - Cur
-  teaching_type: on_site
+    - 14
+  lecture_type: on_site
   module_execution_method: term_weekly
   pages:
     - 1
-  course: Data Science
+  course_pk: 2
   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
   name: eda
   rooms:
     - 5.3B51
   lecturers:
-    - Ped
-  teaching_type: on_site
+    - 10
+  lecture_type: on_site
   module_execution_method: term_weekly
   pages:
     - 1
-  course: Data Science
+  course_pk: 2
   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:
   application/json:
     schema:
-      $ref: ../../../../schemas/api/module-history.yaml
+      type: array
+      items:
+        $ref: ../../../../schemas/api/lecture-series.yaml
     example:
       $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
 properties:
   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:
     description: The weekday the module took place on
     $ref: ../../enums/weekday.yaml
-  from:
+  starts:
     description: Start time of the module, in seconds since midnight
     type: integer
     format: u32
-  to:
+  ends:
     description: End time of the module, in seconds since midnight
     type: integer
     format: u32
@@ -20,42 +21,44 @@ properties:
     type: string
   name:
     description: Short name of the module
+    type: string
   rooms:
     description: List of rooms reserved for this module
     type: array
     items:
+      description: Name / room identifier
       type: string
   lecturers:
     description: List of lecturers teaching this module
     type: array
     items:
-      type: string
-  teaching_type:
-    description: The type of teaching
+      $ref: ../relations/lecturer.yaml
+  lecture_type:
     $ref: ../../enums/teaching-type.yaml
   module_execution_method:
     $ref: ../../enums/module-execution-type.yaml
   pages:
     description: List of pages, on which the module can be found in the PDF
     type: array
+    default: []
     items:
+      description: Page number, starting at 1 for the 1st page
       type: integer
       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:
     description: List of other classes, where this module is also taught
     type: array
+    default: []
     items:
       type: string
   dates:
     description: |
       List of specific dates, when the lectures are held. This is used for
       block lectures and not regular lectures.
-    type:
-      - array
-      - "null"
+    type: array
+    default: []
     items:
       type: object
       properties:
@@ -71,15 +74,14 @@ properties:
         - start
         - end
 required:
+  - revision_pk
   - weekday
-  - from
-  - to
+  - starts
+  - ends
   - class
   - name
   - rooms
   - lecturers
-  - teaching_type
+  - lecture_type
   - 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