Deskripsi:
- Realtime notifikasi
## No Issue
This commit is contained in:
2024-07-24 10:14:07 +08:00
parent 73c6d58eef
commit 6553f6163f
25 changed files with 510 additions and 289 deletions

View File

@@ -16,6 +16,7 @@ export async function Vote_funCreateHasil(
},
select: {
jumlah: true,
value: true,
},
});
@@ -31,16 +32,30 @@ export async function Vote_funCreateHasil(
});
if (!updt) return { status: 400, message: "Gagal Update" };
const create = await prisma.voting_Kontributor.create({
const createKontributor = await prisma.voting_Kontributor.create({
data: {
voting_DaftarNamaVoteId: pilihanVotingId,
votingId: votingId,
authorId: authorId,
},
select: {
Voting: {
select: {
id: true,
title: true,
authorId: true,
},
},
},
});
if (!create) return { status: 400, message: "Gagal Menjadi Kontributor" };
if (!createKontributor)
return { status: 400, message: "Gagal Menjadi Kontributor" };
revalidatePath("/dev/vote/detail/main/");
return { status: 201, message: "Berhasil Voting" };
return {
data: createKontributor,
pilihan: get.value,
status: 201,
message: "Berhasil Voting",
};
}

View File

@@ -16,6 +16,16 @@ export async function Vote_funCreate(req: MODEL_VOTING, listVote: any[]) {
akhirVote: req.akhirVote,
authorId: authorId,
},
select: {
id: true,
title: true,
Voting_Status: {
select: {
name: true,
},
},
authorId: true,
},
});
if (!create) return { status: 400, message: "Gagal Membuat Vote" };
@@ -35,6 +45,7 @@ export async function Vote_funCreate(req: MODEL_VOTING, listVote: any[]) {
revalidatePath("/dev/vote/main/status");
return {
data: create,
status: 201,
message: "Berhasil Membuat Vote",
};

View File

@@ -2,6 +2,7 @@
import prisma from "@/app/lib/prisma";
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
import { data } from "autoprefixer";
import { revalidatePath } from "next/cache";
export async function Vote_funEditStatusByStatusId(
@@ -15,11 +16,22 @@ export async function Vote_funEditStatusByStatusId(
data: {
voting_StatusId: statusId,
},
select: {
id: true,
title: true,
authorId: true,
Voting_Status: {
select: {
name: true,
},
},
},
});
if (!updt) return { status: 400, message: "Gagal Update" };
revalidatePath("/dev/vote/main/status");
return {
data: updt,
status: 200,
message: "Update Berhasil",
};