mirror of
https://github.com/sortedcord/alemno-payments.git
synced 2026-07-22 04:02:49 +05:30
Implement service-based model for jobs
This commit is contained in:
3
app/app.py
Normal file
3
app/app.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from app.main import app
|
||||
|
||||
__all__ = ["app"]
|
||||
5
app/db/base.py
Normal file
5
app/db/base.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from sqlalchemy.orm import DeclarativeBase
|
||||
|
||||
|
||||
class Base(DeclarativeBase):
|
||||
pass
|
||||
4
app/db/models/__init__.py
Normal file
4
app/db/models/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
from app.db.base import Base
|
||||
from app.db.models.job import Job
|
||||
|
||||
__all__ = ["Base", "Job"]
|
||||
3
app/repositories/__init__.py
Normal file
3
app/repositories/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from app.repositories.job_repository import JobRepository
|
||||
|
||||
__all__ = ["JobRepository"]
|
||||
13
app/schemas/__init__.py
Normal file
13
app/schemas/__init__.py
Normal 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
37
app/schemas/job.py
Normal 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
3
app/services/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from app.services.job_service import JobService
|
||||
|
||||
__all__ = ["JobService"]
|
||||
Reference in New Issue
Block a user