-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #92 from emil-webkom/POreq
POreq
- Loading branch information
Showing
32 changed files
with
2,508 additions
and
376 deletions.
There are no files selected for viewing
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { db } from "@/lib/db"; | ||
import { NextRequest, NextResponse } from "next/server"; | ||
|
||
export const revalidate = 0; | ||
|
||
/** | ||
* @param id: string | ||
* @returns Response indicating if the deletion was successfull. | ||
*/ | ||
export async function PATCH(req: NextRequest, | ||
{ params }: { params: { id: string } }, | ||
) { | ||
const data = await req.json() | ||
try { | ||
await db.kontigentpris.update({ | ||
where: { id: params.id }, | ||
data: { pris: data.pris } | ||
}); | ||
|
||
return NextResponse.json({message: "Successfully updated instance:"}, { status: 200 }); | ||
} catch (error) { | ||
return NextResponse.json({ error: error }, { status: 500 }); | ||
} | ||
} |
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 { NextRequest, NextResponse } from "next/server"; | ||
import { db } from "@/lib/db"; | ||
|
||
export const revalidate = 0; | ||
/** | ||
* Function for fetching Kontigent | ||
* @returns An array of the kontigent | ||
*/ | ||
export async function GET(request: NextRequest) { | ||
try { | ||
const kontigent = await db.kontigentpris.findMany(); | ||
return NextResponse.json({status: 200, data: kontigent}); | ||
} catch (error) { | ||
console.error("Error fetching aeresEmilere:", error); | ||
return NextResponse.json( | ||
{ error: "Failed to fetch aeresEmilere" }, | ||
{ status: 500 }, | ||
); | ||
} | ||
} |
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
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.