feat: Enhance logging and add chart endpoints
- Updated LoggerDB to remove all active sinks on initialization. - Added a new PostgresCredencial setup in notas_mmr.py for database connection. - Replaced print statements with logger calls for better logging in notas_mmr.py. - Introduced new FastAPI endpoints for various chart types (bar, line, pie, scatter). - Created Editor_biblioteca.css for styling the rich text editor. - Implemented Editor_Test.tsx to test the rich text editor functionality.
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
from fastapi import APIRouter
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.get("/bar")
|
||||
def get_bar_chart():
|
||||
return {
|
||||
"xAxis": {"type": "category", "data": ["Ene", "Feb", "Mar", "Abr"]},
|
||||
"yAxis": {"type": "value"},
|
||||
"series": [{"data": [5, 20, 36, 10], "type": "bar"}]
|
||||
}
|
||||
|
||||
@router.get("/line")
|
||||
def get_line_chart():
|
||||
return {
|
||||
"xAxis": {"type": "category", "data": ["Semana 1", "Semana 2", "Semana 3", "Semana 4"]},
|
||||
"yAxis": {"type": "value"},
|
||||
"series": [{"data": [15, 25, 18, 30], "type": "line"}]
|
||||
}
|
||||
|
||||
@router.get("/pie")
|
||||
def get_pie_chart():
|
||||
return {
|
||||
"tooltip": {"trigger": "item"},
|
||||
"legend": {"top": "5%", "left": "center"},
|
||||
"series": [{
|
||||
"name": "Accesos",
|
||||
"type": "pie",
|
||||
"radius": ["40%", "70%"],
|
||||
"avoidLabelOverlap": False,
|
||||
"itemStyle": {"borderRadius": 10, "borderColor": "#fff", "borderWidth": 2},
|
||||
"label": {"show": False, "position": "center"},
|
||||
"emphasis": {
|
||||
"label": {"show": True, "fontSize": 16, "fontWeight": "bold"}
|
||||
},
|
||||
"labelLine": {"show": False},
|
||||
"data": [
|
||||
{"value": 1048, "name": "Search"},
|
||||
{"value": 735, "name": "Direct"},
|
||||
{"value": 580, "name": "Email"},
|
||||
{"value": 484, "name": "Union Ads"},
|
||||
{"value": 300, "name": "Video Ads"}
|
||||
]
|
||||
}]
|
||||
}
|
||||
|
||||
@router.get("/scatter")
|
||||
def get_scatter_chart():
|
||||
return {
|
||||
"xAxis": {},
|
||||
"yAxis": {},
|
||||
"series": [{
|
||||
"symbolSize": 20,
|
||||
"data": [[10, 8], [20, 20], [30, 10], [40, 30], [50, 15]],
|
||||
"type": "scatter"
|
||||
}]
|
||||
}
|
||||
@@ -8,6 +8,10 @@ from backend.db.conexion import get_conexion
|
||||
from backend.services.text_manager_srvc import *
|
||||
from src.ConexionSql.Postgres_conexion import PostgresConexion
|
||||
|
||||
from entrypoint.init_db import db_credencial
|
||||
from src.Logger.logger_db import LoggerDB, logger
|
||||
LoggerDB(db_credencial, "logger_textos", created_by="sistema")
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
# backend/api/router.py
|
||||
|
||||
from fastapi import APIRouter
|
||||
from backend.api.v1.endpoints import ping, text_manager_endpoint
|
||||
from backend.api.v1.endpoints import ping, text_manager_endpoint, charts_examples as charts
|
||||
|
||||
|
||||
router = APIRouter()
|
||||
router.include_router(ping.router, prefix="/api/v1/ping")
|
||||
router.include_router(text_manager_endpoint.router, prefix="/api/v1/text_manager")
|
||||
router.include_router(charts.router, prefix="/api/v1/charts")
|
||||
|
||||
Reference in New Issue
Block a user