refactor: use strict typing

This commit is contained in:
Carlos Valente
2025-03-21 19:44:16 +01:00
committed by arc-alex
parent 14a7c04d3b
commit d48b2ae506
39 changed files with 339 additions and 246 deletions
@@ -25,10 +25,11 @@ export async function requestConnection(
res: Response<{ verification_url: string; user_code: string } | ErrorResponse>,
) {
const { sheetId } = req.params;
const file = req.file.path;
// the check for the file is done in the validation middleware
const filePath = (req.file as Express.Multer.File).path;
try {
const client = readFileSync(file, 'utf-8');
const client = readFileSync(filePath, 'utf-8');
const clientSecret = handleClientSecret(client);
const { verification_url, user_code } = await handleInitialConnection(clientSecret, sheetId);
@@ -40,7 +41,7 @@ export async function requestConnection(
// delete uploaded file after parsing
try {
deleteFile(file);
await deleteFile(filePath);
} catch (_error) {
/** we dont handle failure here */
}