mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-25 19:23:08 +02:00
c2370a1be6
* chore: Add the SPDX information to each file Add copyright and licensing information as defined in version 3.0 of the REUSE Specification. * tweak format --------- Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
/*
|
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
import { Inject, Injectable } from '@nestjs/common';
|
|
import { DI } from '@/di-symbols.js';
|
|
import type { Config } from '@/config.js';
|
|
import type Logger from '@/logger.js';
|
|
import { DriveService } from '@/core/DriveService.js';
|
|
import { bindThis } from '@/decorators.js';
|
|
import { QueueLoggerService } from '../QueueLoggerService.js';
|
|
import type * as Bull from 'bullmq';
|
|
import type { ObjectStorageFileJobData } from '../types.js';
|
|
|
|
@Injectable()
|
|
export class DeleteFileProcessorService {
|
|
private logger: Logger;
|
|
|
|
constructor(
|
|
@Inject(DI.config)
|
|
private config: Config,
|
|
|
|
private driveService: DriveService,
|
|
private queueLoggerService: QueueLoggerService,
|
|
) {
|
|
this.logger = this.queueLoggerService.logger.createSubLogger('delete-file');
|
|
}
|
|
|
|
@bindThis
|
|
public async process(job: Bull.Job<ObjectStorageFileJobData>): Promise<string> {
|
|
const key: string = job.data.key;
|
|
|
|
await this.driveService.deleteObjectStorageFile(key);
|
|
|
|
return 'Success';
|
|
}
|
|
}
|