init
This commit is contained in:
38
new-planet-backend/app/schemas/reward.py
Normal file
38
new-planet-backend/app/schemas/reward.py
Normal file
@@ -0,0 +1,38 @@
|
||||
from pydantic import BaseModel, Field
|
||||
from typing import Optional
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class RewardBase(BaseModel):
|
||||
title: str = Field(..., max_length=255)
|
||||
description: Optional[str] = None
|
||||
image_url: Optional[str] = None
|
||||
points_required: int = Field(default=1, ge=1)
|
||||
|
||||
|
||||
class RewardCreate(RewardBase):
|
||||
pass
|
||||
|
||||
|
||||
class RewardUpdate(BaseModel):
|
||||
title: Optional[str] = Field(None, max_length=255)
|
||||
description: Optional[str] = None
|
||||
image_url: Optional[str] = None
|
||||
points_required: Optional[int] = Field(None, ge=1)
|
||||
is_claimed: Optional[bool] = None
|
||||
|
||||
|
||||
class RewardInDB(RewardBase):
|
||||
id: str
|
||||
user_id: str
|
||||
is_claimed: bool = False
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class Reward(RewardInDB):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user