feat(account-migration): アカウント移行ログのフィルターを追加 (MisskeyIO#919)

This commit is contained in:
まっちゃてぃー。 2025-02-01 22:57:18 +09:00 committed by GitHub
parent 43e5b8d5f8
commit ff85d650bf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 82 additions and 8 deletions

View file

@ -62,6 +62,8 @@ export const paramDef = {
untilId: { type: 'string', format: 'misskey:id' },
movedFromId: { type: 'string', format: 'misskey:id', nullable: true },
movedToId: { type: 'string', format: 'misskey:id', nullable: true },
from: { type: 'string', enum: ['local', 'remote', 'all'], nullable: true },
to: { type: 'string', enum: ['local', 'remote', 'all'], nullable: true },
},
required: [],
} as const;
@ -86,6 +88,28 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
query.andWhere('accountMoveLogs.movedToId = :movedToId', { movedToId: ps.movedToId });
}
if (ps.from != null || ps.to != null) {
query
.innerJoin('accountMoveLogs.movedFrom', 'movedFrom')
.innerJoin('accountMoveLogs.movedTo', 'movedTo');
if (ps.from === 'local') {
query.andWhere('movedFrom.host IS NULL');
}
if (ps.from === 'remote') {
query.andWhere('movedFrom.host IS NOT NULL');
}
if (ps.to === 'local') {
query.andWhere('movedTo.host IS NULL');
}
if (ps.to === 'remote') {
query.andWhere('movedTo.host IS NOT NULL');
}
}
const accountMoveLogs = await query.limit(ps.limit).getMany();
return await this.userAccountMoveLogEntityService.packMany(accountMoveLogs, me);