22 lines
684 B
Python
22 lines
684 B
Python
# backend/api/v1/biblioteca.py
|
|
from fastapi import APIRouter, Depends
|
|
from pydantic import BaseModel
|
|
from backend.db.conexion import get_conexion
|
|
from backend.services.text_manager import crear_biblioteca
|
|
from src.ConexionSql.Postgres_conexion import PostgresConexion
|
|
|
|
router = APIRouter()
|
|
|
|
class BibliotecaInput(BaseModel):
|
|
nombre_biblioteca: str
|
|
descripcion: str
|
|
|
|
@router.post("/")
|
|
def crear_biblioteca_endpoint(
|
|
data: BibliotecaInput,
|
|
conexion: PostgresConexion = Depends(get_conexion)
|
|
):
|
|
return crear_biblioteca(nombre_biblioteca=data.nombre_biblioteca,
|
|
descripcion=data.descripcion,
|
|
conexion=conexion)
|