File size: 444 Bytes
78fefe8
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from fastapi import APIRouter, HTTPException
from ..models.model_c import CVInput
from ..logic.calc_c   import calculate_all_c

router = APIRouter()

@router.post("/calculate/c")
def calc_c(input: CVInput):
    cathode_name = input.cathode_name
    # Q–V match check
    if len(input.V_qv) != len(input.Q_qv):
        raise HTTPException(400, "V_qv and Q_qv must have the same length")

    return calculate_all_c(cathode_name, input.dict())