17 lines
666 B
Python
17 lines
666 B
Python
import uuid
|
|
|
|
from app.config import TaskEnv
|
|
from app.models.monitor_physical_secondary_progress import SecondaryProgressModel
|
|
from core.repositories.base import BaseRepository
|
|
from core.service.mongo_db import use_collection
|
|
|
|
class SecondaryProgressRepository(BaseRepository):
|
|
def __init__(self):
|
|
super().__init__(collection=TaskEnv.CLN_MONITOR_SECONDARY, model=SecondaryProgressModel)
|
|
|
|
async def last_record(self,project_id:uuid.UUID):
|
|
last = await use_collection(TaskEnv.CLN_MONITOR_SECONDARY).find({'project_id':project_id}).sort("$natural", -1).to_list(None)
|
|
if last:
|
|
return last[0]
|
|
else:
|
|
return {} |