api/app/schemas/user.py
Yoga Pangestu 7bbe4e7295 Implement subscription, tenant, and user services with CRUD operations and associated tests
- Added subscription_service.py for managing subscriptions with functions to create, read, update, and delete subscriptions.
- Added tenant_service.py for managing tenants with functions to create, read, update, delete tenants, and assign users to tenants.
- Added user_service.py for managing users with functions to create, read, update, and delete users.
- Created tests for business types, plans, subscriptions, tenants, and users, ensuring proper functionality and error handling.
- Implemented pagination in user listing and included user profiles in responses.
- Established fixtures for database setup and teardown in tests.
2026-07-17 23:36:31 +07:00

48 lines
935 B
Python

from datetime import datetime
from pydantic import BaseModel, EmailStr
class UserCreate(BaseModel):
email: EmailStr
username: str
password: str
full_name: str
phone: str | None = None
timezone: str = "Asia/Jakarta"
class UserUpdate(BaseModel):
email: EmailStr | None = None
username: str | None = None
password: str | None = None
full_name: str | None = None
phone: str | None = None
timezone: str | None = None
status: str | None = None
class UserResponse(BaseModel):
id: str
email: str
username: str
tenant_id: str | None
status: str
created_at: datetime
class Config:
from_attributes = True
class UserProfileResponse(BaseModel):
full_name: str
phone: str | None
timezone: str | None
class Config:
from_attributes = True
class UserDetailResponse(UserResponse):
profile: UserProfileResponse | None = None