project-t4h3ee/schemas/programminglanguage.py
2025-03-27 13:00:32 +00:00

34 lines
1.1 KiB
Python

from pydantic import BaseModel, Field
from typing import Optional
from datetime import datetime
from uuid import UUID
class ProgrammingLanguageBase(BaseModel):
name: str = Field(..., min_length=1, max_length=100, description="Programming language name")
description: Optional[str] = Field(None, description="Programming language description")
class ProgrammingLanguageCreate(ProgrammingLanguageBase):
class Config:
schema_extra = {
"example": {
"name": "Python",
"description": "A high-level, interpreted programming language"
}
}
class ProgrammingLanguage(ProgrammingLanguageBase):
id: UUID
created_at: datetime
updated_at: datetime
class Config:
orm_mode = True
schema_extra = {
"example": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Python",
"description": "A high-level, interpreted programming language",
"created_at": "2023-01-01T00:00:00",
"updated_at": "2023-01-01T00:00:00"
}
}