-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
148 additions
and
88 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import ServerConfigRepository from "@/data/server/server-config-repository"; | ||
import { genericDELETE } from "@/lib/generic-api"; | ||
import { genericDELETE, getDatabaseId } from "@/lib/generic-api"; | ||
import { NextRequest } from "next/server"; | ||
|
||
export async function DELETE(request: Request, { params }: { params: { key: string }} ) { | ||
export async function DELETE(request: NextRequest, { params }: { params: { key: string }} ) { | ||
const recordLocator = params.key; | ||
if(!recordLocator){ | ||
return Response.json({ message: "Invalid request, no key provided within request url", status: 400 }, {status: 400}); | ||
} else { | ||
return Response.json(await genericDELETE(request, new ServerConfigRepository(), { key: recordLocator})); | ||
return Response.json(await genericDELETE(request, new ServerConfigRepository(getDatabaseId(request)), { key: recordLocator})); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import ServerConfigRepository from "@/data/server/server-config-repository"; | ||
import { genericDELETE } from "@/lib/generic-api"; | ||
import { genericDELETE, getDatabaseId } from "@/lib/generic-api"; | ||
|
||
export async function DELETE(request: Request, { params }: { params: { hash: string }} ) { | ||
const recordLocator = params.hash; | ||
if(!recordLocator){ | ||
return Response.json({ message: "Invalid request, no key provided within request url", status: 400 }, {status: 400}); | ||
} else { | ||
return Response.json(await genericDELETE(request, new ServerConfigRepository(), { key: recordLocator})); | ||
return Response.json(await genericDELETE(request, new ServerConfigRepository(getDatabaseId(request)), { key: recordLocator})); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import { PatientRecordDTO, patientRecordDTOSchema } from "@/data/dto"; | ||
import ServerPatientRecordRepository from "@/data/server/server-patientrecord-repository"; | ||
import { genericGET, genericPUT } from "@/lib/generic-api"; | ||
import { genericGET, genericPUT, getDatabaseId } from "@/lib/generic-api"; | ||
import { NextRequest } from "next/server"; | ||
|
||
export async function PUT(request: Request) { | ||
const apiResult = await genericPUT<PatientRecordDTO>(await request.json(), patientRecordDTOSchema, new ServerPatientRecordRepository(), 'id'); | ||
const apiResult = await genericPUT<PatientRecordDTO>(await request.json(), patientRecordDTOSchema, new ServerPatientRecordRepository(getDatabaseId(request)), 'id'); | ||
return Response.json(apiResult, { status: apiResult.status }); | ||
|
||
} | ||
|
||
export async function GET(request: NextRequest) { | ||
return Response.json(await genericGET<PatientRecordDTO>(request, new ServerPatientRecordRepository())); | ||
return Response.json(await genericGET<PatientRecordDTO>(request, new ServerPatientRecordRepository(getDatabaseId(request)))); | ||
} |
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import ServerPatientRepository from "@/data/server/server-patient-repository"; | ||
import { genericDELETE } from "@/lib/generic-api"; | ||
import { genericDELETE, getDatabaseId } from "@/lib/generic-api"; | ||
|
||
export async function DELETE(request: Request, { params }: { params: { id: number }} ) { | ||
const recordLocator = params.id; | ||
if(!recordLocator){ | ||
return Response.json({ message: "Invalid request, no id provided within request url", status: 400 }, {status: 400}); | ||
} else { | ||
return Response.json(await genericDELETE(request, new ServerPatientRepository(), { id: recordLocator})); | ||
return Response.json(await genericDELETE(request, new ServerPatientRepository(getDatabaseId(request)), { id: recordLocator})); | ||
} | ||
} |
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.