feat(EnvelopeReceiverService): Status-Filteroption zu ReadByUserAsync hinzugefügt, um die Ergebnisse nach Status zu filtern
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
@@ -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) =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user