Добавлен API Квартплаты
This commit is contained in:
50
kv/routers/personalaccount.py
Normal file
50
kv/routers/personalaccount.py
Normal file
@ -0,0 +1,50 @@
|
||||
import kv.schemas as schemas
|
||||
import kv.crud as crud
|
||||
from kv.database import get_db
|
||||
from sqlalchemy.orm import Session
|
||||
from fastapi import APIRouter, Depends
|
||||
from typing import List
|
||||
router = APIRouter()
|
||||
|
||||
"""get"""
|
||||
|
||||
|
||||
@router.get("/get_details/{id}", response_model=List[schemas.PersonalAccountDetailsSerializer])
|
||||
def get_details(id: int, db: Session = Depends(get_db)):
|
||||
data = crud.PersonalAccountViewSet.get_details(db, id)
|
||||
return data
|
||||
|
||||
|
||||
@router.get("/get_turn_over/{IDPersonalAccount}", response_model=List[schemas.TurnOverSerializer])
|
||||
def get_turn_over(IDPersonalAccount: int, db: Session = Depends(get_db)):
|
||||
data = crud.PersonalAccountViewSet.get_turn_over(db, IDPersonalAccount)
|
||||
return data
|
||||
|
||||
|
||||
@router.get("/get_services/{IDPersonalAccount}", response_model=List[schemas.PersonalAccountTOServicesSerializer])
|
||||
def get_services(IDPersonalAccount: int, db: Session = Depends(get_db)):
|
||||
data = crud.PersonalAccountViewSet.get_services(db, IDPersonalAccount)
|
||||
return data
|
||||
|
||||
|
||||
@router.get("/get_debt/{IDPersonalAccount}", response_model=List[schemas.PersonalAccountDebtSerilizer])
|
||||
def get_debt(IDPersonalAccount: int, db: Session = Depends(get_db)):
|
||||
data = crud.PersonalAccountViewSet.get_debt(db, IDPersonalAccount)
|
||||
return data
|
||||
|
||||
|
||||
@router.get("/get_debts/IDPersonalAccount={IDPersonalAccount},GetType={GetType}", response_model=List[schemas.PersonalAccountDebtsSerializer])
|
||||
def get_debts(IDPersonalAccount: int, GetType: bool, db: Session = Depends(get_db)):
|
||||
to_data = schemas.PersonalAccountType(
|
||||
IDPersonalAccount=IDPersonalAccount, GetType=GetType)
|
||||
data = crud.PersonalAccountViewSet.get_debts(db, to_data)
|
||||
return data
|
||||
|
||||
|
||||
"""post"""
|
||||
|
||||
|
||||
@router.post("/get_financial_account", response_model=List[schemas.ReportTOFinancialAccount])
|
||||
def get_financial_account(request: schemas.PersonalAccountInit, db: Session = Depends(get_db)):
|
||||
data = crud.PersonalAccountViewSet.get_financial_account(db, request)
|
||||
return schemas.ReportTOFinancialAccount(**data)
|
Reference in New Issue
Block a user