fix OpenAPI format for UserDetailed.movedTo
This commit is contained in:
parent
a347da6277
commit
756e99e9c4
2 changed files with 20 additions and 1 deletions
|
|
@ -9,6 +9,7 @@ import { IsNull, In, MoreThan, Not } from 'typeorm';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type { MiLocalUser, MiRemoteUser, MiUser } from '@/models/User.js';
|
import type { MiLocalUser, MiRemoteUser, MiUser } from '@/models/User.js';
|
||||||
|
import { isLocalUser } from '@/models/User.js';
|
||||||
import type { BlockingsRepository, FollowingsRepository, InstancesRepository, MiMeta, MutingsRepository, UserListMembershipsRepository, UsersRepository, NoteScheduleRepository, MiNoteSchedule } from '@/models/_.js';
|
import type { BlockingsRepository, FollowingsRepository, InstancesRepository, MiMeta, MutingsRepository, UserListMembershipsRepository, UsersRepository, NoteScheduleRepository, MiNoteSchedule } from '@/models/_.js';
|
||||||
import type { RelationshipJobData, ThinUser } from '@/queue/types.js';
|
import type { RelationshipJobData, ThinUser } from '@/queue/types.js';
|
||||||
|
|
||||||
|
|
@ -33,6 +34,7 @@ import { InternalEventService } from '@/global/InternalEventService.js';
|
||||||
import { LoggerService } from '@/core/LoggerService.js';
|
import { LoggerService } from '@/core/LoggerService.js';
|
||||||
import type Logger from '@/logger.js';
|
import type Logger from '@/logger.js';
|
||||||
import { renderInlineError } from '@/misc/render-inline-error.js';
|
import { renderInlineError } from '@/misc/render-inline-error.js';
|
||||||
|
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||||
import type { Packed } from '@/misc/json-schema.js';
|
import type { Packed } from '@/misc/json-schema.js';
|
||||||
import type { Config } from '@/config.js';
|
import type { Config } from '@/config.js';
|
||||||
|
|
||||||
|
|
@ -91,6 +93,23 @@ export class AccountMoveService {
|
||||||
this.logger = this.loggerService.getLogger('account-move');
|
this.logger = this.loggerService.getLogger('account-move');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@bindThis
|
||||||
|
public async restartMigration(src: MiUser): Promise<void> {
|
||||||
|
if (!src.movedToUri) {
|
||||||
|
throw new IdentifiableError('ddcf173a-00f2-4aa4-ba12-cddd131bacf4', `Can't restart migrated for user ${src.id}: user has not migrated`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const dst = await this.apPersonService.resolvePerson(src.movedToUri);
|
||||||
|
this.logger.info(`Restarting migration from ${src.id} (@${src.usernameLower}@${src.host ?? this.config.host}) to ${dst.id} (@${dst.usernameLower}@${dst.host ?? this.config.host})`);
|
||||||
|
|
||||||
|
if (isLocalUser(src)) {
|
||||||
|
// This calls createMoveJob at the end
|
||||||
|
await this.moveFromLocal(src, dst);
|
||||||
|
} else {
|
||||||
|
await this.queueService.createMoveJob(src, dst);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move a local account to a new account.
|
* Move a local account to a new account.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -310,7 +310,7 @@ export const packedUserDetailedNotMeOnlySchema = {
|
||||||
},
|
},
|
||||||
movedTo: {
|
movedTo: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
format: 'uri',
|
format: 'id',
|
||||||
nullable: true, optional: false,
|
nullable: true, optional: false,
|
||||||
},
|
},
|
||||||
alsoKnownAs: {
|
alsoKnownAs: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue