From acd8a4cc07b0625295d4701ca1ad9b7e68da60d0 Mon Sep 17 00:00:00 2001 From: styve Lioumba Date: Mon, 24 Nov 2025 16:17:22 +0100 Subject: [PATCH] =?UTF-8?q?recuperation=20des=20profils=20avec=20email=20v?= =?UTF-8?q?erifi=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 4 ++-- src/app/domain/authentification/auth.repository.ts | 4 ++-- src/app/infrastructure/profiles/pb-profile.repository.ts | 8 +++++++- .../infrastructure/profiles/pb-profile.repository.spec.ts | 6 +++++- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 56e4feb..26b5cf8 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "scripts": { "ng": "ng", - "start": "ng serve", + "start": "bash replace-prod-env.sh src/environments/environment.development.ts $ENV_URL && ng serve", "start:dev": "docker compose up -d && ng serve", "build": "ng build", "watch": "ng build --watch --configuration development", @@ -11,7 +11,7 @@ "tsc:watch": "tsc --noEmit --watch", "prettier": "prettier --write \"src/**/*.{ts,html,scss,css,md,json}\"", "prettier:check": "prettier --check \"src/**/*.{ts,html,scss,css,md,json}\"", - "format": "npm run prettier && npm run lint:fix", + "format": "bash replace-prod-env.sh src/environments/environment.development.ts http://localhost:8090 && npm run prettier && npm run lint:fix", "lint": "ng lint", "lint:fix": "ng lint --fix", "clean:imports": "ts-unused-exports tsconfig.json --excludePathsFromReport=\"src/main.ts;src/environments\" && npm run lint:fix", diff --git a/src/app/domain/authentification/auth.repository.ts b/src/app/domain/authentification/auth.repository.ts index 413f290..b36c1a1 100644 --- a/src/app/domain/authentification/auth.repository.ts +++ b/src/app/domain/authentification/auth.repository.ts @@ -3,11 +3,11 @@ import { Observable } from 'rxjs'; import { User } from '@app/domain/users/user.model'; import { RegisterDto } from '@app/domain/authentification/dto/register-dto'; -export type AuthResponse = { +export interface AuthResponse { isValid: boolean; token: string; record: User; -}; +} export interface AuthRepository { login(loginDto: LoginDto): Observable; register(registerDto: RegisterDto): Observable; diff --git a/src/app/infrastructure/profiles/pb-profile.repository.ts b/src/app/infrastructure/profiles/pb-profile.repository.ts index eab4f5d..d74caf2 100644 --- a/src/app/infrastructure/profiles/pb-profile.repository.ts +++ b/src/app/infrastructure/profiles/pb-profile.repository.ts @@ -11,7 +11,13 @@ export class PbProfileRepository implements ProfileRepository { private pb = new PocketBase(environment.baseUrl); list(): Observable { - return from(this.pb.collection('profiles').getFullList({ sort: 'profession' })); + return from( + this.pb.collection('profiles').getFullList({ + sort: 'profession', + expand: 'utilisateur', + filter: 'utilisateur.verified=true', + }) + ); } getByUserId(userId: string): Observable { diff --git a/src/app/testing/infrastructure/profiles/pb-profile.repository.spec.ts b/src/app/testing/infrastructure/profiles/pb-profile.repository.spec.ts index 9738f89..c9505c9 100644 --- a/src/app/testing/infrastructure/profiles/pb-profile.repository.spec.ts +++ b/src/app/testing/infrastructure/profiles/pb-profile.repository.spec.ts @@ -41,7 +41,11 @@ describe('PbProfileRepository', () => { repo.list().subscribe((result) => { expect(mockPocketBase.collection).toHaveBeenCalledWith('profiles'); - expect(mockCollection.getFullList).toHaveBeenCalledWith({ sort: 'profession' }); + expect(mockCollection.getFullList).toHaveBeenCalledWith({ + sort: 'profession', + expand: 'utilisateur', + filter: 'utilisateur.verified=true', + }); expect(result).toEqual(mockProfiles); done(); });