- PC: Loader chat
- QC: Auth , Profile, portofolio & user search
## No Issuue
git commit -m
This commit is contained in:
2024-05-16 10:03:34 +08:00
parent c57e495d68
commit 66b9902d97
74 changed files with 1336 additions and 622 deletions

View File

@@ -1,11 +1,49 @@
"use server";
import prisma from "@/app/lib/prisma";
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
export async function UserSearch_getListUser() {
const data = await prisma.user.findMany({
export async function UserSearch_getListUser({ name }: { name: string }) {
const userLoginId = await user_getOneUserId();
if (name === "") {
const data = await prisma.user.findMany({
where: {
masterUserRoleId: "1",
NOT: {
id: userLoginId,
},
},
select: {
id: true,
username: true,
nomor: true,
active: true,
masterUserRoleId: true,
Profile: {
select: {
id: true,
name: true,
imagesId: true,
},
},
},
});
return data;
}
const getDataCari = await prisma.user.findMany({
where: {
masterUserRoleId: "1"
masterUserRoleId: "1",
Profile: {
name: {
contains: name,
mode: "insensitive",
},
},
NOT: {
id: userLoginId,
},
},
select: {
id: true,
@@ -13,14 +51,9 @@ export async function UserSearch_getListUser() {
nomor: true,
active: true,
masterUserRoleId: true,
Profile: {
select: {
id: true,
name: true,
imagesId: true,
},
},
Profile: true,
},
});
return data;
return getDataCari;
}