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

This commit is contained in:
fundon
2024-04-19 03:40:04 +00:00
parent 3cc3af8d5d
commit 7772a103fa

View File

@@ -78,10 +78,16 @@ export class AuthService implements OnApplicationBootstrap {
async onApplicationBootstrap() { async onApplicationBootstrap() {
if (this.config.node.dev) { if (this.config.node.dev) {
try { try {
const devUser = await this.signUp('Dev User', 'dev@affine.pro', 'dev'); const [email, name, pwd] = ['dev@affine.pro', 'Dev User', 'dev'];
if (devUser) { let devUser = await this.user.findUserByEmail(email);
await this.quota.switchUserQuota(devUser?.id, QuotaType.ProPlanV1); 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) { } catch (e) {
// ignore // ignore
} }