feat(EnvelopeReceiverService): Status-Filteroption zu ReadByUserAsync hinzugefügt, um die Ergebnisse nach Status zu filtern

This commit is contained in:
Developer 02
2024-09-06 16:31:49 +02:00
parent 2e32559132
commit 01856b61ef
7 changed files with 38 additions and 13 deletions

View File

@@ -70,6 +70,6 @@ export class EnvelopeTableComponent implements AfterViewInit {
private readonly erService: EnvelopeReceiverService = inject(EnvelopeReceiverService);
async ngAfterViewInit() {
this.data = await this.eService.getEnvelopeAsync();
this.data = await this.eService.getEnvelopeAsync(this.options);
}
}

View File

@@ -14,11 +14,20 @@ export class EnvelopeService {
this.url = `${api_url}/envelope`;
}
public getEnvelope(): Observable<any> {
return this.http.get(this.url);
public getEnvelope(options?: { min_status?: number; max_status?: number; ignore_status?: number[] }): Observable<any> {
let params = new HttpParams();
if (options) {
if (options.min_status)
params = params.set('min_status', options.min_status.toString());
if (options.max_status)
params = params.set('max_status', options.max_status.toString());
if (options.ignore_status)
params = params.set('ignore_status', options.ignore_status.join(','));
}
return this.http.get(this.url, { params });
}
public async getEnvelopeAsync(): Promise<any> {
return await firstValueFrom(this.getEnvelope());
public async getEnvelopeAsync(options?: { min_status?: number; max_status?: number; ignore_status?: number[] }): Promise<any> {
return await firstValueFrom(this.getEnvelope(options));
}
}

View File

@@ -21,12 +21,15 @@ namespace EnvelopeGenerator.GeneratorAPI.Controllers
[Authorize]
[HttpGet]
public async Task<IActionResult> GetCurrentAsync()
public async Task<IActionResult> GetCurrentAsync(
[FromQuery] int? min_status = null,
[FromQuery] int? max_status = null,
[FromQuery] params int[] ignore_statuses)
{
try
{
if (User.GetId() is int intId)
return await _envelopeService.ReadByUserAsync(intId).ThenAsync(
return await _envelopeService.ReadByUserAsync(intId, min_status: min_status, max_status: max_status, ignore_statuses: ignore_statuses).ThenAsync(
Success: Ok,
Fail: IActionResult (msg, ntc) =>
{