Anlegen prüft jetzt case-insensitiv auf Duplikate (409 statt "Fach A"
neben "fach a"). Neuer Endpunkt GET /faecher/{id}/objekte zeigt, welche
Objekte ein Fach über ihre Vorlage tatsächlich nutzen. POST
/faecher/{id}/ersetzen benennt um und zieht alle Vorlagenpositionen
mit; landet der neue Name auf einem bereits bestehenden Fach, werden
beide zusammengeführt. Frontend: Fach anklicken öffnet Verwendung +
Ersetzen-Eingabe direkt in der Fächer-Verwaltung.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CVgbozhYmuEhiEJHffRXCV
127 lines
2.6 KiB
Python
127 lines
2.6 KiB
Python
from pydantic import BaseModel, ConfigDict
|
|
|
|
from app.models.stammdaten import MaterialTyp
|
|
|
|
|
|
class BereichCreate(BaseModel):
|
|
name: str
|
|
beschreibung: str | None = None
|
|
|
|
|
|
class BereichRead(BereichCreate):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
id: int
|
|
|
|
|
|
class BereichUpdate(BaseModel):
|
|
name: str | None = None
|
|
beschreibung: str | None = None
|
|
|
|
|
|
class KategorieCreate(BaseModel):
|
|
bereich_id: int
|
|
name: str
|
|
ueberkategorie_id: int | None = None
|
|
|
|
|
|
class KategorieRead(KategorieCreate):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
id: int
|
|
|
|
|
|
class KategorieUpdate(BaseModel):
|
|
bereich_id: int | None = None
|
|
name: str | None = None
|
|
ueberkategorie_id: int | None = None
|
|
|
|
|
|
class StandortCreate(BaseModel):
|
|
name: str
|
|
adresse: str | None = None
|
|
|
|
|
|
class StandortRead(StandortCreate):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
id: int
|
|
|
|
|
|
class StandortUpdate(BaseModel):
|
|
name: str | None = None
|
|
adresse: str | None = None
|
|
|
|
|
|
class ObjekttypCreate(BaseModel):
|
|
bereich_id: int
|
|
kategorie_id: int | None = None
|
|
name: str
|
|
ist_zugfahrzeug: bool = False
|
|
|
|
|
|
class ObjekttypRead(ObjekttypCreate):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
id: int
|
|
|
|
|
|
class ObjekttypUpdate(BaseModel):
|
|
bereich_id: int | None = None
|
|
kategorie_id: int | None = None
|
|
name: str | None = None
|
|
ist_zugfahrzeug: bool | None = None
|
|
|
|
|
|
class FachCreate(BaseModel):
|
|
objekttyp_id: int
|
|
name: str
|
|
sortierung: int = 0
|
|
|
|
|
|
class FachRead(FachCreate):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
id: int
|
|
|
|
|
|
class FachUpdate(BaseModel):
|
|
name: str | None = None
|
|
sortierung: int | None = None
|
|
|
|
|
|
class FachErsetzen(BaseModel):
|
|
neuer_name: str
|
|
|
|
|
|
class FachVerwendungObjekt(BaseModel):
|
|
id: int
|
|
name: str
|
|
code: str
|
|
|
|
|
|
class MaterialCreate(BaseModel):
|
|
name: str
|
|
artikelnummer: str | None = None
|
|
einheit: str
|
|
materialtyp: MaterialTyp
|
|
kategorie_id: int | None = None
|
|
hersteller: str | None = None
|
|
beschreibung: str | None = None
|
|
code: str | None = None
|
|
warnzeitraum_tage: int | None = None
|
|
aktiv: bool = True
|
|
|
|
|
|
class MaterialUpdate(BaseModel):
|
|
name: str | None = None
|
|
artikelnummer: str | None = None
|
|
einheit: str | None = None
|
|
materialtyp: MaterialTyp | None = None
|
|
kategorie_id: int | None = None
|
|
hersteller: str | None = None
|
|
beschreibung: str | None = None
|
|
code: str | None = None
|
|
warnzeitraum_tage: int | None = None
|
|
aktiv: bool | None = None
|
|
|
|
|
|
class MaterialRead(MaterialCreate):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
id: int
|