refactor: 可読性のため一部でArray.prototype.atを使うように (#11274)
* refactor: `Array.prototype.at`を使うように * fixup! refactor: `Array.prototype.at`を使うように
This commit is contained in:
parent
c0dbc3b53f
commit
2b6dbd4fcb
19 changed files with 46 additions and 44 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { IsNull, MoreThan, Not } from 'typeorm';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import type { DriveFilesRepository } from '@/models/index.js';
|
||||
import type { DriveFile, DriveFilesRepository } from '@/models/index.js';
|
||||
import type { Config } from '@/config.js';
|
||||
import type Logger from '@/logger.js';
|
||||
import { DriveService } from '@/core/DriveService.js';
|
||||
|
|
@ -31,7 +31,7 @@ export class CleanRemoteFilesProcessorService {
|
|||
this.logger.info('Deleting cached remote files...');
|
||||
|
||||
let deletedCount = 0;
|
||||
let cursor: any = null;
|
||||
let cursor: DriveFile['id'] | null = null;
|
||||
|
||||
while (true) {
|
||||
const files = await this.driveFilesRepository.find({
|
||||
|
|
@ -51,7 +51,7 @@ export class CleanRemoteFilesProcessorService {
|
|||
break;
|
||||
}
|
||||
|
||||
cursor = files[files.length - 1].id;
|
||||
cursor = files.at(-1)?.id ?? null;
|
||||
|
||||
await Promise.all(files.map(file => this.driveService.deleteFileSync(file, true)));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue