del squad_uuids from tariffs
This commit is contained in:
+6
-1
@@ -9,7 +9,12 @@ router = APIRouter(prefix='/api/v1', tags=['tariffs'])
|
|||||||
async def get_tariffs_from_file():
|
async def get_tariffs_from_file():
|
||||||
async with aiofiles.open('data/tariffs.json', 'r', encoding='utf-8') as f:
|
async with aiofiles.open('data/tariffs.json', 'r', encoding='utf-8') as f:
|
||||||
content = await f.read()
|
content = await f.read()
|
||||||
return json.loads(content) # <- блокирующая операция, но с маленьким контентом + кэш
|
data = json.loads(content) # <- блокирующая операция, но с маленьким контентом + кэш
|
||||||
|
|
||||||
|
# Удаляем squad_uuids
|
||||||
|
for tariff in data.get('tariffs', []):
|
||||||
|
tariff.pop('squad_uuids', None)
|
||||||
|
return data
|
||||||
|
|
||||||
@router.get('/tariffs')
|
@router.get('/tariffs')
|
||||||
async def get_tariffs():
|
async def get_tariffs():
|
||||||
|
|||||||
Reference in New Issue
Block a user