-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Mathilde Haukø Haugum <[email protected]> Co-authored-by: Mathilde Haukø Haugum <[email protected]>
- Loading branch information
1 parent
15f381d
commit 3e7f2d9
Showing
20 changed files
with
437 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
frontend/src/app/[organisation]/bemanning/api/departments/route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
frontend/src/app/[organisation]/bemanning/api/updateHours/[staffingID]/route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { putWithToken } from "@/data/apiCallsWithToken"; | ||
import { NextResponse } from "next/server"; | ||
|
||
export async function PUT( | ||
request: Request, | ||
{ params }: { params: { organisation: string; staffingID: string } }, | ||
) { | ||
const orgUrlKey = params.organisation; | ||
const staffingID = params.staffingID; | ||
const { searchParams } = new URL(request.url); | ||
const hours = searchParams.get("hours") || ""; | ||
const bookingType = searchParams.get("bookingType") || ""; | ||
|
||
const staffing = | ||
(await putWithToken( | ||
`${orgUrlKey}/consultants/staffing/${staffingID}?Hours=${hours}&Type=${bookingType}`, | ||
)) ?? []; | ||
|
||
return NextResponse.json(staffing); | ||
} |
29 changes: 29 additions & 0 deletions
29
frontend/src/app/[organisation]/bemanning/api/updateHours/route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { postWithToken } from "@/data/apiCallsWithToken"; | ||
import { parseYearWeekFromString } from "@/data/urlUtils"; | ||
import { NextResponse } from "next/server"; | ||
|
||
export async function POST( | ||
request: Request, | ||
{ params }: { params: { organisation: string } }, | ||
) { | ||
const orgUrlKey = params.organisation; | ||
const { searchParams } = new URL(request.url); | ||
const consultantID = searchParams.get("consultantID") || ""; | ||
const engagementID = searchParams.get("engagementID") || ""; | ||
const hours = searchParams.get("hours") || ""; | ||
const bookingType = searchParams.get("bookingType") || ""; | ||
const selectedWeek = parseYearWeekFromString( | ||
searchParams.get("selectedWeek") || undefined, | ||
); | ||
|
||
const staffing = | ||
(await postWithToken( | ||
`${orgUrlKey}/consultants/staffing/new?Hours=${hours}&Type=${bookingType}&ConsultantID=${consultantID}&EngagementID=${engagementID}&${ | ||
selectedWeek | ||
? `Year=${selectedWeek.year}&Week=${selectedWeek.weekNumber}` | ||
: "" | ||
}`, | ||
)) ?? []; | ||
|
||
return NextResponse.json(staffing); | ||
} |
2 changes: 1 addition & 1 deletion
2
frontend/src/app/[organisation]/bemanning/api/weeklyWorkHours/route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.