22 lines
828 B
Python
22 lines
828 B
Python
import uuid
|
|
|
|
from app.config import TaskEnv
|
|
from app.models.register_status import RegisterStatusModel
|
|
from core.repositories.base import BaseRepository
|
|
from core.service.mongo_db import use_collection
|
|
|
|
class RegisterStatusRepository(BaseRepository):
|
|
def __init__(self):
|
|
super().__init__(collection=TaskEnv.CLN_AUDIT_STATUS, model=RegisterStatusModel)
|
|
|
|
async def get_last(self,project_id:uuid.UUID):
|
|
last = await use_collection(TaskEnv.CLN_AUDIT_STATUS).find({"project_id":project_id}).sort('$natural', -1).to_list(1)
|
|
if last:
|
|
return last[0]['number']
|
|
else:
|
|
return None
|
|
|
|
async def get_list(self,project_id:uuid.UUID):
|
|
list_status = await use_collection(TaskEnv.CLN_AUDIT_STATUS).find({"project_id":project_id}).to_list(None)
|
|
return list_status
|