feat(register status):add
This commit is contained in:
+1
-16
@@ -1,17 +1,2 @@
|
||||
class TaskEnv:
|
||||
CLN_SUB = 'subscription'
|
||||
CLN_SUB_USER = 'subscription_users'
|
||||
CLN_USER = 'customer'
|
||||
CLN_FAV = 'favs'
|
||||
CLN_STORY = 'story'
|
||||
CLN_STORY_COMMENT = 'story-comment'
|
||||
CLN_ORDER = 'order'
|
||||
CLN_CATEGORY = 'category'
|
||||
CLN_PRODUCT = 'product'
|
||||
CLN_TASK = "task"
|
||||
CLN_CONST = "const"
|
||||
CLN_DEPENDENCY = "dependency"
|
||||
CLN_MEMBER = "member"
|
||||
CLN_PROJECT = "project"
|
||||
CLN_TAGS = "tags"
|
||||
CLN_WORKSPACE = "workspace"
|
||||
CLN_AUDIT_STATUS = 'audit_status'
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
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[RegisterStatusModel]):
|
||||
def __int__(self):
|
||||
super().__init__(collection='register_status',model=RegisterStatusModel)
|
||||
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_one({"project_id":project_id}).sort('$natural', -1)
|
||||
return last
|
||||
|
||||
@@ -2,6 +2,7 @@ from uuid import UUID
|
||||
|
||||
from fastapi import Body
|
||||
|
||||
from app.config import TaskEnv
|
||||
from app.models.register_status import RegisterStatusModel
|
||||
from app.repositories.register_status import RegisterStatusRepository
|
||||
from core.app import app
|
||||
@@ -14,13 +15,17 @@ _tag_base = [router_base_url]
|
||||
router = generate_router(router_base_url, auth_dependencies=False, version='v2')
|
||||
|
||||
|
||||
repo = RegisterStatusRepository(collection='register_status')
|
||||
repo = RegisterStatusRepository(collection=TaskEnv.CLN_AUDIT_STATUS)
|
||||
|
||||
@router.post('/create', response_model=ThisModel, tags=_tag_base)
|
||||
@shrink(repo.create)
|
||||
def create(coding: ThisModel = Body(...)):
|
||||
pass
|
||||
|
||||
@router.get('/last/{project_id}', response_model=ThisModel, tags=_tag_base)
|
||||
@shrink(repo.get_last)
|
||||
def get_last(project_id: UUID):
|
||||
pass
|
||||
@router.put('/{_id}', response_model=ThisModel, tags=_tag_base)
|
||||
@shrink(repo.update)
|
||||
def update(_id: UUID, coding: ThisModel = Body(...)):
|
||||
@@ -33,6 +38,7 @@ def get(_id: UUID):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@router.post('', response_model=TableEngineExport[ThisModel], tags=_tag_base)
|
||||
@shrink(repo.fetch)
|
||||
def fetch(body: TableEngineRequestType = Body(...)):
|
||||
|
||||
Reference in New Issue
Block a user