diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2023-08-16 17:51:28 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-16 17:51:28 +0900 |
| commit | 792622aeadf3e36d50cddec3c64b2ff0105ea927 (patch) | |
| tree | c42a71da86be3c33e2752b4c673e280b1158e57b /packages/backend/src/core/SignupService.ts | |
| parent | build(deps): bump actions/setup-node from 3.7.0 to 3.8.0 (#11726) (diff) | |
| download | sharkey-792622aeadf3e36d50cddec3c64b2ff0105ea927.tar.gz sharkey-792622aeadf3e36d50cddec3c64b2ff0105ea927.tar.bz2 sharkey-792622aeadf3e36d50cddec3c64b2ff0105ea927.zip | |
refactor: prefix Mi for all entities (#11719)
* wip
* wip
* wip
* wip
* Update RepositoryModule.ts
* wip
* wip
* wip
* Revert "wip"
This reverts commit c1c13b37d2aaf3c65bc148212da302b0eb7868bf.
Diffstat (limited to 'packages/backend/src/core/SignupService.ts')
| -rw-r--r-- | packages/backend/src/core/SignupService.ts | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/packages/backend/src/core/SignupService.ts b/packages/backend/src/core/SignupService.ts index 2a19daff4c..e719d5918e 100644 --- a/packages/backend/src/core/SignupService.ts +++ b/packages/backend/src/core/SignupService.ts @@ -9,11 +9,11 @@ import bcrypt from 'bcryptjs'; import { DataSource, IsNull } from 'typeorm'; import { DI } from '@/di-symbols.js'; import type { UsedUsernamesRepository, UsersRepository } from '@/models/index.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'; @@ -43,9 +43,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; }) { @@ -108,18 +108,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, @@ -129,19 +129,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(), })); |