kamau1 commited on
Commit
bb1483f
·
1 Parent(s): 4c66bec

fix(models): restore Base inheritance to TicketStatusHistory model

Browse files

- Re-add Base inheritance to TicketStatusHistory class for proper SQLAlchemy ORM registration
- Import Base from app.core.database module
- Update devlog with additional runtime error logs showing mapper initialization failures
- Resolves SQLAlchemy mapper initialization errors when TicketStatusHistory relationship is referenced in Ticket model

docs/devlogs/server/runtimeerror.txt CHANGED
@@ -44,4 +44,29 @@ INFO: 2025-11-30T10:08:39 - app.core.supabase_auth: User signed in successfully:
44
  ERROR: 2025-11-30T10:08:39 - app.api.v1.auth: Login error: One or more mappers failed to initialize - can't proceed with initialization of other mappers. Triggering mapper: 'Mapper[Ticket(tickets)]'. Original exception was: When initializing mapper Mapper[Ticket(tickets)], expression 'TicketStatusHistory' failed to locate a name ('TicketStatusHistory'). If this is a class name, consider adding this relationship() to the <class 'app.models.ticket.Ticket'> class after both dependent classes have been defined.
45
  ERROR: 2025-11-30T10:08:39 - app.services.audit_service: Failed to create audit log: One or more mappers failed to initialize - can't proceed with initialization of other mappers. Triggering mapper: 'Mapper[Ticket(tickets)]'. Original exception was: When initializing mapper Mapper[Ticket(tickets)], expression 'TicketStatusHistory' failed to locate a name ('TicketStatusHistory'). If this is a class name, consider adding this relationship() to the <class 'app.models.ticket.Ticket'> class after both dependent classes have been defined.
46
  INFO: 10.16.25.209:28616 - "POST /api/v1/auth/login HTTP/1.1" 401 Unauthorized
47
- INFO: 10.16.34.155:12295 - "GET /health HTTP/1.1" 200 OK
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  ERROR: 2025-11-30T10:08:39 - app.api.v1.auth: Login error: One or more mappers failed to initialize - can't proceed with initialization of other mappers. Triggering mapper: 'Mapper[Ticket(tickets)]'. Original exception was: When initializing mapper Mapper[Ticket(tickets)], expression 'TicketStatusHistory' failed to locate a name ('TicketStatusHistory'). If this is a class name, consider adding this relationship() to the <class 'app.models.ticket.Ticket'> class after both dependent classes have been defined.
45
  ERROR: 2025-11-30T10:08:39 - app.services.audit_service: Failed to create audit log: One or more mappers failed to initialize - can't proceed with initialization of other mappers. Triggering mapper: 'Mapper[Ticket(tickets)]'. Original exception was: When initializing mapper Mapper[Ticket(tickets)], expression 'TicketStatusHistory' failed to locate a name ('TicketStatusHistory'). If this is a class name, consider adding this relationship() to the <class 'app.models.ticket.Ticket'> class after both dependent classes have been defined.
46
  INFO: 10.16.25.209:28616 - "POST /api/v1/auth/login HTTP/1.1" 401 Unauthorized
47
+ INFO: 10.16.34.155:12295 - "GET /health HTTP/1.1" 200 OK
48
+ INFO: 10.16.6.70:18122 - "GET /health HTTP/1.1" 200 OK
49
+ INFO: 10.16.6.70:5588 - "GET /health HTTP/1.1" 200 OK
50
+ INFO: 10.16.25.209:12555 - "GET /health HTTP/1.1" 200 OK
51
+ INFO: 10.16.6.70:58652 - "GET /health HTTP/1.1" 200 OK
52
+ INFO: 10.16.18.114:8697 - "GET /health HTTP/1.1" 200 OK
53
+ INFO: 10.16.6.70:7897 - "GET /health HTTP/1.1" 200 OK
54
+ INFO: 10.16.6.70:39538 - "GET /health HTTP/1.1" 200 OK
55
+ INFO: 10.16.11.176:6264 - "GET /health HTTP/1.1" 200 OK
56
+ INFO: 10.16.6.70:5580 - "GET /health HTTP/1.1" 200 OK
57
+ INFO: 10.16.25.209:28827 - "GET /health HTTP/1.1" 200 OK
58
+ INFO: 10.16.34.155:27217 - "GET /health HTTP/1.1" 200 OK
59
+ INFO: 10.16.6.70:44523 - "GET /health HTTP/1.1" 200 OK
60
+ INFO: 10.16.34.155:25939 - "GET /health HTTP/1.1" 200 OK
61
+ INFO: 10.16.34.155:3936 - "GET /health HTTP/1.1" 200 OK
62
+ INFO: 10.16.6.70:62519 - "GET /health HTTP/1.1" 200 OK
63
+ INFO: 10.16.11.176:51920 - "GET /health HTTP/1.1" 200 OK
64
+ INFO: 10.16.18.114:28609 - "GET /health HTTP/1.1" 200 OK
65
+ INFO: 10.16.11.176:8729 - "GET / HTTP/1.1" 200 OK
66
+ INFO: 10.16.34.155:40138 - "GET /health HTTP/1.1" 200 OK
67
+ INFO: 2025-11-30T10:16:27 - app.core.supabase_auth: User signed in successfully: viyisa8151@feralrex.com
68
+ ERROR: 2025-11-30T10:16:27 - app.api.v1.auth: Login error: One or more mappers failed to initialize - can't proceed with initialization of other mappers. Triggering mapper: 'Mapper[Ticket(tickets)]'. Original exception was: When initializing mapper Mapper[Ticket(tickets)], expression 'TicketStatusHistory' failed to locate a name ('TicketStatusHistory'). If this is a class name, consider adding this relationship() to the <class 'app.models.ticket.Ticket'> class after both dependent classes have been defined.
69
+ ERROR: 2025-11-30T10:16:27 - app.services.audit_service: Failed to create audit log: One or more mappers failed to initialize - can't proceed with initialization of other mappers. Triggering mapper: 'Mapper[Ticket(tickets)]'. Original exception was: When initializing mapper Mapper[Ticket(tickets)], expression 'TicketStatusHistory' failed to locate a name ('TicketStatusHistory'). If this is a class name, consider adding this relationship() to the <class 'app.models.ticket.Ticket'> class after both dependent classes have been defined.
70
+ INFO: 10.16.6.70:22674 - "POST /api/v1/auth/login HTTP/1.1" 401 Unauthorized
71
+ INFO: 10.16.6.70:30069 - "GET /health HTTP/1.1" 200 OK
72
+ INFO: 10.16.25.209:49805 - "GET /health HTTP/1.1" 200 OK
src/app/models/ticket_status_history.py CHANGED
@@ -14,10 +14,11 @@ from typing import Optional
14
  from sqlalchemy import Column, Text, Boolean, DateTime, DECIMAL, ForeignKey
15
  from sqlalchemy.dialects.postgresql import UUID, JSONB
16
  from sqlalchemy.orm import relationship
 
17
  import uuid
18
 
19
 
20
- class TicketStatusHistory:
21
  """
22
  Ticket Status History - Audit trail of all ticket status changes
23
 
 
14
  from sqlalchemy import Column, Text, Boolean, DateTime, DECIMAL, ForeignKey
15
  from sqlalchemy.dialects.postgresql import UUID, JSONB
16
  from sqlalchemy.orm import relationship
17
+ from app.core.database import Base
18
  import uuid
19
 
20
 
21
+ class TicketStatusHistory(Base):
22
  """
23
  Ticket Status History - Audit trail of all ticket status changes
24