ultima versao api

This commit is contained in:
ka-lucas 2025-05-02 16:04:29 -03:00
parent d5ca0d4991
commit 3b92c7b13e

View File

@ -106,8 +106,9 @@ def list_shifts():
"interval_end": shift.interval_end.strftime("%H:%M") if shift.interval_end else None, "interval_end": shift.interval_end.strftime("%H:%M") if shift.interval_end else None,
'type_interval': shift.type_interval, 'type_interval': shift.type_interval,
'service_instance_id': shift.service_instance_id, 'service_instance_id': shift.service_instance_id,
'description': shift.description, # Adicionando a descrição 'description': shift.description,
'tolerance': shift.tolerance, # Adicionando a tolerância 'tolerance': shift.tolerance,
# Adicionando a tolerância
# Adicionando os dias associados (TimeSchedules) # Adicionando os dias associados (TimeSchedules)
@ -129,12 +130,17 @@ def get_shift_id(shift_id):
return jsonify({ return jsonify({
'id': shift.id, 'id': shift.id,
'name': shift.name, 'name': shift.name,
'day': shift.day, #'day': shift.day,
"start_time": shift.start_time.strftime("%H:%M"), "start_time": shift.start_time.strftime("%H:%M"),
"end_time": shift.end_time.strftime("%H:%M"), "end_time": shift.end_time.strftime("%H:%M"),
"interval_start": shift.interval_start.strftime("%H:%M") if shift.interval_start else None, "interval_start": shift.interval_start.strftime("%H:%M") if shift.interval_start else None,
"interval_end": shift.interval_end.strftime("%H:%M") if shift.interval_end else None, "interval_end": shift.interval_end.strftime("%H:%M") if shift.interval_end else None,
'type_interval' : shift.type_interval, 'type_interval' : shift.type_interval,
'description': shift.description,
'tolerance': shift.tolerance,
'time_schedules': [
{'id': ts.id, 'name': ts.name} for ts in shift.time_schedules
],
'service_instance_id': shift.service_instance_id}),200 'service_instance_id': shift.service_instance_id}),200