refactor: prefix Mi for all entities (misskey-dev#11719) (MisskeyIO#160)

cheery-pick from misskey-dev@792622aeadf3e36d50cddec3c64b2ff0105ea927
This commit is contained in:
まっちゃとーにゅ 2023-08-26 08:42:29 +09:00 committed by GitHub
parent 651905e08f
commit 58bbff3738
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
234 changed files with 2061 additions and 2061 deletions

View file

@ -10,11 +10,11 @@ import { DataSource, IsNull } from 'typeorm';
import { DI } from '@/di-symbols.js';
import type { UsedUsernamesRepository, UsersRepository } from '@/models/index.js';
import type { Config } from '@/config.js';
import { User } from '@/models/entities/User.js';
import { UserProfile } from '@/models/entities/UserProfile.js';
import { MiUser } from '@/models/entities/User.js';
import { MiUserProfile } from '@/models/entities/UserProfile.js';
import { IdService } from '@/core/IdService.js';
import { UserKeypair } from '@/models/entities/UserKeypair.js';
import { UsedUsername } from '@/models/entities/UsedUsername.js';
import { MiUserKeypair } from '@/models/entities/UserKeypair.js';
import { MiUsedUsername } from '@/models/entities/UsedUsername.js';
import generateUserToken from '@/misc/generate-native-user-token.js';
import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { bindThis } from '@/decorators.js';
@ -47,9 +47,9 @@ export class SignupService {
@bindThis
public async signup(opts: {
username: User['username'];
username: MiUser['username'];
password?: string | null;
passwordHash?: UserProfile['password'] | null;
passwordHash?: MiUserProfile['password'] | null;
host?: string | null;
ignorePreservedUsernames?: boolean;
}) {
@ -112,18 +112,18 @@ export class SignupService {
err ? rej(err) : res([publicKey, privateKey]),
));
let account!: User;
let account!: MiUser;
// Start transaction
await this.db.transaction(async transactionalEntityManager => {
const exist = await transactionalEntityManager.findOneBy(User, {
const exist = await transactionalEntityManager.findOneBy(MiUser, {
usernameLower: username.toLowerCase(),
host: IsNull(),
});
if (exist) throw new Error(' the username is already used');
account = await transactionalEntityManager.save(new User({
account = await transactionalEntityManager.save(new MiUser({
id: this.idService.genId(),
createdAt: new Date(),
username: username,
@ -133,19 +133,19 @@ export class SignupService {
isRoot: isTheFirstUser,
}));
await transactionalEntityManager.save(new UserKeypair({
await transactionalEntityManager.save(new MiUserKeypair({
publicKey: keyPair[0],
privateKey: keyPair[1],
userId: account.id,
}));
await transactionalEntityManager.save(new UserProfile({
await transactionalEntityManager.save(new MiUserProfile({
userId: account.id,
autoAcceptFollowed: true,
password: hash,
}));
await transactionalEntityManager.save(new UsedUsername({
await transactionalEntityManager.save(new MiUsedUsername({
createdAt: new Date(),
username: username.toLowerCase(),
}));