large update wip

This commit is contained in:
2025-08-24 17:24:40 +03:00
parent ae2dce2871
commit ef93d51f77
50 changed files with 3459 additions and 621 deletions

View File

@@ -0,0 +1,46 @@
import { HttpClient } from "@angular/common/http";
import { inject, Injectable, signal } from "@angular/core";
import { environment } from "../../environments/environment.development";
import { delay, tap } from "rxjs";
@Injectable({
providedIn: 'root'
})
export class CandidateDataService {
httpClient = inject(HttpClient)
isCandidatesListLoading = signal(false)
isApplicationDetailsLoading = signal(false)
cachedApplicationList: any[] = []
loadCandidateList() {
this.isCandidatesListLoading.set(true)
return this.httpClient.get<any>(`${environment.hostUrl}/app/candidates`).pipe(
delay(500),
tap((data) => {
this.isCandidatesListLoading.set(false);
this.cachedApplicationList = data;
})
);
}
getApplicationDetails(id: number) {
this.isApplicationDetailsLoading.set(true);
return this.httpClient.get(`${environment.hostUrl}/app/candidate/${id}`).pipe(
delay(500),
tap(() => { this.isApplicationDetailsLoading.set(false) })
);
}
submitCandidateForm(data: FormData) {
return this.httpClient.post(`${environment.hostUrl}/app/register`, data);
}
updateCandidateForm(id: number, data: FormData) {
return this.httpClient.put(
`${environment.hostUrl}/app/candidate/${id}`,
data
);
}
}

View File

@@ -0,0 +1,35 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { io } from "socket.io-client";
@Injectable({
providedIn: 'root'
})
export class SocketIOService {
socket = io('ws://localhost:3000');
onCandidateRegistered(): Observable<any> {
return new Observable(observer => {
this.socket.on('candidateRegistered', (data) => {
observer.next(data);
});
});
}
onCandidateUpdated(): Observable<any> {
return new Observable(observer => {
this.socket.on('candidateUpdated', (data) => {
observer.next(data);
});
});
}
disconnect() {
this.socket.disconnect();
}
}