Fix: Voting

Deskripsi:
- Fix notifikasi admin to user
- Fix notifikasi user to admin
## No Issue
This commit is contained in:
2024-11-20 16:23:05 +08:00
parent 6b8ace772c
commit e65a8d30a2
36 changed files with 1077 additions and 547 deletions

View File

@@ -7,6 +7,17 @@ export async function Vote_funEditStatusByStatusId(
voteId: string,
statusId: string
) {
// if (statusId !== "2") {
// const checkStatus = await prisma.voting.findFirst({
// where: {
// id: voteId,
// },
// });
// if (checkStatus?.voting_StatusId != "2")
// return { status: 400, message: "Status sudah diubah admin" };
// }
const updt = await prisma.voting.update({
where: {
id: voteId,

View File

@@ -0,0 +1,21 @@
"use server";
import { prisma } from "@/app/lib";
export async function voting_checkStatus({
id,
}: {
id: string;
}) {
const checkStatus = await prisma.voting.findFirst({
where: {
id: id,
},
});
if(checkStatus?.voting_StatusId == "2") return true
return false
// if (checkStatus?.voting_StatusId == "2") return true;
// return false;
}

View File

@@ -1,7 +1,9 @@
import { voting_funUpdateIsArsipById } from "./edit/fun_update_is_arsip_by_id";
import { voting_checkStatus } from "./get/fun_check_status";
import { voting_getMasterStatus } from "./get/get_list_status_voting";
import { vote_funGetAllByStatusId } from "./get/status/get_all_by_status_id";
export { voting_funUpdateIsArsipById };
export { vote_funGetAllByStatusId };
export { voting_getMasterStatus };
export { voting_checkStatus };