Implement service-based model for jobs

This commit is contained in:
2026-06-29 13:18:23 +05:30
parent 7201fa0138
commit e0cd0bba6e
12 changed files with 728 additions and 2 deletions

3
app/app.py Normal file
View File

@@ -0,0 +1,3 @@
from app.main import app
__all__ = ["app"]

5
app/db/base.py Normal file
View File

@@ -0,0 +1,5 @@
from sqlalchemy.orm import DeclarativeBase
class Base(DeclarativeBase):
pass

View File

@@ -0,0 +1,4 @@
from app.db.base import Base
from app.db.models.job import Job
__all__ = ["Base", "Job"]

View File

@@ -0,0 +1,3 @@
from app.repositories.job_repository import JobRepository
__all__ = ["JobRepository"]

13
app/schemas/__init__.py Normal file
View File

@@ -0,0 +1,13 @@
from app.schemas.job import (
JobCreate,
JobResponse,
JobStatusResponse,
JobResultResponse,
)
__all__ = [
"JobCreate",
"JobResponse",
"JobStatusResponse",
"JobResultResponse",
]

37
app/schemas/job.py Normal file
View File

@@ -0,0 +1,37 @@
from datetime import datetime
from typing import Any, Dict, List, Optional
from pydantic import BaseModel, ConfigDict
class JobBase(BaseModel):
filename: str
class JobCreate(JobBase):
pass
class JobResponse(JobBase):
model_config = ConfigDict(from_attributes=True)
id: str
status: str
row_count: Optional[int] = None
created_at: datetime
updated_at: datetime
class JobStatusResponse(BaseModel):
model_config = ConfigDict(from_attributes=True)
id: str
status: str
summary: Optional[Dict[str, Any]] = None
class JobResultResponse(BaseModel):
model_config = ConfigDict(from_attributes=True)
id: str
status: str
results: Optional[Dict[str, Any]] = None

3
app/services/__init__.py Normal file
View File

@@ -0,0 +1,3 @@
from app.services.job_service import JobService
__all__ = ["JobService"]