diff --git a/api.http b/api.http index 14bfa3d..41e64e4 100644 --- a/api.http +++ b/api.http @@ -118,7 +118,7 @@ Content-Type: application/json // USERS ### -GET http://localhost:3000/api/user/get?path=get-all-users&roleID=dev&villageID=121212&groupID=2&positionID=clz24bff70001w01in64dd9ea HTTP/1.1 +GET http://localhost:3000/api/user/get?path=get-all-users&active=true HTTP/1.1 ### GET http://localhost:3000/api/user/get?path=get-one-users&userID=devAmalia HTTP/1.1 diff --git a/src/module/_global/bin/api_address.ts b/src/module/_global/bin/api_address.ts index bc54fdc..1cfcd44 100644 --- a/src/module/_global/bin/api_address.ts +++ b/src/module/_global/bin/api_address.ts @@ -12,6 +12,7 @@ export const API_ADDRESS = { "apiCreateUser": "/api/user/post?path=create-users", "apiUpdateUser": "/api/user/post?path=update-users", "apiDeleteUser": "/api/user/post?path=delete-users", + "apiGetRoleUser": "/api/user/get?path=get-role-user", // Announcement "apiGetAllAnnouncement": "/api/announcement/get?path=get-all-announcement", diff --git a/src/module/group/api/get/listGroup.ts b/src/module/group/api/get/listGroup.ts index 3a16422..1c058d5 100644 --- a/src/module/group/api/get/listGroup.ts +++ b/src/module/group/api/get/listGroup.ts @@ -5,7 +5,7 @@ export async function listGroups(req: NextRequest): Promise { try { const searchParams = req.nextUrl.searchParams - const villaId = "121212" + const villaId = "desa1" const active = searchParams.get('active'); const groups = await prisma.group.findMany({ where: { diff --git a/src/module/group/api/post/createGroup.ts b/src/module/group/api/post/createGroup.ts index 6b49d17..3d8d133 100644 --- a/src/module/group/api/post/createGroup.ts +++ b/src/module/group/api/post/createGroup.ts @@ -4,7 +4,7 @@ import { revalidatePath } from "next/cache"; export async function createGroup(req: Request) { try { const data = await req.json(); - const villaId = "121212"; + const villaId = "desa1"; if (!data || !data.name) { return Response.json( diff --git a/src/module/position/api/get/getAllPosition.ts b/src/module/position/api/get/getAllPosition.ts index b29f1c8..51c9288 100644 --- a/src/module/position/api/get/getAllPosition.ts +++ b/src/module/position/api/get/getAllPosition.ts @@ -1,12 +1,22 @@ import { prisma } from "@/module/_global"; +import { funGetUserByCookies } from "@/module/auth"; import _, { omit } from "lodash"; import { NextRequest } from "next/server"; export async function getAllPosition(req: NextRequest) { try { + + let grupFix const searchParams = req.nextUrl.searchParams - const groupID = "3"; + const groupID = searchParams.get('groupId'); const active = searchParams.get('active'); + const user = await funGetUserByCookies() + console.log(groupID) + + // if(user.) + + + const positions = await prisma.position.findMany({ where: { idGroup: String(groupID),