Database Error: Non-Existent loans Table in Queries
- Title:
[Bug][Backend] adminDisputeController & loanController query non-existent 'loans' table
- Labels:
bug, backend, database, high
- Location:
backend/src/controllers/adminDisputeController.ts:131, backend/src/controllers/loanController.ts:58, 91
- Description:
Queries attempt JOIN loans l ON l.id = d.loan_id and SELECT * FROM loans WHERE id = $1. The PostgreSQL schema derives loan state from contract_events and does not have a loans table.
- Impact:
Endpoints GET /admin/loan-disputes/:disputeId, POST /api/loans/:loanId/build-cancel, and POST /admin/loans/:loanId/build-reject crash with relation "loans" does not exist.
- Suggested Fix:
Update queries to aggregate loan state from contract_events.
Backend Analytics & Logic
Issue #10
Database Error: Non-Existent
loansTable in Queries[Bug][Backend] adminDisputeController & loanController query non-existent 'loans' tablebug,backend,database,highbackend/src/controllers/adminDisputeController.ts:131,backend/src/controllers/loanController.ts:58, 91Queries attempt
JOIN loans l ON l.id = d.loan_idandSELECT * FROM loans WHERE id = $1. The PostgreSQL schema derives loan state fromcontract_eventsand does not have aloanstable.Endpoints
GET /admin/loan-disputes/:disputeId,POST /api/loans/:loanId/build-cancel, andPOST /admin/loans/:loanId/build-rejectcrash withrelation "loans" does not exist.Update queries to aggregate loan state from
contract_events.Backend Analytics & Logic