w
This commit is contained in:
commit
4716effcf7
309 files changed
+153369
No files matched your search
@@ -0,0 +1,24 @@
|
||||
from services.redis_key import *
|
||||
import asyncio
|
||||
|
||||
async def emptyidct():
|
||||
asyncio.sleep(0)
|
||||
return {}
|
||||
|
||||
async def emptyarr():
|
||||
asyncio.sleep(0)
|
||||
return []
|
||||
|
||||
async def asincuser(arr)->list:
|
||||
return [{"role":x["role"],"percent":x["percent"], "user": await REdSetter.updateKeyReturnChecker(REdSetterSettings('users:user',x['user']['id'],'getuser'))} for x in arr]
|
||||
|
||||
|
||||
|
||||
|
||||
class ProjectBuildier:
|
||||
async def build_proj_persons(nudeproj):
|
||||
|
||||
nudeproj['users']=await asincuser( nudeproj['users'])
|
||||
|
||||
|
||||
return nudeproj
|
||||
@@ -0,0 +1,32 @@
|
||||
from orm.models import *
|
||||
from orm.schema import *
|
||||
from services.wsservice import *
|
||||
|
||||
|
||||
class Projectquery:
|
||||
def __init__(self) -> None:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
async def ProjectBaseFieldsQuery(self,id):
|
||||
"""Берем только проект (без информации о пользователях - только их ид и роль)"""
|
||||
a = await Project.objects.select_related( ["status","ptype","project_task"]).get(id=id)
|
||||
a=querytoPydantic(ProjectGet,a)
|
||||
a['users'] = await self.get_nudeprojectusers(id)
|
||||
return a
|
||||
|
||||
|
||||
@classmethod
|
||||
async def get_nudeprojectusers(self,projectid):
|
||||
usersq = await ProjectUser.objects.select_related(["role"]).filter(project=projectid).all()
|
||||
|
||||
users = [querytoPydantic(ProjectUserSchema,x) for x in usersq]
|
||||
return users
|
||||
|
||||
@classmethod
|
||||
async def project_status_update(id, status):
|
||||
work = await Project.objects.get(id=id)
|
||||
work.status = status
|
||||
return await work.update()
|
||||
|
||||
|
||||
Reference in new issue
Block a user