Skip to content

Commit 9dbb270

Browse files
committed
chore: rename variables
1 parent fe3ce1d commit 9dbb270

File tree

4 files changed

+9
-12
lines changed

4 files changed

+9
-12
lines changed

packages/service/common/file/s3Ttl/controller.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { MongoS3Ttl } from './schema';
1+
import { MongoS3TTL } from './schema';
22
import { S3BucketManager } from '../../s3/buckets/manager';
33
import { addLog } from '../../system/log';
44
import { setCron } from '../../system/cron';
@@ -9,10 +9,7 @@ export async function clearExpiredMinioFiles() {
99
try {
1010
const now = new Date();
1111

12-
const expiredFiles = await MongoS3Ttl.find({
13-
expiredTime: { $exists: true, $ne: null, $lte: now }
14-
}).lean();
15-
12+
const expiredFiles = await MongoS3TTL.find({ expiredTime: { $lte: now } }).lean();
1613
if (expiredFiles.length === 0) {
1714
addLog.info('No expired minio files to clean');
1815
return;
@@ -37,7 +34,7 @@ export async function clearExpiredMinioFiles() {
3734
})();
3835

3936
await bucket.delete(file.minioKey);
40-
await MongoS3Ttl.deleteOne({ _id: file._id });
37+
await MongoS3TTL.deleteOne({ _id: file._id });
4138

4239
success++;
4340
addLog.info(`Deleted expired minio file: ${file.minioKey} from bucket: ${file.bucketName}`);

packages/service/common/file/s3Ttl/schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ const S3TtlSchema = new Schema({
2121
S3TtlSchema.index({ expiredTime: 1 });
2222
S3TtlSchema.index({ bucketName: 1, minioKey: 1 });
2323

24-
export const MongoS3Ttl = getMongoModel<S3TtlSchemaType>(collectionName, S3TtlSchema);
24+
export const MongoS3TTL = getMongoModel<S3TtlSchemaType>(collectionName, S3TtlSchema);

packages/service/common/s3/buckets/base.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
import type { BucketBasicOperationsType } from '../interface';
1313
import { createObjectKey, createTempObjectKey } from '../helpers';
1414
import path from 'node:path';
15-
import { MongoS3Ttl } from 'common/file/s3Ttl/schema';
15+
import { MongoS3TTL } from 'common/file/s3TTL/schema';
1616

1717
export class S3BaseBucket implements BucketBasicOperationsType {
1818
public client: Client;
@@ -95,7 +95,7 @@ export class S3BaseBucket implements BucketBasicOperationsType {
9595
const { formData, postURL } = await this.client.presignedPostPolicy(policy);
9696

9797
if (temporary) {
98-
await MongoS3Ttl.create({
98+
await MongoS3TTL.create({
9999
minioKey: key,
100100
bucketName: this.name,
101101
expiredTime: new Date(Date.now() + ttl * 3.6e6)

packages/service/common/s3/sources/avatar.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
type S3Options
99
} from '../type';
1010
import type { S3PublicBucket } from '../buckets/public';
11-
import { MongoS3Ttl } from '../../file/s3Ttl/schema';
11+
import { MongoS3TTL } from '../../file/s3TTL/schema';
1212

1313
class S3AvatarSource extends S3BaseSource<S3PublicBucket> {
1414
constructor(options?: Partial<S3Options>) {
@@ -42,7 +42,7 @@ class S3AvatarSource extends S3BaseSource<S3PublicBucket> {
4242

4343
async removeAvatar(avatarWithPrefix: string): Promise<void> {
4444
const avatarObjectKey = this.createAvatarObjectKey(avatarWithPrefix);
45-
await MongoS3Ttl.deleteOne({ minioKey: avatarObjectKey, bucketName: this.bucketName });
45+
await MongoS3TTL.deleteOne({ minioKey: avatarObjectKey, bucketName: this.bucketName });
4646
await this.bucket.delete(avatarObjectKey);
4747
}
4848

@@ -51,7 +51,7 @@ class S3AvatarSource extends S3BaseSource<S3PublicBucket> {
5151
const avatarObjectKey = tempAvatarObjectKey.replace(`${S3Sources.temp}/`, '');
5252

5353
try {
54-
const file = await MongoS3Ttl.findOne({
54+
const file = await MongoS3TTL.findOne({
5555
bucketName: this.bucketName,
5656
minioKey: tempAvatarObjectKey
5757
});

0 commit comments

Comments
 (0)