Update routes/support.py
Browse files- routes/support.py +3 -1
routes/support.py
CHANGED
@@ -286,6 +286,7 @@ async def respond_ticket(
|
|
286 |
ticket = ticket_data[0]
|
287 |
|
288 |
support_id = ticket.get("support_id")
|
|
|
289 |
|
290 |
# 2. Verificar/Atribuir suporte
|
291 |
if support_id is None:
|
@@ -312,7 +313,8 @@ async def respond_ticket(
|
|
312 |
if patch_resp.status != 200:
|
313 |
raise HTTPException(status_code=500, detail="Erro ao atribuir o suporte ao ticket")
|
314 |
else:
|
315 |
-
|
|
|
316 |
raise HTTPException(status_code=403, detail="Ticket já está atribuído a outro suporte")
|
317 |
|
318 |
# 3. Espera 1 segundo antes de enviar a mensagem
|
|
|
286 |
ticket = ticket_data[0]
|
287 |
|
288 |
support_id = ticket.get("support_id")
|
289 |
+
ticket_creator_id = ticket.get("user")
|
290 |
|
291 |
# 2. Verificar/Atribuir suporte
|
292 |
if support_id is None:
|
|
|
313 |
if patch_resp.status != 200:
|
314 |
raise HTTPException(status_code=500, detail="Erro ao atribuir o suporte ao ticket")
|
315 |
else:
|
316 |
+
# Permitir exceção se o usuário for o criador do ticket
|
317 |
+
if support_id != user_id and user_id != ticket_creator_id:
|
318 |
raise HTTPException(status_code=403, detail="Ticket já está atribuído a outro suporte")
|
319 |
|
320 |
# 3. Espera 1 segundo antes de enviar a mensagem
|