mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-14 14:07:38 -07:00
Fix #4724
This commit is contained in:
parent
135c99591e
commit
8760a4195c
2 changed files with 8 additions and 1 deletions
|
@ -129,12 +129,14 @@ export class Note {
|
|||
})
|
||||
public score: number;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
array: true, default: '{}'
|
||||
})
|
||||
public fileIds: DriveFile['id'][];
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
length: 256, array: true, default: '{}'
|
||||
})
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as Minio from 'minio';
|
|||
import config from '../../config';
|
||||
import { DriveFile } from '../../models/entities/drive-file';
|
||||
import { InternalStorage } from './internal-storage';
|
||||
import { DriveFiles, Instances } from '../../models';
|
||||
import { DriveFiles, Instances, Notes } from '../../models';
|
||||
import { driveChart, perUserDriveChart, instanceChart } from '../chart';
|
||||
|
||||
export default async function(file: DriveFile, isExpired = false) {
|
||||
|
@ -40,6 +40,11 @@ export default async function(file: DriveFile, isExpired = false) {
|
|||
});
|
||||
} else {
|
||||
DriveFiles.delete(file.id);
|
||||
|
||||
// TODO: トランザクション
|
||||
Notes.createQueryBuilder('note').delete()
|
||||
.andWhere(':id = ANY(note.fileIds)', { id: file.id })
|
||||
.execute();
|
||||
}
|
||||
|
||||
// 統計を更新
|
||||
|
|
Loading…
Reference in a new issue