Hold persiapan persentase pak fahmi

- Sudah bisa create
- Sudah bisa join proyek
- Tambahan untuk mengisi form jika ingin join
### No issue
This commit is contained in:
2024-04-18 14:14:08 +08:00
parent ed77b569a6
commit 4b78a45479
45 changed files with 809 additions and 143 deletions

View File

@@ -0,0 +1,28 @@
"use server";
import prisma from "@/app/lib/prisma";
import { MODEL_COLLABORATION } from "../../model/interface";
import { revalidatePath } from "next/cache";
import { RouterColab } from "@/app/lib/router_hipmi/router_colab";
export default async function colab_funEditById(value: MODEL_COLLABORATION) {
console.log(value);
const updt = await prisma.projectCollaboration.update({
where: {
id: value.id,
},
data: {
title: value.title,
lokasi: value.lokasi,
purpose: value.purpose,
benefit: value.benefit,
projectCollaborationMaster_IndustriId: value
.ProjectCollaborationMaster_Industri.id as any,
},
});
if (!updt) return { status: 400, message: "Gagal update" };
revalidatePath(RouterColab.beranda);
revalidatePath(RouterColab.main_detail)
return { status: 200, message: "Berhasil update" };
}

View File

@@ -9,6 +9,7 @@ export default async function colab_getListAllProyek() {
},
where: {
projectCollaborationMaster_StatusId: 1,
isActive: true,
},
select: {
id: true,
@@ -19,6 +20,7 @@ export default async function colab_getListAllProyek() {
benefit: true,
Author: {
select: {
id: true,
Profile: true,
},
},

View File

@@ -1,5 +1,37 @@
"use server"
"use server";
export default async function colab_getListByStatusId(statusId: string, colabId: string) {
}
import prisma from "@/app/lib/prisma";
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
export default async function colab_getListByStatusId(statusId: number) {
const AuthorId = await User_getUserId();
const data = await prisma.projectCollaboration.findMany({
where: {
userId: AuthorId,
projectCollaborationMaster_StatusId: statusId,
},
select: {
id: true,
isActive: true,
title: true,
lokasi: true,
purpose: true,
benefit: true,
Author: {
select: {
Profile: true,
},
},
ProjectCollaborationMaster_Industri: true,
ProjectCollaboration_Partisipasi: {
where: {
isActive: true,
},
},
},
});
if (!data) return { status: 400, message: "Gagal Mengambil data" };
return { data: data, status: 200, message: "Berhasil mengambil data" };
}

View File

@@ -6,6 +6,7 @@ export default async function colab_getListPartisipanById(colabId: string) {
const data = await prisma.projectCollaboration_Partisipasi.findMany({
where: {
projectCollaborationId: colabId,
isActive: true
},
select: {
id: true,

View File

@@ -0,0 +1,44 @@
"use server";
import prisma from "@/app/lib/prisma";
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
export default async function colab_getListPartisipasiByAuthorId() {
const AuthorId = await User_getUserId();
const get = await prisma.projectCollaboration_Partisipasi.findMany({
where: {
userId: AuthorId,
isActive: true,
},
select: {
id: true,
isActive: true,
ProjectCollaboration: {
select: {
id: true,
isActive: true,
title: true,
lokasi: true,
purpose: true,
benefit: true,
Author: {
select: {
id: true,
Profile: true,
},
},
ProjectCollaborationMaster_Industri: true,
ProjectCollaboration_Partisipasi: {
where: {
isActive: true,
},
},
},
},
},
});
if (!get) return { status: 400, message: "Gagal mengambil data" };
return { data: get, status: 200, message: "Berhasil mengambil data" };
}

View File

@@ -0,0 +1,34 @@
"use server";
import prisma from "@/app/lib/prisma";
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
export default async function colab_getListAllProyekByAuthorId() {
const AuthorId = await User_getUserId();
const get = await prisma.projectCollaboration.findMany({
where: { userId: AuthorId, isActive: true },
select: {
id: true,
isActive: true,
title: true,
lokasi: true,
purpose: true,
benefit: true,
Author: {
select: {
id: true,
Profile: true,
},
},
ProjectCollaborationMaster_Industri: true,
ProjectCollaboration_Partisipasi: {
where: {
isActive: true,
},
},
},
});
if (!get) return { status: 400, message: "Gagal mengambil data" };
return { data: get, status: 200, message: "Berhasil mengambil data" };
}

View File

@@ -14,6 +14,7 @@ export default async function colab_getOneCollaborationById(colabId: string) {
lokasi: true,
purpose: true,
benefit: true,
createdAt: true,
Author: {
select: {
id: true,