1
This commit is contained in:
+9
-1
@@ -8,7 +8,7 @@ from fastapi.responses import FileResponse, PlainTextResponse
|
||||
|
||||
from backend.app.config import settings
|
||||
from backend.app.managers.knowledge_manager import DuplicateSourceError, KnowledgeManager
|
||||
from backend.app.models.schemas import MarkdownUpdate, SubjectCreate, WeekCreate, WeekUpdate
|
||||
from backend.app.models.schemas import MarkdownUpdate, SubjectCreate, SubjectUpdate, WeekCreate, WeekUpdate
|
||||
from backend.app.services.ingestion_service import IngestionService
|
||||
|
||||
app = FastAPI(title="Knowledge Station", version="0.1.0")
|
||||
@@ -60,6 +60,14 @@ def get_subject(subject_id: int) -> dict:
|
||||
raise HTTPException(status_code=404, detail=str(exc)) from exc
|
||||
|
||||
|
||||
@app.put("/subjects/{subject_id}")
|
||||
def update_subject(subject_id: int, payload: SubjectUpdate) -> dict:
|
||||
try:
|
||||
return manager.update_subject(subject_id, payload.name)
|
||||
except ValueError as exc:
|
||||
raise HTTPException(status_code=400, detail=str(exc)) from exc
|
||||
|
||||
|
||||
@app.delete("/subjects/{subject_id}")
|
||||
def delete_subject(subject_id: int) -> dict:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user