Skip to content

feat(web): import a single assignment from YAML#103

Merged
obcode merged 1 commit into
mainfrom
feat/web-import-assignment
Jul 18, 2026
Merged

feat(web): import a single assignment from YAML#103
obcode merged 1 commit into
mainfrom
feat/web-import-assignment

Conversation

@obcode

@obcode obcode commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Beantwortet die Frage „kann ich einzelne Assignments nicht importieren?" — jetzt ja.

Neue Mutation importAssignmentYAML(course, yaml): fügt ein einzelnes Assignment per Upsert in einen bestehenden Kurs ein, aus einem YAML-Schnipsel in derselben Form wie in einer Kurs-Datei (der oberste Schlüssel ist der Assignment-Name). So lässt sich ein Block direkt aus einer Kurs-YAML kopieren, statt den ganzen Kurs neu zu importieren.

Was drin ist

  • app.ImportAssignmentYAML: merged den Block in den gespeicherten Kurs-Body, dekodiert den ganzen Kurs über config.DecodeCourseBody, lehnt inline signKeys ab, validiert das Assignment über den echten Resolver (ein konkretes, nicht auflösbares wird abgelehnt; eine abstrakte Basis ist ok) und persistiert — mit Neu-Marshalling der Kurs-YAML, genau wie setAssignment.
  • graph: importAssignmentYAML-Mutation + Resolver.
  • Tests: Upsert lässt bestehende Assignments unangetastet; lehnt mehrere Top-Level-Schlüssel und ungültige Namen ab.

GraphQL

importAssignmentYAML(course: String!, yaml: String!): AssignmentView!

Verifikation (lokal grün)

go build, go vet (+ integration), go test ./..., golangci-lint — alle sauber.

Danach: GUI-PR mit einem „Assignment aus YAML importieren"-Feld auf der Kursseite.

🤖 Generated with Claude Code

Add importAssignmentYAML(course, yaml): upsert one assignment into an existing
course from a YAML snippet in the same keyed form it has in a course file (the
single top-level key is the assignment name), so a block can be copy-pasted
straight out of a course YAML instead of re-importing the whole course.

- app.ImportAssignmentYAML merges the block into the stored course body, decodes
  the whole course via config.DecodeCourseBody, rejects inline signKeys, validates
  the assignment against the real resolver (a concrete one that does not resolve
  is rejected; an abstract base is fine), then persists — re-marshalling the
  course YAML, exactly like SetAssignment.
- graph: importAssignmentYAML mutation + resolver.
- tests: upsert keeps existing assignments; rejects multiple top-level keys and
  invalid names.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@obcode
obcode merged commit 853258d into main Jul 18, 2026
8 checks passed
@obcode
obcode deleted the feat/web-import-assignment branch July 18, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant