Update modules/database/sql_db.py
Browse files- modules/database/sql_db.py +6 -14
modules/database/sql_db.py
CHANGED
@@ -266,16 +266,11 @@ def delete_student_user(username):
|
|
266 |
logger.error(f"Error al eliminar estudiante {username}: {str(e)}")
|
267 |
return False
|
268 |
|
|
|
|
|
269 |
def store_application_request(name, lastname, email, institution, current_role, desired_role, reason):
|
270 |
-
|
271 |
try:
|
272 |
-
# Obtener el contenedor - sin desempaquetado
|
273 |
-
container = get_container("application_requests")
|
274 |
-
if not container:
|
275 |
-
logger.error("No se pudo obtener el contenedor de solicitudes")
|
276 |
-
return False
|
277 |
-
|
278 |
-
# Crear el documento con la solicitud
|
279 |
application_request = {
|
280 |
"id": str(uuid.uuid4()),
|
281 |
"name": name,
|
@@ -285,19 +280,16 @@ def store_application_request(name, lastname, email, institution, current_role,
|
|
285 |
"current_role": current_role,
|
286 |
"desired_role": desired_role,
|
287 |
"reason": reason,
|
288 |
-
"requestDate": datetime.utcnow().isoformat()
|
289 |
-
"partitionKey": email # Necesario para CosmosDB
|
290 |
}
|
291 |
-
|
292 |
-
# Crear el item en el contenedor
|
293 |
-
container.create_item(body=application_request)
|
294 |
logger.info(f"Solicitud de aplicaci贸n almacenada para el email: {email}")
|
295 |
return True
|
296 |
-
|
297 |
except Exception as e:
|
298 |
logger.error(f"Error al almacenar la solicitud de aplicaci贸n: {str(e)}")
|
299 |
return False
|
300 |
|
|
|
301 |
def store_student_feedback(username, name, email, feedback):
|
302 |
_, _, user_feedback_container = get_sql_containers()
|
303 |
try:
|
|
|
266 |
logger.error(f"Error al eliminar estudiante {username}: {str(e)}")
|
267 |
return False
|
268 |
|
269 |
+
|
270 |
+
############################################
|
271 |
def store_application_request(name, lastname, email, institution, current_role, desired_role, reason):
|
272 |
+
_, application_requests_container, _ = get_sql_containers()
|
273 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
274 |
application_request = {
|
275 |
"id": str(uuid.uuid4()),
|
276 |
"name": name,
|
|
|
280 |
"current_role": current_role,
|
281 |
"desired_role": desired_role,
|
282 |
"reason": reason,
|
283 |
+
"requestDate": datetime.utcnow().isoformat()
|
|
|
284 |
}
|
285 |
+
application_requests_container.create_item(body=application_request)
|
|
|
|
|
286 |
logger.info(f"Solicitud de aplicaci贸n almacenada para el email: {email}")
|
287 |
return True
|
|
|
288 |
except Exception as e:
|
289 |
logger.error(f"Error al almacenar la solicitud de aplicaci贸n: {str(e)}")
|
290 |
return False
|
291 |
|
292 |
+
#########################################################
|
293 |
def store_student_feedback(username, name, email, feedback):
|
294 |
_, _, user_feedback_container = get_sql_containers()
|
295 |
try:
|