Fix NocoDB PATCH API format and reduce Wren portfolio logging
All checks were successful
Build and Push Docker Images / docker (push) Successful in 2m27s

- Fix updateOrder() in nocodbClient.js to use NocoDB v2 API format
  (PATCH to base endpoint with Id in body, not in URL path)
- Remove verbose portfolio details logging from wrenClient.js
  (keep only summary: status, duration, portfolio count)

Resolves NocoDB fulfillment update error: Cannot PATCH .../records/3

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Matt 2025-11-03 16:54:04 +01:00
parent dc4506156c
commit 4e08e649da
2 changed files with 6 additions and 23 deletions

View File

@ -66,11 +66,15 @@ class NocoDBClient {
/**
* Update order fields
* NocoDB v2 API requires the ID in the body, not the URL
*/
async updateOrder(recordId, data) {
return this.request(`/${recordId}`, {
return this.request('', {
method: 'PATCH',
body: JSON.stringify(data),
body: JSON.stringify({
Id: recordId,
...data,
}),
});
}

View File

@ -166,27 +166,6 @@ export async function getWrenPortfolios() {
console.log('✅ [WREN API SERVER] Status:', response.status);
console.log('✅ [WREN API SERVER] Duration:', duration + 'ms');
console.log('✅ [WREN API SERVER] Portfolios count:', response.data?.portfolios?.length || 0);
// Log detailed portfolio and project information including certification status
if (response.data?.portfolios?.length > 0) {
console.log('📊 [WREN API SERVER] Portfolio Details:');
response.data.portfolios.forEach((portfolio, idx) => {
console.log(` Portfolio ${idx + 1}: "${portfolio.name}" (ID: ${portfolio.id})`);
console.log(` ├─ Cost per ton: $${portfolio.cost_per_ton}`);
console.log(` └─ Projects (${portfolio.projects?.length || 0}):`);
if (portfolio.projects?.length > 0) {
portfolio.projects.forEach((project, pIdx) => {
console.log(` ${pIdx + 1}. "${project.name}"`);
console.log(` ├─ Certification: ${project.certification_status || 'N/A'}`);
console.log(` ├─ Cost per ton: $${project.cost_per_ton || 'N/A'}`);
console.log(` └─ Percentage: ${project.percentage ? (project.percentage * 100).toFixed(1) + '%' : 'N/A'}`);
});
}
console.log('');
});
}
console.log('🔵 [WREN API SERVER] ========================================');
return response.data?.portfolios || [];