Onboarding

This commit is contained in:
Bastian Wagner
2026-06-09 13:07:07 +02:00
parent 537c7cbbee
commit 8f3806d398
29 changed files with 1037 additions and 26 deletions

View File

@@ -193,6 +193,35 @@ export class AuthService {
return user.name || user.email;
}
async getPublicUser(userId: string): Promise<PublicUser> {
const user = await this.usersRepository.findOne({
where: { id: userId },
});
if (!user) {
throw new UnauthorizedException('Authenticated user is required.');
}
return this.toPublicUser(user);
}
async updateOnboardingCompleted(
userId: string,
completed: boolean,
): Promise<PublicUser> {
const user = await this.usersRepository.findOne({
where: { id: userId },
});
if (!user) {
throw new UnauthorizedException('Authenticated user is required.');
}
user.onboardingCompleted = completed;
return this.toPublicUser(await this.usersRepository.save(user));
}
private normalizeEmail(email?: string): string {
const normalizedEmail = email?.trim().toLowerCase();
@@ -328,6 +357,7 @@ export class AuthService {
email: user.email,
name: user.name ?? undefined,
verified: user.verified,
onboardingCompleted: user.onboardingCompleted === true,
};
}
}