profiles => format clean archi
This commit is contained in:
24
src/app/testing/domain/profiles/fake-profile.repository.ts
Normal file
24
src/app/testing/domain/profiles/fake-profile.repository.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Profile } from '@app/domain/profiles/profile.model';
|
||||
import { mockProfiles } from '@app/testing/profile.mock';
|
||||
import { ProfileRepository } from '@app/domain/profiles/profile.repository';
|
||||
import { Observable, of } from 'rxjs';
|
||||
|
||||
export class FakeProfileRepository implements ProfileRepository {
|
||||
list(): Observable<Profile[]> {
|
||||
return of(mockProfiles);
|
||||
}
|
||||
|
||||
getByUserId(userId: string): Observable<Profile | null> {
|
||||
const profile = mockProfiles.find((p) => p.utilisateur === userId) ?? null;
|
||||
return of(profile);
|
||||
}
|
||||
|
||||
create(profile: Profile): Observable<Profile> {
|
||||
return of(profile);
|
||||
}
|
||||
|
||||
update(id: string, data: Partial<Profile>): Observable<Profile> {
|
||||
const existing = mockProfiles.find((p) => p.id === id) ?? mockProfiles[0];
|
||||
return of({ ...existing, ...data });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user