Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(server): dev user configuration issue (#6619)

fundon7772a103fa92
diff --git a/packages/backend/server/src/core/auth/service.ts b/packages/backend/server/src/core/auth/service.ts
index 54021c6bcc..f71301257a 100644
--- a/packages/backend/server/src/core/auth/service.ts
+++ b/packages/backend/server/src/core/auth/service.ts
@@ -78,10 +78,16 @@ export class AuthService implements OnApplicationBootstrap {
async onApplicationBootstrap() {
if (this.config.node.dev) {
try {
- const devUser = await this.signUp('Dev User', '[email protected]', 'dev');
- if (devUser) {
- await this.quota.switchUserQuota(devUser?.id, QuotaType.ProPlanV1);
+ const [email, name, pwd] = ['[email protected]', 'Dev User', 'dev'];
+ let devUser = await this.user.findUserByEmail(email);
+ if (!devUser) {
+ devUser = await this.user.createUser({
+ email,
+ name,
+ password: await this.crypto.encryptPassword(pwd),
+ });
}
+ await this.quota.switchUserQuota(devUser.id, QuotaType.ProPlanV1);
} catch (e) {
// ignore
}