Merge pull request #70 from bipproduction/amalia/29-jul-24
Amalia/29 jul 24
This commit is contained in:
@@ -291,10 +291,12 @@ model DivisionDisscussion {
|
||||
createdBy String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
DivisionDisscussionComment DivisionDisscussionComment[]
|
||||
}
|
||||
|
||||
model DivisionDisscussionComment {
|
||||
id String @id @default(cuid())
|
||||
DivisionDisscussion DivisionDisscussion @relation(fields: [idDisscussion], references: [id])
|
||||
idDisscussion String
|
||||
comment String @db.Text
|
||||
isActive Boolean @default(true)
|
||||
|
||||
@@ -7,8 +7,8 @@ export async function apiGroup(req: NextRequest, method: Method) {
|
||||
const path = searchParams.get("path");
|
||||
const act = API_INDEX_GROUP.find((v) => v.path === path && v.method === method);
|
||||
if (!path)
|
||||
return Response.json({ message: "page not found" }, { status: 404 });
|
||||
return Response.json({ success: false, message: "page not found" }, { status: 404 });
|
||||
if (act) return act.bin(req);
|
||||
|
||||
return Response.json({ message: "404" });
|
||||
return Response.json({ success: false, message: "404" });
|
||||
}
|
||||
@@ -20,6 +20,6 @@ export async function listGroups(req: NextRequest): Promise<Response> {
|
||||
return Response.json(groups);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return Response.json({ message: "Internal Server Error" }, { status: 500 });
|
||||
return Response.json({ success: false, message: "Internal Server Error" }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ export async function createGroup(req: Request){
|
||||
|
||||
if (!data || !data.name) {
|
||||
return Response.json(
|
||||
{ message: "Nama grup harus diisi" },
|
||||
{ success: false, message: "Nama grup harus diisi" },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
@@ -27,6 +27,6 @@ export async function createGroup(req: Request){
|
||||
return Response.json(group, { status: 201 });
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return Response.json({ message: "Internal Server Error" }, { status: 500 });
|
||||
return Response.json({ success: false, message: "Internal Server Error" }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ export async function apiPosition(req: NextRequest, method: Method) {
|
||||
const path = searchParams.get("path");
|
||||
const act = API_INDEX_POSITION.find((v) => v.path === path && v.method === method);
|
||||
if (!path)
|
||||
return Response.json({ message: "page not found" }, { status: 404 });
|
||||
return Response.json({ success: false, message: "page not found" }, { status: 404 });
|
||||
if (act) return act.bin(req);
|
||||
|
||||
return Response.json({ message: "404" });
|
||||
return Response.json({ success: false, message: "404" });
|
||||
}
|
||||
@@ -19,6 +19,6 @@ export async function getAllPosition(req: NextRequest) {
|
||||
return Response.json(positions);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return Response.json({ message: "Internal Server Error" }, { status: 500 });
|
||||
return Response.json({ success: false, message: "Internal Server Error" }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ export async function createlPosition(req: Request) {
|
||||
return Response.json(positions, { status: 201 });
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return Response.json({ message: "Internal Server Error" }, { status: 500 });
|
||||
return Response.json({ success: false, message: "Internal Server Error" }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ export async function apiUser(req: NextRequest, method: Method) {
|
||||
const path = searchParams.get("path");
|
||||
const act = API_INDEX_USER.find((v) => v.path === path && v.method === method);
|
||||
if (!path)
|
||||
return Response.json({ message: "page not found" }, { status: 404 });
|
||||
return Response.json({ success: false, message: "page not found" }, { status: 404 });
|
||||
if (act) return act.bin(req);
|
||||
|
||||
return Response.json({ message: "404" });
|
||||
return Response.json({ success: false, message: "404" });
|
||||
}
|
||||
@@ -31,6 +31,6 @@ export async function getAllUser(req: NextRequest) {
|
||||
return Response.json(users);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return Response.json({ message: "Internal Server Error" }, { status: 500 });
|
||||
return Response.json({ success: false, message: "Internal Server Error" }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,6 @@ export async function createUser(req: NextRequest) {
|
||||
return Response.json(users, { status: 200 });
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return Response.json({ message: "Internal Server Error" }, { status: 500 });
|
||||
return Response.json({ success: false, message: "Internal Server Error" }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ export async function apiViilage(req: Request, method: Method) {
|
||||
(v) => v.path === path && v.method === method
|
||||
);
|
||||
if (!path)
|
||||
return Response.json({ message: "page not found" }, { status: 404 });
|
||||
return Response.json({ success: false, message: "page not found" }, { status: 404 });
|
||||
if (act) return act.bin(req);
|
||||
|
||||
return Response.json({ message: "404" });
|
||||
return Response.json({ success: false, message: "404" });
|
||||
}
|
||||
|
||||
@@ -16,6 +16,6 @@ export async function getAllVillage(req: Request) {
|
||||
return Response.json(villages);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return Response.json({ message: "Internal Server Error" }, { status: 500 });
|
||||
return Response.json({ success: false, message: "Internal Server Error" }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ export async function createVillage(req: Request) {
|
||||
return Response.json(village, { status: 201 });
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return Response.json({ message: "Internal Server Error" }, { status: 500 });
|
||||
return Response.json({ success: false, message: "Internal Server Error" }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user