Skip to content

Commit 9403fbe

Browse files
committed
include file count in callback
1 parent ddffbf5 commit 9403fbe

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

backend/src/endpoints/queue/queue.controller.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ export class QueueController {
6666
@Post('recalculateHashes')
6767
@AdminOnly()
6868
@OutputDto(null)
69-
async recalculateHashes(): Promise<void> {
69+
async recalculateHashes(): Promise<{
70+
success: boolean;
71+
fileCount: number;
72+
}> {
7073
return await this.queueService.recalculateHashes();
7174
}
7275

backend/src/services/queue.service.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,12 @@ export class QueueService implements OnModuleInit {
167167
/**
168168
* re-caluclates the hashes for all files without a valid hash
169169
*/
170-
async recalculateHashes(): Promise<void> {
170+
async recalculateHashes(): Promise<{
171+
success: boolean;
172+
fileCount: number;
173+
}> {
171174
const files = await this.fileRepository.find({
172-
where: { hash: '' },
175+
where: { hash: '', state: FileState.OK },
173176
relations: ['mission', 'mission.project'],
174177
});
175178

@@ -185,6 +188,11 @@ export class QueueService implements OnModuleInit {
185188
logger.error(error);
186189
}
187190
}
191+
192+
return {
193+
success: true,
194+
fileCount: files.length,
195+
};
188196
}
189197

190198
async confirmUpload(uuid: string, md5: string): Promise<void> {

frontend/src/components/user-profile/admin-settings.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ async function resetFileSizes(): Promise<void> {
7474
}
7575
7676
async function recalculateHashes(): Promise<void> {
77-
await axios.post('queue/recalculateHashes');
77+
const { data } = await axios.post('queue/recalculateHashes');
7878
7979
$q.notify({
80-
message: 'Hash recalculation started',
80+
message: `Recalculating hashes started. ${data.fileCount} files to process`,
8181
color: 'positive',
8282
position: 'bottom',
8383
timeout: 2000,

0 commit comments

Comments
 (0)