chore: make DeletedNote hold replyUserId and renoteUserId
This commit is contained in:
parent
14515994fd
commit
82e8c5ff25
|
@ -7,7 +7,7 @@ export class DeletedNote1754137937997 {
|
||||||
name = 'DeletedNote1754137937997'
|
name = 'DeletedNote1754137937997'
|
||||||
|
|
||||||
async up(queryRunner) {
|
async up(queryRunner) {
|
||||||
await queryRunner.query(`CREATE TABLE "deleted_note" ("id" character varying(32) NOT NULL, "deletedAt" TIMESTAMP WITH TIME ZONE, "replyId" character varying(32), "renoteId" character varying(32), "userId" character varying(32) NOT NULL, "localOnly" boolean NOT NULL DEFAULT false, "uri" character varying(512), "url" character varying(512), "channelId" character varying(32), CONSTRAINT "PK_1cb67148b7b707a03c63b2165fc" PRIMARY KEY ("id")); COMMENT ON COLUMN "deleted_note"."replyId" IS 'The ID of reply target.'; COMMENT ON COLUMN "deleted_note"."renoteId" IS 'The ID of renote target.'; COMMENT ON COLUMN "deleted_note"."userId" IS 'The ID of author.'; COMMENT ON COLUMN "deleted_note"."uri" IS 'The URI of a note. it will be null when the note is local.'; COMMENT ON COLUMN "deleted_note"."url" IS 'The human readable url of a note. it will be null when the note is local.'; COMMENT ON COLUMN "deleted_note"."channelId" IS 'The ID of source channel.'`);
|
await queryRunner.query(`CREATE TABLE "deleted_note" ("id" character varying(32) NOT NULL, "deletedAt" TIMESTAMP WITH TIME ZONE, "replyId" character varying(32), "renoteId" character varying(32), "userId" character varying(32) NOT NULL, "localOnly" boolean NOT NULL DEFAULT false, "uri" character varying(512), "url" character varying(512), "channelId" character varying(32), "replyUserId" character varying(32), "renoteUserId" character varying(32), CONSTRAINT "PK_1cb67148b7b707a03c63b2165fc" PRIMARY KEY ("id")); COMMENT ON COLUMN "deleted_note"."replyId" IS 'The ID of reply target.'; COMMENT ON COLUMN "deleted_note"."renoteId" IS 'The ID of renote target.'; COMMENT ON COLUMN "deleted_note"."userId" IS 'The ID of author.'; COMMENT ON COLUMN "deleted_note"."uri" IS 'The URI of a note. it will be null when the note is local.'; COMMENT ON COLUMN "deleted_note"."url" IS 'The human readable url of a note. it will be null when the note is local.'; COMMENT ON COLUMN "deleted_note"."channelId" IS 'The ID of source channel.'; COMMENT ON COLUMN "deleted_note"."replyUserId" IS '[Denormalized]'; COMMENT ON COLUMN "deleted_note"."renoteUserId" IS '[Denormalized]'`);
|
||||||
await queryRunner.query(`CREATE INDEX "IDX_12797cfa4c15d03d0dd649bc4b" ON "deleted_note" ("replyId") `);
|
await queryRunner.query(`CREATE INDEX "IDX_12797cfa4c15d03d0dd649bc4b" ON "deleted_note" ("replyId") `);
|
||||||
await queryRunner.query(`CREATE INDEX "IDX_b6a4a8f31a98ddc5e07995c840" ON "deleted_note" ("renoteId") `);
|
await queryRunner.query(`CREATE INDEX "IDX_b6a4a8f31a98ddc5e07995c840" ON "deleted_note" ("renoteId") `);
|
||||||
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_95c76b088692f600b7a5352a4b" ON "deleted_note" ("uri") `);
|
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_95c76b088692f600b7a5352a4b" ON "deleted_note" ("uri") `);
|
||||||
|
|
|
@ -130,6 +130,8 @@ export class NoteDeleteService {
|
||||||
uri: note.uri,
|
uri: note.uri,
|
||||||
url: note.url,
|
url: note.url,
|
||||||
channelId: note.channelId,
|
channelId: note.channelId,
|
||||||
|
replyUserId: note.replyUserId,
|
||||||
|
renoteUserId: note.renoteUserId,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,20 @@ export class MiDeletedNote {
|
||||||
})
|
})
|
||||||
public channelId: MiChannel['id'] | null;
|
public channelId: MiChannel['id'] | null;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
...id(),
|
||||||
|
nullable: true,
|
||||||
|
comment: '[Denormalized]',
|
||||||
|
})
|
||||||
|
public replyUserId: MiUser['id'] | null;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
...id(),
|
||||||
|
nullable: true,
|
||||||
|
comment: '[Denormalized]',
|
||||||
|
})
|
||||||
|
public renoteUserId: MiUser['id'] | null;
|
||||||
|
|
||||||
@ManyToOne(type => MiChannel, {
|
@ManyToOne(type => MiChannel, {
|
||||||
onDelete: 'CASCADE',
|
onDelete: 'CASCADE',
|
||||||
})
|
})
|
||||||
|
|
|
@ -86,6 +86,8 @@ export class CleanRemoteNotesProcessorService {
|
||||||
'uri',
|
'uri',
|
||||||
'url',
|
'url',
|
||||||
'channelId',
|
'channelId',
|
||||||
|
'replyUserId',
|
||||||
|
'renoteUserId',
|
||||||
] as const];
|
] as const];
|
||||||
let notes: Pick<MiNote, typeof selectColumns[number]>[] = await this.notesRepository.find({
|
let notes: Pick<MiNote, typeof selectColumns[number]>[] = await this.notesRepository.find({
|
||||||
where: {
|
where: {
|
||||||
|
@ -156,6 +158,8 @@ export class CleanRemoteNotesProcessorService {
|
||||||
localOnly: note.localOnly,
|
localOnly: note.localOnly,
|
||||||
uri: note.uri,
|
uri: note.uri,
|
||||||
url: note.url,
|
url: note.url,
|
||||||
|
replyUserId: note.replyUserId,
|
||||||
|
renoteUserId: note.renoteUserId,
|
||||||
})));
|
})));
|
||||||
await transaction.delete(MiNote, notes.map(note => note.id));
|
await transaction.delete(MiNote, notes.map(note => note.id));
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue