From 9e8f67d6471ed6515cf0ee99a7f47922ead11965 Mon Sep 17 00:00:00 2001 From: Andreas Knuth Date: Wed, 12 Mar 2025 14:06:12 +0100 Subject: [PATCH] BugFixes acc. gitea --- bizmatch-server/src/models/db.model.ts | 12 +++- bizmatch/src/app/app.component.html | 2 +- .../email-authorized.component.ts | 3 +- .../components/header/header.component.html | 2 +- .../app/components/header/header.component.ts | 6 +- .../details-business-listing.component.ts | 15 +++-- ...s-commercial-property-listing.component.ts | 12 +++- .../broker-listings.component.html | 55 +++++++++++++++++++ .../broker-listings.component.ts | 26 ++++++++- .../business-listings.component.html | 55 +++++++++++++++++++ .../business-listings.component.ts | 25 ++++++++- ...ommercial-property-listings.component.html | 55 +++++++++++++++++++ .../commercial-property-listings.component.ts | 25 ++++++++- bizmatch/src/app/utils/utils.ts | 4 +- 14 files changed, 278 insertions(+), 19 deletions(-) diff --git a/bizmatch-server/src/models/db.model.ts b/bizmatch-server/src/models/db.model.ts index 9f20712..3d831e2 100644 --- a/bizmatch-server/src/models/db.model.ts +++ b/bizmatch-server/src/models/db.model.ts @@ -165,8 +165,8 @@ const phoneRegex = /^(\+1|1)?[-.\s]?\(?[2-9]\d{2}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/; export const UserSchema = z .object({ id: z.string().uuid().optional().nullable(), - firstname: z.string().min(2, { message: 'First name must contain at least 2 characters' }), - lastname: z.string().min(2, { message: 'Last name must contain at least 2 characters' }), + firstname: z.string().min(3, { message: 'First name must contain at least 2 characters' }), + lastname: z.string().min(3, { message: 'Last name must contain at least 2 characters' }), email: z.string().email({ message: 'Invalid email address' }), phoneNumber: z.string().optional().nullable(), description: z.string().optional().nullable(), @@ -197,7 +197,13 @@ export const UserSchema = z path: ['customerSubType'], }); } - + if (!data.companyName || data.companyName.length < 6) { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: 'Company Name must contain at least 6 characters for professional customers', + path: ['companyName'], + }); + } if (!data.phoneNumber || !phoneRegex.test(data.phoneNumber)) { ctx.addIssue({ code: z.ZodIssueCode.custom, diff --git a/bizmatch/src/app/app.component.html b/bizmatch/src/app/app.component.html index f6a844b..1f8d4d9 100644 --- a/bizmatch/src/app/app.component.html +++ b/bizmatch/src/app/app.component.html @@ -3,7 +3,7 @@ @if (actualRoute !=='home' && actualRoute !=='login' && actualRoute!=='emailVerification' && actualRoute!=='email-authorized'){
} -
+
diff --git a/bizmatch/src/app/components/email-authorized/email-authorized.component.ts b/bizmatch/src/app/components/email-authorized/email-authorized.component.ts index 395f0d2..04828af 100644 --- a/bizmatch/src/app/components/email-authorized/email-authorized.component.ts +++ b/bizmatch/src/app/components/email-authorized/email-authorized.component.ts @@ -35,7 +35,8 @@ export class EmailAuthorizedComponent implements OnInit { this.http.post(`${environment.apiBaseUrl}/bizmatch/auth/verify-email`, { oobCode, email }).subscribe({ next: async () => { this.verificationStatus = 'success'; - await this.authService.refreshToken(); + //await this.authService.refreshToken(); + await this.authService.refreshUserClaims(); const user = await this.userService.getByMail(email); }, error: err => { diff --git a/bizmatch/src/app/components/header/header.component.html b/bizmatch/src/app/components/header/header.component.html index e087b4a..6fe3106 100644 --- a/bizmatch/src/app/components/header/header.component.html +++ b/bizmatch/src/app/components/header/header.component.html @@ -141,7 +141,7 @@ Log In
  • - Register + Sign Up