feat: Add base project structure with API and web components

This commit is contained in:
Ke Sun
2025-12-02 20:28:01 +08:00
parent f3de6d6cc9
commit c1adc62ec6
817 changed files with 111226 additions and 106 deletions

View File

@@ -0,0 +1,30 @@
from pydantic import BaseModel, EmailStr, field_serializer
from typing import Optional
import datetime
class Token(BaseModel):
access_token: str
refresh_token: str
token_type: str
expires_at: datetime.datetime
refresh_expires_at: datetime.datetime
@field_serializer("expires_at", when_used="json")
def _serialize_expires_at(self, dt: datetime.datetime):
return int(dt.timestamp() * 1000) if dt else None
@field_serializer("refresh_expires_at", when_used="json")
def _serialize_refresh_expires_at(self, dt: datetime.datetime):
return int(dt.timestamp() * 1000) if dt else None
class TokenData(BaseModel):
userId: Optional[str] = None
class RefreshTokenRequest(BaseModel):
refresh_token: str
class TokenRequest(BaseModel):
email: EmailStr
password: str
invite: Optional[str] = None