Skip to content
Snippets Groups Projects
Unverified Commit e265b538 authored by syuilo's avatar syuilo
Browse files

Fix #4724

parent b1865047
No related branches found
No related tags found
No related merge requests found
......@@ -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();
}
// 統計を更新
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment