fix(qa): resolver diagnosticos estaticos, sincronizacion moodle y actualizar docs v3.6.4
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from flask import Blueprint, jsonify, request, g
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timezone
|
||||
import re
|
||||
from app.utils.jwt_decorators import jwt_required
|
||||
from app.models.user import User
|
||||
@@ -599,7 +599,17 @@ def create_role():
|
||||
data = request.get_json(silent=True) or request.form.to_dict() or {}
|
||||
name = data.get('name', '').strip()
|
||||
description = data.get('description', '').strip()
|
||||
permissions = data.get('permissions', {})
|
||||
raw_perms = data.get('permissions', {})
|
||||
if isinstance(raw_perms, str):
|
||||
try:
|
||||
import json
|
||||
permissions = json.loads(raw_perms)
|
||||
except Exception:
|
||||
permissions = {}
|
||||
elif isinstance(raw_perms, dict):
|
||||
permissions = raw_perms
|
||||
else:
|
||||
permissions = {}
|
||||
|
||||
if not name:
|
||||
return jsonify({'error': 'ValidationError', 'message': 'El nombre del rol es obligatorio.'}), 400
|
||||
@@ -1938,7 +1948,7 @@ def get_all_settings():
|
||||
|
||||
smtp_config = {
|
||||
'host': SystemSetting.get_value('smtp_host', 'smtp.gmail.com'),
|
||||
'port': int(SystemSetting.get_value('smtp_port', 587)),
|
||||
'port': int(SystemSetting.get_value('smtp_port', 587) or 587),
|
||||
'user': SystemSetting.get_value('smtp_user', ''),
|
||||
'password': SystemSetting.get_masked_value('smtp_password', ''),
|
||||
'security': SystemSetting.get_value('smtp_security', 'STARTTLS'),
|
||||
@@ -1966,9 +1976,9 @@ def get_all_settings():
|
||||
moodle_config = {
|
||||
'server_url': SystemSetting.get_value('moodle_server_url', 'http://10.0.0.207/moodle'),
|
||||
'ws_token': SystemSetting.get_masked_value('moodle_ws_token', ''),
|
||||
'timeout': int(SystemSetting.get_value('moodle_timeout', 10)),
|
||||
'timeout': int(SystemSetting.get_value('moodle_timeout', 10) or 10),
|
||||
'auto_sync_enabled': SystemSetting.get_value('moodle_auto_sync_enabled', 'true') in ['true', 'True', '1', True],
|
||||
'sync_interval_minutes': int(SystemSetting.get_value('moodle_sync_interval_minutes', 15))
|
||||
'sync_interval_minutes': int(SystemSetting.get_value('moodle_sync_interval_minutes', 15) or 15)
|
||||
}
|
||||
|
||||
ui_config = {
|
||||
@@ -2051,13 +2061,14 @@ def test_smtp_connection():
|
||||
test_recipient = data.get('test_email') or g.jwt_user.email
|
||||
|
||||
host = data.get('host') or SystemSetting.get_value('smtp_host', 'smtp.gmail.com')
|
||||
port = int(data.get('port') or SystemSetting.get_value('smtp_port', 587))
|
||||
port = int(data.get('port') or SystemSetting.get_value('smtp_port', 587) or 587)
|
||||
user = data.get('user') or SystemSetting.get_value('smtp_user', '')
|
||||
password = data.get('password')
|
||||
if not password or password == '••••••••••••':
|
||||
password = SystemSetting.get_decrypted_value('smtp_password', '')
|
||||
security = (data.get('security') or SystemSetting.get_value('smtp_security', 'STARTTLS')).upper()
|
||||
sender_email = data.get('sender_email') or SystemSetting.get_value('smtp_sender_email', user)
|
||||
security_val = data.get('security') or SystemSetting.get_value('smtp_security', 'STARTTLS') or 'STARTTLS'
|
||||
security = str(security_val).upper()
|
||||
sender_email = str(data.get('sender_email') or SystemSetting.get_value('smtp_sender_email', user) or 'notificaciones@unicaba.edu.ar')
|
||||
sender_name = data.get('sender_name') or SystemSetting.get_value('smtp_sender_name', 'Edu-Space UniCABA')
|
||||
|
||||
if not host or not port:
|
||||
@@ -2719,7 +2730,7 @@ def update_building(id):
|
||||
building.is_active = is_active.lower() in ['true', '1', 'on']
|
||||
else:
|
||||
building.is_active = bool(is_active)
|
||||
building.updated_at = datetime.utcnow()
|
||||
building.updated_at = datetime.now(timezone.utc).replace(tzinfo=None)
|
||||
|
||||
if old_name != name:
|
||||
Classroom.query.filter_by(building_id=building.id).update({'building': name})
|
||||
@@ -2750,7 +2761,7 @@ def toggle_building(id):
|
||||
return jsonify({'error': 'NotFound', 'message': f'Edificio con ID {id} no encontrado.'}), 404
|
||||
|
||||
building.is_active = not building.is_active
|
||||
building.updated_at = datetime.utcnow()
|
||||
building.updated_at = datetime.now(timezone.utc).replace(tzinfo=None)
|
||||
db.session.commit()
|
||||
|
||||
AuditService.log(
|
||||
|
||||
@@ -7,7 +7,7 @@ OPENAPI_SPEC = {
|
||||
"info": {
|
||||
"title": "Edu-Space REST API",
|
||||
"description": "Enterprise Academic & Physical Space Management REST API with JWT Authentication and Role-Based Access Control.",
|
||||
"version": "3.6.3"
|
||||
"version": "3.6.4"
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from flask import Blueprint, request, jsonify, g
|
||||
from datetime import datetime, timedelta, date
|
||||
from datetime import datetime, timedelta, date, timezone
|
||||
from pydantic import ValidationError
|
||||
|
||||
from app import db
|
||||
@@ -20,7 +20,7 @@ def list_reservations():
|
||||
end_str = request.args.get('end_date')
|
||||
classroom_id = request.args.get('classroom_id', type=int)
|
||||
|
||||
now = datetime.utcnow()
|
||||
now = datetime.now(timezone.utc).replace(tzinfo=None)
|
||||
try:
|
||||
start_dt = datetime.strptime(start_str, '%Y-%m-%d') if start_str else now.replace(hour=0, minute=0, second=0)
|
||||
except ValueError:
|
||||
@@ -42,7 +42,7 @@ def list_reservations():
|
||||
is_virt = bool(r.is_virtual or (r.classroom and r.classroom.is_virtual))
|
||||
if hide_virtual and is_virt:
|
||||
continue
|
||||
if floor and r.classroom and str(r.classroom.floor).strip().lower() != str(floor).strip().lower():
|
||||
if floor and r.classroom and str(r.classroom.floor or '').strip().lower() != floor.strip().lower():
|
||||
continue
|
||||
if shift and r.shift and shift.lower() not in r.shift.lower():
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user