Skip to content

Commit 100668a

Browse files
committed
Refactor logging and value handling in services for improved clarity
- Updated customLogger calls in projects.service.ts to handle stackId more consistently. - Simplified value handling in entries.service.ts to avoid unnecessary null checks. - Adjusted contentTypeMapper.js to initialize displayType more clearly. - Modified drupal validator to streamline database query execution and logging.
1 parent 7d9ce70 commit 100668a

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

api/src/services/drupal/entries.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ const processFieldByType = (
363363
'Failed to convert JSON RTE to single line text:',
364364
error
365365
);
366-
return String(value || '');
366+
return String(value);
367367
}
368368
} else if (typeof value === 'string') {
369369
if (/<\/?[a-z][\s\S]*>/i.test(value)) {
@@ -377,7 +377,7 @@ const processFieldByType = (
377377
// Multi-line to single line
378378
return value.replace(/\s+/g, ' ').trim();
379379
}
380-
return String(value || '');
380+
return String(value);
381381
}
382382

383383
case 'text':
@@ -402,7 +402,7 @@ const processFieldByType = (
402402
);
403403
} catch (error) {
404404
console.error('Failed to convert JSON RTE to HTML:', error);
405-
return String(value || '');
405+
return String(value);
406406
}
407407
}
408408
// HTML and plain text can stay as-is for multi-line

api/src/services/projects.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@ const generateQueriesWithRetry = async (
985985
`No ${stackType} stack ID found, skipping query generation`,
986986
token_payload
987987
);
988-
await customLogger(projectId, stackId || 'unknown', 'warn', message);
988+
await customLogger(projectId, stackId, 'warn', message);
989989
return true; // Skip if no stack ID
990990
}
991991

upload-api/migration-drupal/libs/contentTypeMapper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ const createDropdownOrRadioFieldObject = (
244244
numericType = null
245245
) => {
246246
// Determine display type and multiple based on CSV scenarios
247-
let displayType = 'dropdown';
247+
let displayType;
248248
let multiple = false;
249249

250250
// Map based on CSV scenarios from drupal_field_mapping.csv

upload-api/src/validators/drupal/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ async function drupalValidator({
325325
const nodeFieldDataQuery = 'SELECT COUNT(*) as count FROM node_field_data LIMIT 1';
326326

327327
try {
328-
const [nodeRows] = await connection.execute(nodeFieldDataQuery);
328+
await connection.execute(nodeFieldDataQuery);
329329
logger.info('Drupal validator: node_field_data table exists and accessible');
330330
} catch (nodeError: any) {
331331
logger.error('Drupal validator: node_field_data table check failed', {

0 commit comments

Comments
 (0)