feat: add ESLint and Prettier configuration for code quality

- Added ESLint with TypeScript support and custom rules.
- Introduced Prettier for consistent code formatting.
- Updated package.json to include lint and format scripts.
- Modified db.ts to ensure proper parsing of BIGINT types from PostgreSQL.
- Enhanced webRoutes to coerce timestamp fields to numbers and format isDeleted as boolean.
This commit is contained in:
2025-10-25 17:33:48 +02:00
parent 09a2b09913
commit 14c80197cc
13 changed files with 1620 additions and 44 deletions
+20 -3
View File
@@ -313,9 +313,26 @@ router.get('/web/data', async (req: Request, res: Response) => {
const values = await dbAdapter.queryAll('SELECT * FROM item_values');
// Convert isDeleted from INTEGER to BOOLEAN
const formattedLists = (lists as any[]).map(list => ({ ...list, isDeleted: !!list.isDeleted }));
const formattedFields = (fields as any[]).map(field => ({ ...field, isDeleted: !!field.isDeleted }));
const formattedItems = (items as any[]).map(item => ({ ...item, isDeleted: !!item.isDeleted }));
// Coerce timestamps to numbers (pg may return strings)
const toNum = (v: any) => (typeof v === 'string' ? Number(v) : v);
const formattedLists = (lists as any[]).map(list => ({
...list,
isDeleted: !!list.isDeleted,
createdAt: toNum(list.createdAt),
updatedAt: toNum(list.updatedAt)
}));
const formattedFields = (fields as any[]).map(field => ({
...field,
isDeleted: !!field.isDeleted,
createdAt: toNum(field.createdAt),
updatedAt: toNum(field.updatedAt)
}));
const formattedItems = (items as any[]).map(item => ({
...item,
isDeleted: !!item.isDeleted,
createdAt: toNum(item.createdAt),
updatedAt: toNum(item.updatedAt)
}));
res.json({
lists: formattedLists,