fix(project):add get all
This commit is contained in:
@@ -231,25 +231,25 @@ class ProjectRepository(BaseRepository[ProjectModel]):
|
|||||||
async def get_all(self):
|
async def get_all(self):
|
||||||
url = 'http://api.khanesaziceco.ir/api/api/project/table'
|
url = 'http://api.khanesaziceco.ir/api/api/project/table'
|
||||||
headers = {
|
headers = {
|
||||||
'authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9hcGkua2hhbmVzYXppY2Vjby5pclwvYXBpXC9hdXRoXC9sb2dpbiIsImlhdCI6MTcyOTg4MTc2OCwiZXhwIjoxNzMyNDczNzY4LCJuYmYiOjE3Mjk4ODE3NjgsImp0aSI6IjRiUGQ0dW1Wc2ZBSnNFUzUiLCJzdWIiOjEzNiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.LsinrL84iKAd4HaTHmsaDCALXJPwMLegNpeFhlJL0aY'}
|
'authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9hcGkua2hhbmVzYXppY2Vjby5pclwvYXBpXC9hdXRoXC9sb2dpbiIsImlhdCI6MTc0OTg0NjExMSwiZXhwIjoxNzUyNDM4MTExLCJuYmYiOjE3NDk4NDYxMTEsImp0aSI6Ikh6OURsZHR2U2FVRU5rd24iLCJzdWIiOjEzNiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.C7vRTRbhKrKuoFd334imKAIYFnU-9ygCIFmrwiPGVxY'}
|
||||||
data = {"page": 1,
|
data = {"page": 1,
|
||||||
"limit": 400,
|
"limit": 400,
|
||||||
"sort": "_id"
|
"sort": "_id"
|
||||||
}
|
}
|
||||||
res = requests.post(url, data=json.dumps(data), headers=headers)
|
res = requests.post(url, data=json.dumps(data), headers=headers)
|
||||||
a = res.json()
|
a = res.json()
|
||||||
print(a['rows'][0])
|
|
||||||
obj = []
|
obj = []
|
||||||
for i in a['rows']:
|
rows = a['rows']
|
||||||
|
rows.reverse()
|
||||||
|
for i in rows:
|
||||||
_set = ProjectModel(
|
_set = ProjectModel(
|
||||||
sts=1,
|
sts=1,
|
||||||
counter=i['id'],
|
counter=i['id'],
|
||||||
design=Design(**i)
|
design=Design(**i)
|
||||||
).init_id().cu_at()
|
).init_id().cu_at()
|
||||||
obj.append(_set.mongo_dict())
|
obj.append(_set.mongo_dict())
|
||||||
print()
|
|
||||||
|
|
||||||
# await use_collection(TaskEnv.CLN_PROJECT).insert_many(obj)
|
await use_collection(TaskEnv.CLN_PROJECT).insert_many(obj)
|
||||||
|
|
||||||
return res.json()
|
return res.json()
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -93,10 +93,10 @@ def fetch_delete(body: TableEngineRequestType = Body(...)):
|
|||||||
# pass
|
# pass
|
||||||
|
|
||||||
|
|
||||||
# @router.post('/get_all', tags=_tag_base)
|
@router.post('/get_all', tags=_tag_base)
|
||||||
# @shrink(repo.get_all)
|
@shrink(repo.get_all)
|
||||||
# def get_all():
|
def get_all():
|
||||||
# pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
app.include_router(router)
|
app.include_router(router)
|
||||||
Reference in New Issue
Block a user