16 lines
434 B
Python
16 lines
434 B
Python
from fastapi import APIRouter
|
|
|
|
from time_app.helpers.datetime import real_utc_now
|
|
from time_app.models.main import Now
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get('/', name='Now', response_model=Now)
|
|
def now_view() -> dict:
|
|
return {"time": real_utc_now().strftime('%Y-%m-%d %H:%M:%S')}
|
|
|
|
|
|
@router.get('/diy', name='Day in year', response_model=Now)
|
|
def day_in_year_view() -> dict:
|
|
return {"time": real_utc_now().strftime('%y%j')[-4:]}
|