summaryrefslogtreecommitdiff
path: root/app/schemas
diff options
context:
space:
mode:
Diffstat (limited to 'app/schemas')
-rw-r--r--app/schemas/auth.py0
-rw-r--r--app/schemas/user.py29
2 files changed, 29 insertions, 0 deletions
diff --git a/app/schemas/auth.py b/app/schemas/auth.py
deleted file mode 100644
index e69de29..0000000
--- a/app/schemas/auth.py
+++ /dev/null
diff --git a/app/schemas/user.py b/app/schemas/user.py
new file mode 100644
index 0000000..7151d54
--- /dev/null
+++ b/app/schemas/user.py
@@ -0,0 +1,29 @@
+from typing import Optional
+
+from pydantic import BaseModel, EmailStr, Field
+
+
+class UserCreate(BaseModel):
+ username: str = Field(..., max_length=32)
+ email: Optional[EmailStr] = None
+ password: str = Field(..., min_length=8)
+
+ model_config = {
+ "extra": "forbid",
+ }
+
+
+class UserRead(BaseModel):
+ id: int
+ username: str
+ email: Optional[EmailStr] = None
+ google_id: Optional[str] = None
+ avatar_file: Optional[str] = None
+ banner_file: Optional[str] = None
+ premium: bool
+ is_banned: bool
+ is_moderator: bool
+
+ model_config = {
+ "from_attributes": True,
+ }