mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
feat(web): exposed a job to manually trigger database backup procedures (#16622)
* feat(web): exposed a new job to create a manual database backup * chore(server): added a new test case * chore(server): moved job to backup db into the create job popup * remove irrelevant change * openapi * chore: formatting * docs: trigger backup documentation --------- Co-authored-by: Lorenzo Montanari <13736036+l0ll098@users.noreply.github.com> Co-authored-by: Alex Tran <alex.tran1502@gmail.com> Co-authored-by: Zack Pollard <zack@futo.org>
This commit is contained in:
parent
decc878267
commit
d7e0f0e70e
8 changed files with 28 additions and 2 deletions
|
|
@ -237,6 +237,7 @@ export enum ManualJobName {
|
|||
USER_CLEANUP = 'user-cleanup',
|
||||
MEMORY_CLEANUP = 'memory-cleanup',
|
||||
MEMORY_CREATE = 'memory-create',
|
||||
BACKUP_DATABASE = 'backup-database',
|
||||
}
|
||||
|
||||
export enum AssetPathType {
|
||||
|
|
|
|||
|
|
@ -195,6 +195,14 @@ describe(JobService.name, () => {
|
|||
expect(mocks.job.queue).toHaveBeenCalledWith({ name: JobName.QUEUE_FACIAL_RECOGNITION, data: { force: false } });
|
||||
});
|
||||
|
||||
it('should handle a start backup database command', async () => {
|
||||
mocks.job.getQueueStatus.mockResolvedValue({ isActive: false, isPaused: false });
|
||||
|
||||
await sut.handleCommand(QueueName.BACKUP_DATABASE, { command: JobCommand.START, force: false });
|
||||
|
||||
expect(mocks.job.queue).toHaveBeenCalledWith({ name: JobName.BACKUP_DATABASE, data: { force: false } });
|
||||
});
|
||||
|
||||
it('should throw a bad request when an invalid queue is used', async () => {
|
||||
mocks.job.getQueueStatus.mockResolvedValue({ isActive: false, isPaused: false });
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,10 @@ const asJobItem = (dto: JobCreateDto): JobItem => {
|
|||
return { name: JobName.MEMORIES_CREATE };
|
||||
}
|
||||
|
||||
case ManualJobName.BACKUP_DATABASE: {
|
||||
return { name: JobName.BACKUP_DATABASE };
|
||||
}
|
||||
|
||||
default: {
|
||||
throw new BadRequestException('Invalid job name');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue