Remove a few any types from database

This commit is contained in:
Nate Kelley 2025-07-07 09:40:06 -06:00
parent 9637fbad86
commit 1bf8418ab8
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
3 changed files with 9 additions and 24 deletions

View File

@ -131,16 +131,6 @@
}
}
},
{
"include": ["packages/database/**/*.ts"],
"linter": {
"rules": {
"suspicious": {
"noExplicitAny": "off"
}
}
}
},
{
"include": ["**/*.js"],
"linter": {

View File

@ -13,7 +13,7 @@
"useImportType": "off"
},
"suspicious": {
"noExplicitAny": "off"
"noExplicitAny": "error"
}
}
}

View File

@ -199,22 +199,17 @@ export async function updateChat(
throw new Error(`Chat not found or has been deleted: ${chatId}`);
}
// Build update object with only provided fields
const updateData: Partial<UpdateableChatFields> & { updatedAt: string } = {
// Build update object with only provided fields, filtering out protected fields
const updateData = {
updatedAt: new Date().toISOString(),
...Object.fromEntries(
Object.entries(fields).filter(
([key, value]) =>
value !== undefined && key !== 'id' && key !== 'createdAt' && key !== 'deletedAt'
)
),
};
// Only add fields that are actually provided (not undefined)
for (const [key, value] of Object.entries(fields)) {
if (value !== undefined && key !== 'id' && key !== 'createdAt' && key !== 'deletedAt') {
updateData[key] = value;
}
}
// If updatedAt was explicitly provided, use that instead
if ('updatedAt' in fields && fields.updatedAt !== undefined) {
updateData.updatedAt = fields.updatedAt;
}
await db
.update(chats)