project et profile => clean archi et test vert

This commit is contained in:
styve Lioumba
2025-10-24 16:18:27 +02:00
parent 4c1787d784
commit 3654709250
48 changed files with 762 additions and 656 deletions

View File

@@ -1,7 +1,7 @@
import { Component, computed, inject, OnInit, signal } from '@angular/core';
import { ActivatedRoute, RouterLink, RouterOutlet } from '@angular/router';
import { User } from '@app/shared/models/user';
import { AsyncPipe, JsonPipe, Location, NgClass, UpperCasePipe } from '@angular/common';
import { Location, NgClass } from '@angular/common';
import { UntilDestroy } from '@ngneat/until-destroy';
import { SafeUrl } from '@angular/platform-browser';
import { QRCodeModule } from 'angularx-qrcode';
@@ -12,22 +12,18 @@ import { UpdateUserComponent } from '@app/shared/features/update-user/update-use
import { MyProfileProjectListComponent } from '@app/shared/components/my-profile-project-list/my-profile-project-list.component';
import { MyHomeProfileComponent } from '@app/shared/components/my-home-profile/my-home-profile.component';
import { MyProfileUpdateFormComponent } from '@app/shared/components/my-profile-update-form/my-profile-update-form.component';
import { ProfileService } from '@app/core/services/profile/profile.service';
import { Profile } from '@app/shared/models/profile';
import { PdfViewerComponent } from '@app/shared/features/pdf-viewer/pdf-viewer.component';
import { ProfileFacade } from '@app/ui/profiles/profile.facade';
@Component({
selector: 'app-my-profile',
standalone: true,
imports: [
JsonPipe,
RouterLink,
AsyncPipe,
QRCodeModule,
ChipsComponent,
ReseauxComponent,
UpdateUserComponent,
UpperCasePipe,
MyProfileProjectListComponent,
RouterOutlet,
MyHomeProfileComponent,
@@ -40,8 +36,6 @@ import { PdfViewerComponent } from '@app/shared/features/pdf-viewer/pdf-viewer.c
})
@UntilDestroy()
export class MyProfileComponent implements OnInit {
private profileService = inject(ProfileService);
protected readonly environment = environment;
protected menu = signal<string>('home');
@@ -58,8 +52,6 @@ export class MyProfileComponent implements OnInit {
return {} as User;
});
protected profile: Profile = {} as Profile;
protected isEditMode = signal<boolean>(false);
onChangeURL(url: SafeUrl) {
@@ -70,13 +62,13 @@ export class MyProfileComponent implements OnInit {
this.isEditMode.set(!$event);
}
private readonly profileFacade = new ProfileFacade();
protected profile = this.profileFacade.profile;
protected readonly loading = this.profileFacade.loading;
protected readonly error = this.profileFacade.error;
ngOnInit(): void {
this.myProfileQrCode = `${this.myProfileQrCode}/profiles/${this.user().id}`;
this.profileService.getProfileByUserId(this.user().id).subscribe({
next: (value: Profile) => {
this.profile = value;
},
});
this.profileFacade.loadOne(this.user().id);
}
}