async def get_dates_today_by_region(id: int): current = datetime.now(pytz.timezone('Asia/Tashkent')).strftime("%Y-%m-%d") data = await Region.filter(hudud_id=id).first() if data is None: http_404() today_data = await Date\ .filter(kun_full=current, hudud=data.hudud).first() if today_data is None: return http_404() return today_data.full_format()
async def get_spec_data(region_id: int, day: int): region = await Region.filter(hudud_id=region_id).first() if region is None: return http_404() date = await Date.filter(hudud=region.hudud, kun=day)\ .first() if date is None: return http_404() return date.full_format()
async def get_current(region: str): current = datetime.now(pytz.timezone('Asia/Tashkent')).strftime("%Y-%m-%d") data = await Date.filter(kun_full=current, hudud=region)\ .first() if data is None: return http_404() return data.response_format()
async def get_dates_by_region(id: int): region = await Region.filter(hudud_id=id).first() if region is None: return http_404() dates = await Date.filter(hudud=region.hudud) return [d.full_format() for d in dates]
async def get_region_by_id(id: int): data = Region.filter(hudud_id=id) resp: Region = await data.get_or_none() or http_404() return resp.full_format()