
- Complete authentication system with JWT and role-based access control
- User management for Admin, Teacher, Student, and Parent roles
- Student management with CRUD operations
- Class management and assignment system
- Subject and grade tracking functionality
- Daily attendance marking and viewing
- Notification system for announcements
- SQLite database with Alembic migrations
- Comprehensive API documentation with Swagger/ReDoc
- Proper project structure with services, models, and schemas
- Environment variable configuration
- CORS support and security features
🤖 Generated with BackendIM
Co-Authored-By: BackendIM <noreply@anthropic.com>
40 lines
950 B
Python
40 lines
950 B
Python
from typing import Optional
|
|
from pydantic import BaseModel, EmailStr
|
|
from datetime import datetime
|
|
from app.models.user import UserRole
|
|
|
|
class UserBase(BaseModel):
|
|
email: EmailStr
|
|
first_name: str
|
|
last_name: str
|
|
role: UserRole
|
|
is_active: bool = True
|
|
parent_id: Optional[int] = None
|
|
class_id: Optional[int] = None
|
|
|
|
class UserCreate(UserBase):
|
|
password: str
|
|
|
|
class UserUpdate(BaseModel):
|
|
email: Optional[EmailStr] = None
|
|
first_name: Optional[str] = None
|
|
last_name: Optional[str] = None
|
|
role: Optional[UserRole] = None
|
|
is_active: Optional[bool] = None
|
|
parent_id: Optional[int] = None
|
|
class_id: Optional[int] = None
|
|
password: Optional[str] = None
|
|
|
|
class UserInDBBase(UserBase):
|
|
id: int
|
|
created_at: datetime
|
|
updated_at: Optional[datetime] = None
|
|
|
|
class Config:
|
|
orm_mode = True
|
|
|
|
class User(UserInDBBase):
|
|
pass
|
|
|
|
class UserInDB(UserInDBBase):
|
|
hashed_password: str |