Skip to content

Commit fab1ab6

Browse files
authored
fix: use the correct query param for raised/not raised (#1588)
1 parent cf058fa commit fab1ab6

2 files changed

Lines changed: 4 additions & 28 deletions

File tree

application/CohortManager/src/Web/app/api/GetValidationExceptions/route.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ function addExceptionDetails<T extends { ExceptionId: number }>(items: T[]) {
4545
export async function GET(request: Request) {
4646
const { searchParams } = new URL(request.url);
4747
const exceptionId = searchParams.get("exceptionId");
48-
const raisedOnly = searchParams.get("raisedOnly");
49-
const notRaisedOnly = searchParams.get("notRaisedOnly");
5048
const sortBy = searchParams.get("sortBy");
5149
const sortOrder = searchParams.get("sortOrder");
5250
const exceptionStatus = searchParams.get("exceptionStatus");
@@ -113,28 +111,6 @@ export async function GET(request: Request) {
113111
return NextResponse.json(response, { status: 200 });
114112
}
115113

116-
if (notRaisedOnly) {
117-
const notRaisedExceptions = mockDataStore.getNotRaisedExceptions();
118-
const sortedItems = sortExceptions([...notRaisedExceptions], sortBy);
119-
const response = createExceptionListResponse(
120-
addExceptionDetails(sortedItems)
121-
);
122-
return NextResponse.json(response, { status: 200 });
123-
}
124-
125-
if (raisedOnly) {
126-
const raisedExceptions = mockDataStore.getRaisedExceptions();
127-
const sortedItems = sortExceptions(
128-
[...raisedExceptions],
129-
sortBy,
130-
"ServiceNowCreatedDate"
131-
);
132-
const response = createExceptionListResponse(
133-
addExceptionDetails(sortedItems)
134-
);
135-
return NextResponse.json(response, { status: 200 });
136-
}
137-
138114
// Default fallback
139115
return NextResponse.json(
140116
{ error: "No valid query parameters provided" },

application/CohortManager/src/Web/app/lib/fetchExceptions.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export async function fetchExceptions(exceptionId?: number) {
1313
}
1414

1515
export async function fetchExceptionsNotRaised() {
16-
const apiUrl = `${process.env.EXCEPTIONS_API_URL}/api/GetValidationExceptions?notRaisedOnly=true`;
16+
const apiUrl = `${process.env.EXCEPTIONS_API_URL}/api/GetValidationExceptions?exceptionStatus=2`;
1717

1818
const response = await fetch(apiUrl);
1919
if (!response.ok) {
@@ -23,7 +23,7 @@ export async function fetchExceptionsNotRaised() {
2323
}
2424

2525
export async function fetchExceptionsRaised() {
26-
const apiUrl = `${process.env.EXCEPTIONS_API_URL}/api/GetValidationExceptions?raisedOnly=true`;
26+
const apiUrl = `${process.env.EXCEPTIONS_API_URL}/api/GetValidationExceptions?exceptionStatus=1`;
2727

2828
const response = await fetch(apiUrl);
2929
if (!response.ok) {
@@ -33,7 +33,7 @@ export async function fetchExceptionsRaised() {
3333
}
3434

3535
export async function fetchExceptionsNotRaisedSorted(sortBy: 0 | 1) {
36-
const apiUrl = `${process.env.EXCEPTIONS_API_URL}/api/GetValidationExceptions?notRaisedOnly=true&sortBy=${sortBy}`;
36+
const apiUrl = `${process.env.EXCEPTIONS_API_URL}/api/GetValidationExceptions?exceptionStatus=2&sortBy=${sortBy}`;
3737

3838
const response = await fetch(apiUrl);
3939
if (!response.ok) {
@@ -43,7 +43,7 @@ export async function fetchExceptionsNotRaisedSorted(sortBy: 0 | 1) {
4343
}
4444

4545
export async function fetchExceptionsRaisedSorted(sortBy: 0 | 1) {
46-
const apiUrl = `${process.env.EXCEPTIONS_API_URL}/api/GetValidationExceptions?raisedOnly=true&sortBy=${sortBy}`;
46+
const apiUrl = `${process.env.EXCEPTIONS_API_URL}/api/GetValidationExceptions?exceptionStatus=1&sortBy=${sortBy}`;
4747

4848
const response = await fetch(apiUrl);
4949
if (!response.ok) {

0 commit comments

Comments
 (0)