fix(striker-ui-api): complete file upload endpoint

main
Tsu-ba-me 3 years ago
parent c767daa9c4
commit b2b347fc72
  1. 8
      striker-ui-api/lib/accessDB.js
  2. 19
      striker-ui-api/routes/files.js

@ -60,12 +60,11 @@ const accessDB = {
jobData,
jobTitle,
jobDescription,
{ jobHostUUID } = { jobHostUUID: 'all' },
{ jobHostUUID } = { jobHostUUID: undefined },
) => {
const subParams = {
file: __filename,
line: 0,
job_host_uuid: jobHostUUID,
job_command: SERVER_PATHS.usr.sbin['anvil-sync-shared'].self,
job_data: jobData,
job_name: `storage::${jobName}`,
@ -73,6 +72,11 @@ const accessDB = {
job_description: `job_${jobDescription}`,
job_progress: 0,
};
if (jobHostUUID) {
subParams.job_host_uuid = jobHostUUID;
}
console.log(JSON.stringify(subParams, null, 2));
return execDatabaseModuleSubroutine('insert_or_update_jobs', subParams)

@ -30,7 +30,9 @@ router
WHERE file_uuid = '${fileUUID}';`,
).stdout;
dbJobAnvilSyncShared('purge', `file_uuid=${fileUUID}`, '0136', '0137');
dbJobAnvilSyncShared('purge', `file_uuid=${fileUUID}`, '0136', '0137', {
jobHostUUID: 'all',
});
}
response.status(204).send();
@ -41,17 +43,22 @@ router
console.log('Receiving shared file.');
if (file) {
console.log(`file:`);
console.dir(file);
console.log(`file: ${JSON.stringify(file, null, 2)}`);
console.log(`body: ${JSON.stringify(body, null, 2)}`);
console.log('body:');
console.dir(body);
dbJobAnvilSyncShared(
'move_incoming',
`file=${file.path}`,
'0132',
'0133',
);
response.status(200).send();
}
})
.put('/:fileUUID', (request, response) => {
console.log('Begin edit single file.');
console.dir(request.body);
const { fileUUID } = request.params;
const { fileName, fileLocations, fileType } = request.body;
@ -79,6 +86,7 @@ router
`file_uuid=${fileUUID}\nold_name=${oldFileName}\nnew_name=${fileName}`,
'0138',
'0139',
{ jobHostUUID: 'all' },
),
);
}
@ -98,6 +106,7 @@ router
`file_uuid=${fileUUID}`,
'0143',
'0144',
{ jobHostUUID: 'all' },
),
);
}

Loading…
Cancel
Save