fix(excel):change
This commit is contained in:
@@ -50,7 +50,7 @@ class SubRecord(pydantic.BaseModel):
|
|||||||
class Record(BaseModel):
|
class Record(BaseModel):
|
||||||
id: Optional[uuid.UUID] = Field(alias='_id')
|
id: Optional[uuid.UUID] = Field(alias='_id')
|
||||||
title: str = Field(description='عنوان در این فیلد قرار میگیرد')
|
title: str = Field(description='عنوان در این فیلد قرار میگیرد')
|
||||||
send: SubRecord = Field(description='اطلاعات ارسال در این فیلد ذخیره می شود')
|
send: Optional[SubRecord] = Field(description='اطلاعات ارسال در این فیلد ذخیره می شود')
|
||||||
receive: Optional[SubRecord] = Field(description='اطلاعات دریافت در این فیلد ذخیره می شود')
|
receive: Optional[SubRecord] = Field(description='اطلاعات دریافت در این فیلد ذخیره می شود')
|
||||||
|
|
||||||
class RecordModel(Record):
|
class RecordModel(Record):
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ class ContractRepository(BaseRepository):
|
|||||||
{'$match':query['query']},
|
{'$match':query['query']},
|
||||||
{'$group': {"_id": None, 'count': {'$sum': 1},'sum':{"$sum":"$amount"}}}
|
{'$group': {"_id": None, 'count': {'$sum': 1},'sum':{"$sum":"$amount"}}}
|
||||||
]).to_list(None)
|
]).to_list(None)
|
||||||
return count[0]
|
print(count)
|
||||||
else:
|
if len(count)>0:
|
||||||
return []
|
return count[0]
|
||||||
|
return []
|
||||||
|
|||||||
+740
-652
File diff suppressed because it is too large
Load Diff
@@ -66,14 +66,14 @@ class ProjectRepository(BaseRepository[ProjectModel]):
|
|||||||
|
|
||||||
async def create(self, coding: ProjectModel):
|
async def create(self, coding: ProjectModel):
|
||||||
coding.counter = 1
|
coding.counter = 1
|
||||||
last_project = await use_collection(COLLECTION).find({}).sort("$natural", -1).to_list(None)
|
last_project = await use_collection(COLLECTION).find({}).sort("counter", -1).to_list(None)
|
||||||
if last_project:
|
if last_project:
|
||||||
coding.counter = last_project[0]["counter"] + 1
|
coding.counter = last_project[0]["counter"] + 1
|
||||||
code = self.create_code(coding)
|
code = self.create_code(coding)
|
||||||
coding.design.code = 'D' + code
|
coding.design.code = code
|
||||||
coding.init_id().cu_at()
|
coding.init_id().cu_at()
|
||||||
if coding.monitor:
|
if coding.monitor:
|
||||||
coding.monitor.code = 'S' + code
|
coding.monitor.code = code
|
||||||
coding.has_monitor = True
|
coding.has_monitor = True
|
||||||
await self.create_report_price(coding)
|
await self.create_report_price(coding)
|
||||||
if coding.monitor.detail.date_create_project and coding.monitor.detail.first_time:
|
if coding.monitor.detail.date_create_project and coding.monitor.detail.first_time:
|
||||||
@@ -95,12 +95,12 @@ class ProjectRepository(BaseRepository[ProjectModel]):
|
|||||||
old_project = ProjectModel(**old_project_dict)
|
old_project = ProjectModel(**old_project_dict)
|
||||||
if update.monitor and not old_project.monitor:
|
if update.monitor and not old_project.monitor:
|
||||||
code = self.create_code(update)
|
code = self.create_code(update)
|
||||||
update.monitor.code = 'S' + code
|
update.monitor.code = code
|
||||||
if update.design.nature != old_project.design.nature or update.design.type != old_project.design.type:
|
if update.design.nature != old_project.design.nature or update.design.type != old_project.design.type:
|
||||||
code = self.create_code(update)
|
code = self.create_code(update)
|
||||||
update.design.code = 'D' + code
|
update.design.code = code
|
||||||
if update.monitor:
|
if update.monitor:
|
||||||
update.monitor.code = 'S' + code
|
update.monitor.code = code
|
||||||
if update.monitor:
|
if update.monitor:
|
||||||
update.has_monitor = True
|
update.has_monitor = True
|
||||||
await self.update_report_price(update)
|
await self.update_report_price(update)
|
||||||
|
|||||||
+8
-3
@@ -18,9 +18,9 @@ def design():
|
|||||||
def monitor():
|
def monitor():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@router.get('/progress1', tags=_tag_base)
|
@router.get('/progress/madarek', tags=_tag_base)
|
||||||
@shrink(repo.addProgress1)
|
@shrink(repo.madarek)
|
||||||
def addProgress1():
|
def madarek():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@router.get('/progress/physical', tags=_tag_base)
|
@router.get('/progress/physical', tags=_tag_base)
|
||||||
@@ -89,6 +89,11 @@ def addProgressTender():
|
|||||||
def changeStatus():
|
def changeStatus():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@router.get('/change/design/metri/sts', tags=_tag_base)
|
||||||
|
@shrink(repo.changeStatusWithMetri)
|
||||||
|
def changeStatusWithMetri():
|
||||||
|
pass
|
||||||
|
|
||||||
@router.get('/progress/monitor/physical', tags=_tag_base)
|
@router.get('/progress/monitor/physical', tags=_tag_base)
|
||||||
@shrink(repo.progressMonitorPhysical)
|
@shrink(repo.progressMonitorPhysical)
|
||||||
def progressMonitor():
|
def progressMonitor():
|
||||||
|
|||||||
+3
-3
@@ -4,7 +4,7 @@ auth:
|
|||||||
algorithm: 'HS256'
|
algorithm: 'HS256'
|
||||||
access_token_expire_minutes: 43201
|
access_token_expire_minutes: 43201
|
||||||
refresh_token_expire_minutes: 43200
|
refresh_token_expire_minutes: 43200
|
||||||
url: 'https://auth.hacoupian.net/v2/auth/validate-token'
|
url: 'http://pm.khanesaziceco.ir/api/api/me'
|
||||||
cache_prefix_key: 'auth_key_'
|
cache_prefix_key: 'auth_key_'
|
||||||
cache_ttl: 360
|
cache_ttl: 360
|
||||||
|
|
||||||
@@ -68,11 +68,11 @@ database:
|
|||||||
db: 'omde'
|
db: 'omde'
|
||||||
|
|
||||||
limiter_redis:
|
limiter_redis:
|
||||||
url: 'redis://192.168.15.76:6379'
|
url: 'redis://172.16.1.194:6379'
|
||||||
db: ''
|
db: ''
|
||||||
|
|
||||||
auth_redis:
|
auth_redis:
|
||||||
url: 'redis://192.168.15.231:6379'
|
url: 'redis://172.16.1.194:6379'
|
||||||
db: '1'
|
db: '1'
|
||||||
|
|
||||||
neo4j:
|
neo4j:
|
||||||
|
|||||||
@@ -23,9 +23,8 @@ async def validate_token(_input: ValidateTokenInput):
|
|||||||
_cache_auth = await redis_get(f'{conf.auth.cache_prefix_key}{_cache_key}', conf.database.get('auth_redis'))
|
_cache_auth = await redis_get(f'{conf.auth.cache_prefix_key}{_cache_key}', conf.database.get('auth_redis'))
|
||||||
if not _cache_auth:
|
if not _cache_auth:
|
||||||
client = httpx.AsyncClient()
|
client = httpx.AsyncClient()
|
||||||
headers = {'Content-Type': 'application/json', }
|
headers = {'Content-Type': 'application/json', 'Authorization':'Bearer '+_input.token}
|
||||||
|
result = await client.request('GET', conf.auth.url, json=_input.dict(), headers=headers)
|
||||||
result = await client.request('POST', conf.auth.url, json=_input.dict(), headers=headers)
|
|
||||||
export = result.text
|
export = result.text
|
||||||
if 'application/json' in result.headers['content-type']:
|
if 'application/json' in result.headers['content-type']:
|
||||||
export = result.json()
|
export = result.json()
|
||||||
@@ -35,6 +34,7 @@ async def validate_token(_input: ValidateTokenInput):
|
|||||||
|
|
||||||
if 'v2' in conf.auth.url:
|
if 'v2' in conf.auth.url:
|
||||||
export = export.get('data')
|
export = export.get('data')
|
||||||
|
print(export)
|
||||||
|
|
||||||
await redis_set(f'{conf.auth.cache_prefix_key}{_cache_key}', export, conf.database.get('auth_redis'),
|
await redis_set(f'{conf.auth.cache_prefix_key}{_cache_key}', export, conf.database.get('auth_redis'),
|
||||||
ex=conf.auth.cache_ttl)
|
ex=conf.auth.cache_ttl)
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ from core.models.base import BaseModel
|
|||||||
|
|
||||||
|
|
||||||
class UserModel(BaseModel):
|
class UserModel(BaseModel):
|
||||||
id: Optional[Union[uuid.UUID, str]] = Field(alias='_id')
|
id: Optional[Union[uuid.UUID, str, int]] = Field(alias='_id')
|
||||||
username: Optional[str]
|
username: Optional[str]
|
||||||
mobile: Optional[str]
|
mobile: Optional[str]
|
||||||
name: Optional[str]
|
name: Optional[str]
|
||||||
first_name: Optional[str]
|
fname: Optional[str]
|
||||||
last_name: Optional[str]
|
lname: Optional[str]
|
||||||
is_su: Optional[bool]
|
is_su: Optional[bool]
|
||||||
unit: Optional[str]
|
unit: Optional[str]
|
||||||
avatar: Optional[str]
|
avatar: Optional[str]
|
||||||
|
|||||||
Reference in New Issue
Block a user