Spaces:
Sleeping
Sleeping
Create app/schemas/suggestion.py
Browse files- app/schemas/suggestion.py +28 -0
app/schemas/suggestion.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from datetime import datetime
|
| 2 |
+
from pydantic import BaseModel
|
| 3 |
+
from typing import List, Optional
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
class SuggestionBase(BaseModel):
|
| 7 |
+
headwordZomi: str
|
| 8 |
+
headwordEnglish: str
|
| 9 |
+
translations: List[str] = []
|
| 10 |
+
partOfSpeech: Optional[str] = None
|
| 11 |
+
definition: str
|
| 12 |
+
contributorId: Optional[str] = None
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
class SuggestionCreate(SuggestionBase):
|
| 16 |
+
pass
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
class Suggestion(SuggestionBase):
|
| 20 |
+
id: int
|
| 21 |
+
isApproved: bool
|
| 22 |
+
upvotes: int
|
| 23 |
+
downvotes: int
|
| 24 |
+
createdAt: datetime
|
| 25 |
+
updatedAt: datetime
|
| 26 |
+
|
| 27 |
+
class Config:
|
| 28 |
+
orm_mode = True
|