mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
feature(oms-data-access): Removed abortSignals for POST and PUT requests
Ref: #5340
This commit is contained in:
@@ -12,7 +12,6 @@ import {
|
||||
returnReceiptValuesMapping,
|
||||
} from '../helpers/return-process';
|
||||
import { isReturnProcessTypeGuard } from '../guards';
|
||||
import { takeUntilAborted } from '@isa/common/data-access';
|
||||
|
||||
/**
|
||||
* Service for determining if a return process can proceed based on
|
||||
@@ -36,20 +35,14 @@ export class ReturnCanReturnService {
|
||||
* @param returnProcess - The return process object to evaluate.
|
||||
* @returns A promise resolving to a CanReturn result or undefined if the process should continue.
|
||||
*/
|
||||
async canReturn(
|
||||
returnProcess: ReturnProcess,
|
||||
abortSignal?: AbortSignal,
|
||||
): Promise<CanReturn | undefined>;
|
||||
async canReturn(returnProcess: ReturnProcess): Promise<CanReturn | undefined>;
|
||||
/**
|
||||
* Determines if a return can proceed based on mapped receipt values.
|
||||
*
|
||||
* @param returnValues - The mapped return receipt values.
|
||||
* @returns A promise resolving to a CanReturn result.
|
||||
*/
|
||||
async canReturn(
|
||||
returnValues: ReturnReceiptValues,
|
||||
abortSignal?: AbortSignal,
|
||||
): Promise<CanReturn>;
|
||||
async canReturn(returnValues: ReturnReceiptValues): Promise<CanReturn>;
|
||||
|
||||
/**
|
||||
* Determines if a return can proceed, accepting either a ReturnProcess or ReturnReceiptValues.
|
||||
@@ -60,7 +53,6 @@ export class ReturnCanReturnService {
|
||||
*/
|
||||
async canReturn(
|
||||
input: ReturnProcess | ReturnReceiptValues,
|
||||
abortSignal?: AbortSignal,
|
||||
): Promise<CanReturn | undefined> {
|
||||
let data: ReturnReceiptValues | undefined = undefined;
|
||||
|
||||
@@ -74,14 +66,10 @@ export class ReturnCanReturnService {
|
||||
return undefined; // Prozess soll weitergehen, daher kein Error
|
||||
}
|
||||
|
||||
let req$ = this.#receiptService.ReceiptCanReturn(
|
||||
const req$ = this.#receiptService.ReceiptCanReturn(
|
||||
data as ReturnReceiptValuesDTO,
|
||||
);
|
||||
|
||||
if (abortSignal) {
|
||||
req$ = req$.pipe(takeUntilAborted(abortSignal));
|
||||
}
|
||||
|
||||
try {
|
||||
return await firstValueFrom(
|
||||
req$.pipe(
|
||||
|
||||
@@ -32,19 +32,19 @@ export class ReturnDetailsService {
|
||||
* @param params - The parameters for the return check.
|
||||
* @param params.item - The receipt item to check.
|
||||
* @param params.category - The product category to check against.
|
||||
* @param abortSignal - Optional AbortSignal to cancel the request.
|
||||
* @returns A promise resolving to the result of the canReturn check, containing
|
||||
* eligibility status and any relevant constraints or messages.
|
||||
* @throws Will throw an error if the return check fails or is aborted.
|
||||
* @throws Will throw an error if the return check fails.
|
||||
*/
|
||||
async canReturn(
|
||||
{
|
||||
receiptItemId,
|
||||
quantity,
|
||||
category,
|
||||
}: { receiptItemId: number; quantity: number; category: ProductCategory },
|
||||
abortSignal?: AbortSignal,
|
||||
): Promise<CanReturn> {
|
||||
async canReturn({
|
||||
receiptItemId,
|
||||
quantity,
|
||||
category,
|
||||
}: {
|
||||
receiptItemId: number;
|
||||
quantity: number;
|
||||
category: ProductCategory;
|
||||
}): Promise<CanReturn> {
|
||||
const returnReceiptValues: ReturnReceiptValues = {
|
||||
quantity,
|
||||
receiptItem: {
|
||||
@@ -53,10 +53,7 @@ export class ReturnDetailsService {
|
||||
category,
|
||||
};
|
||||
|
||||
return this.#returnCanReturnService.canReturn(
|
||||
returnReceiptValues,
|
||||
abortSignal,
|
||||
);
|
||||
return this.#returnCanReturnService.canReturn(returnReceiptValues);
|
||||
}
|
||||
/**
|
||||
* Gets all available product categories that have defined question sets.
|
||||
|
||||
@@ -176,7 +176,7 @@ export const ReturnDetailsStore = signalStore(
|
||||
category,
|
||||
};
|
||||
},
|
||||
loader: async ({ params, abortSignal }) => {
|
||||
loader: async ({ params }) => {
|
||||
if (params === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -186,10 +186,7 @@ export const ReturnDetailsStore = signalStore(
|
||||
return store.canReturn()[key];
|
||||
}
|
||||
|
||||
const res = await store._returnDetailsService.canReturn(
|
||||
params,
|
||||
abortSignal,
|
||||
);
|
||||
const res = await store._returnDetailsService.canReturn(params);
|
||||
patchState(store, {
|
||||
canReturn: { ...store.canReturn(), [key]: res },
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user