fix: taskfile fetching bug fixes

This commit is contained in:
mrjvs 2025-09-14 21:19:45 +02:00
parent 77f2765f8e
commit 0302cb0b39
2 changed files with 8 additions and 7 deletions

View File

@ -69,7 +69,7 @@ export function getTaskFiles(allowDeleted: boolean, bossAppID: string, taskID: s
filter.$and?.push({
$or: [
{ supported_countries: { $eq: [] } },
{ supported_countries: { $in: [country] } }
{ supported_countries: country }
]
});
}
@ -78,7 +78,7 @@ export function getTaskFiles(allowDeleted: boolean, bossAppID: string, taskID: s
filter.$and?.push({
$or: [
{ supported_languages: { $eq: [] } },
{ supported_languages: { $in: [language] } }
{ supported_languages: language }
]
});
}
@ -107,7 +107,7 @@ export function getTaskFilesWithAttributes(allowDeleted: boolean, bossAppID: str
filter.$and?.push({
$or: [
{ supported_countries: { $eq: [] } },
{ supported_countries: { $in: [country] } }
{ supported_countries: country }
]
});
}
@ -116,7 +116,7 @@ export function getTaskFilesWithAttributes(allowDeleted: boolean, bossAppID: str
filter.$and?.push({
$or: [
{ supported_languages: { $eq: [] } },
{ supported_languages: { $in: [language] } }
{ supported_languages: language }
]
});
}
@ -155,7 +155,7 @@ export function getTaskFile(bossAppID: string, taskID: string, name: string, cou
filter.$and?.push({
$or: [
{ supported_countries: { $eq: [] } },
{ supported_countries: { $in: [country] } }
{ supported_countries: country }
]
});
}
@ -164,7 +164,7 @@ export function getTaskFile(bossAppID: string, taskID: string, name: string, cou
filter.$and?.push({
$or: [
{ supported_languages: { $eq: [] } },
{ supported_languages: { $in: [language] } }
{ supported_languages: language }
]
});
}

View File

@ -95,13 +95,13 @@ export async function uploadFile(request: UploadFileRequest, context: CallContex
const contentHash = md5(encryptedData);
// * Upload file first to prevent ghost DB entries on upload failures
const key = `${bossAppID}/${taskID}/${contentHash}`;
try {
// * Some tasks have file names which are dynamic.
// * They change depending on the files data ID.
// * Because of this, using the file name in the
// * upload key is not viable, as it is not always
// * known during upload
const key = `${bossAppID}/${taskID}/${contentHash}`;
await uploadCdnFile('taskFile', key, encryptedData);
} catch (error: unknown) {
let message = 'Unknown file upload error';
@ -125,6 +125,7 @@ export async function uploadFile(request: UploadFileRequest, context: CallContex
file = await File.create({
task_id: taskID.slice(0, 7),
boss_app_id: bossAppID,
file_key: key,
supported_countries: supportedCountries,
supported_languages: supportedLanguages,
creator_pid: context.user?.pid,