Coverage for src/app/modules/cards/schemas.py: 100%

17 statements  

« prev     ^ index     » next       coverage.py v7.14.3, created at 2026-06-24 08:34 +0000

1from pydantic import BaseModel, ConfigDict, Field 

2 

3 

4class CardBase(BaseModel): 

5 front: str = Field(..., min_length=1) 

6 back: str = Field(..., min_length=1) 

7 

8 

9class CardCreate(BaseModel): 

10 front: str 

11 back: str 

12 deck_id: int 

13 

14 

15class CardUpdate(BaseModel): 

16 front: str | None = None 

17 back: str | None = None 

18 

19 

20class CardRead(BaseModel): 

21 id: int 

22 front: str 

23 back: str 

24 deck_id: int 

25 

26 model_config = ConfigDict(from_attributes=True)