Fix: Standort-Picker im Forum-Edit-Modal ergänzt
- _showEditThreadModal: location picker mit Vorausfüllung (thread_lat/lon/ort)
- ThreadUpdate-Schema: thread_lat/lon/ort Felder ergänzt
- PATCH /threads/{id}/content: Location wird jetzt gespeichert/überschrieben
This commit is contained in:
parent
062c0209e6
commit
b1053198de
3 changed files with 32 additions and 6 deletions
|
|
@ -38,8 +38,11 @@ class ThreadPatch(BaseModel):
|
|||
is_locked: Optional[int] = None
|
||||
|
||||
class ThreadUpdate(BaseModel):
|
||||
titel: Optional[str] = None
|
||||
text: Optional[str] = None
|
||||
titel: Optional[str] = None
|
||||
text: Optional[str] = None
|
||||
thread_lat: Optional[float] = None
|
||||
thread_lon: Optional[float] = None
|
||||
thread_ort: Optional[str] = None
|
||||
|
||||
class PostUpdate(BaseModel):
|
||||
text: str
|
||||
|
|
@ -351,7 +354,10 @@ async def update_thread_content(thread_id: int, data: ThreadUpdate, user=Depends
|
|||
updates.append("titel=?"); vals.append(data.titel.strip())
|
||||
if data.text is not None:
|
||||
updates.append("text=?"); vals.append(data.text.strip())
|
||||
if not updates: return {"ok": True}
|
||||
# Location immer überschreiben (auch mit None zum Löschen)
|
||||
updates += ["thread_lat=?", "thread_lon=?", "thread_ort=?"]
|
||||
vals += [data.thread_lat, data.thread_lon,
|
||||
data.thread_ort.strip() if data.thread_ort else None]
|
||||
conn.execute(f"UPDATE forum_threads SET {','.join(updates)} WHERE id=?", (*vals, thread_id))
|
||||
return {"ok": True}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue