feat: add the bm:seed command
Validates a whole JSON file (course keys, meeting numbers, values, dates) and upserts meetings, courses, class sessions, deadlines and readings in one transaction, matched on their natural identity. Prints a created, updated and unchanged summary; --dry-run only validates. Ships a small example fixture with made-up data.
This commit is contained in:
24
testdata/seed.example.json
vendored
Normal file
24
testdata/seed.example.json
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"meetings": [
|
||||
{"number": 1, "starts_on": "2030-10-05", "ends_on": "2030-10-06", "notes": "przykład"},
|
||||
{"number": 2, "starts_on": "2030-10-19", "ends_on": "2030-10-20"}
|
||||
],
|
||||
"courses": [
|
||||
{"key": "a-w", "code": null, "name": "Przedmiot przykładowy A", "form": "wyklad", "lecturer": "dr Jan Przykładowy", "semester": 1, "ects": 4, "assessment": "egzamin", "elective_group": null, "description": null, "syllabus_url": null, "sort_order": 1},
|
||||
{"key": "a-c", "name": "Przedmiot przykładowy A", "form": "cwiczenia", "semester": 1, "ects": 2.5, "assessment": "zaliczenie na ocenę", "sort_order": 2},
|
||||
{"key": "b-k", "name": "Przedmiot przykładowy B", "form": "konwersatorium", "semester": 1, "elective_group": "przyklad-do-wyboru", "sort_order": 3}
|
||||
],
|
||||
"class_sessions": [
|
||||
{"course": "a-w", "meeting": 1, "starts_at": "2030-10-05T08:00:00+02:00", "ends_at": "2030-10-05T09:30:00+02:00", "room": "101", "kind": null, "is_online": false, "notes": "dr Jan Przykładowy"},
|
||||
{"course": "a-c", "meeting": 1, "starts_at": "2030-10-05T09:45:00+02:00", "ends_at": "2030-10-05T11:15:00+02:00", "room": "102"},
|
||||
{"course": "b-k", "meeting": 2, "starts_at": "2030-10-19T08:00:00+02:00", "ends_at": "2030-10-19T09:30:00+02:00", "is_online": true}
|
||||
],
|
||||
"deadlines": [
|
||||
{"title": "Termin przykładowy", "due_at": "2030-10-07T23:59:00+02:00", "course": null, "kind": "organizacyjne", "description": null},
|
||||
{"title": "Esej przykładowy", "due_at": "2030-11-30T23:59:00+01:00", "course": "a-c", "kind": "praca"}
|
||||
],
|
||||
"readings": [
|
||||
{"course": "a-w", "title": "Lektura przykładowa 1", "author": "A. Autor", "source": null, "url": null, "is_required": true, "sort_order": 1},
|
||||
{"course": "a-w", "title": "Lektura przykładowa 2", "is_required": false, "sort_order": 2}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user