Deskripsi:
- Upload ke stroage untuk job
## Np Issuee
This commit is contained in:
2024-09-19 15:59:21 +08:00
parent 128dc98839
commit f96d80d55d
153 changed files with 1369 additions and 1200 deletions

View File

@@ -1,14 +1,14 @@
"use server";
import prisma from "@/app/lib/prisma";
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
import { revalidatePath } from "next/cache";
export async function Vote_funCreateHasil(
pilihanVotingId: string,
votingId: string
) {
const authorId = await user_funGetOneUserId();
const userLoginId = await funGetUserIdByToken();
const get = await prisma.voting_DaftarNamaVote.findFirst({
where: {
@@ -36,7 +36,7 @@ export async function Vote_funCreateHasil(
data: {
voting_DaftarNamaVoteId: pilihanVotingId,
votingId: votingId,
authorId: authorId,
authorId: userLoginId,
},
select: {
Voting: {

View File

@@ -1,24 +1,24 @@
"use server";
import prisma from "@/app/lib/prisma";
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
import { revalidatePath } from "next/cache";
export async function Vote_funCreatePilihanVotingById(
namaVotingId: string,
votingId: string
) {
const authorId = await user_funGetOneUserId();
const userLoginId = await funGetUserIdByToken();
const create = await prisma.voting_Kontributor.create({
data: {
voting_DaftarNamaVoteId: namaVotingId,
votingId: votingId,
authorId: authorId,
authorId: userLoginId,
},
});
if(!create) return {status: 400, message: "Gagal Voting"}
if (!create) return { status: 400, message: "Gagal Voting" };
revalidatePath("/dev/vote/detail/main/");
return {status: 201, message: "Berhasil Voting"}
return { status: 201, message: "Berhasil Voting" };
}

View File

@@ -1,19 +1,13 @@
"use server";
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
import { MODEL_VOTING } from "../../model/interface";
import prisma from "@/app/lib/prisma";
import { revalidatePath } from "next/cache";
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
import _ from "lodash";
import { RouterAuth } from "@/app/lib/router_hipmi/router_auth";
import { redirect } from "next/navigation";
import { revalidatePath } from "next/cache";
import { MODEL_VOTING } from "../../model/interface";
export async function Vote_funCreate(req: MODEL_VOTING, listVote: any[]) {
const authorId = await user_funGetOneUserId();
if (!authorId) {
redirect(RouterAuth.login);
// return { status: 400, message: "Gagal mendapatkan authorId" };
}
const userLoginId = await funGetUserIdByToken();
const create = await prisma.voting.create({
data: {
@@ -21,7 +15,7 @@ export async function Vote_funCreate(req: MODEL_VOTING, listVote: any[]) {
deskripsi: req.deskripsi,
awalVote: req.awalVote,
akhirVote: req.akhirVote,
authorId: authorId,
authorId: userLoginId,
},
select: {
id: true,

View File

@@ -1,21 +1,21 @@
"use server";
import prisma from "@/app/lib/prisma";
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
export async function Vote_cekKontributorById(votingId: string) {
const UserId = await user_funGetOneUserId()
const userLoginId = await funGetUserIdByToken();
const cek = await prisma.voting_Kontributor.count({
where: {
authorId: UserId,
authorId: userLoginId,
votingId: votingId,
},
});
if (cek > 0) {
return true;
} else {
return false;
}
if (cek > 0) {
return true;
} else {
return false;
}
}

View File

@@ -1,7 +1,6 @@
"use server";
import prisma from "@/app/lib/prisma";
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
export async function vote_getAllListPublish({
page,

View File

@@ -1,16 +1,11 @@
"use server";
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
import prisma from "@/app/lib/prisma";
import { RouterAuth } from "@/app/lib/router_hipmi/router_auth";
import { redirect } from "next/navigation";
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
export async function Vote_getAllListRiwayatSaya({ page }: { page: number }) {
const authorId = await user_funGetOneUserId();
if (!authorId) {
redirect(RouterAuth.login);
// return { status: 400, message: "Gagal mendapatkan authorId" };
}
const userLoginId = await funGetUserIdByToken();
const takeData = 5;
const skipData = page * takeData - takeData;
@@ -23,7 +18,7 @@ export async function Vote_getAllListRiwayatSaya({ page }: { page: number }) {
},
where: {
voting_StatusId: "1",
authorId: authorId,
authorId: userLoginId,
isActive: true,
akhirVote: {
lte: new Date(),

View File

@@ -1,17 +1,17 @@
"use server";
import prisma from "@/app/lib/prisma";
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
export async function vote_getAllListKontribusiByAuthorId({
page,
}: {
page: number;
}) {
const userLoginId = await funGetUserIdByToken();
const takeData = 5;
const skipData = page * takeData - takeData;
const authorId = await user_funGetOneUserId();
const data = await prisma.voting_Kontributor.findMany({
take: takeData,
skip: skipData,
@@ -19,7 +19,7 @@ export async function vote_getAllListKontribusiByAuthorId({
createdAt: "asc",
},
where: {
authorId: authorId,
authorId: userLoginId,
},
select: {
id: true,

View File

@@ -1,13 +1,14 @@
"use server";
import prisma from "@/app/lib/prisma";
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
export async function Vote_getOnePilihanVotingByUserId(votingId: string) {
const userId = await user_funGetOneUserId();
const userLoginId = await funGetUserIdByToken();
const get = await prisma.voting_Kontributor.findFirst({
where: {
authorId: userId,
authorId: userLoginId,
votingId: votingId,
},
select: {

View File

@@ -1,16 +1,11 @@
"use server";
import prisma from "@/app/lib/prisma";
import { RouterAuth } from "@/app/lib/router_hipmi/router_auth";
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
import { redirect } from "next/navigation";
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
export async function vote_getAllDraft({ page }: { page: number }) {
const authorId = await user_funGetOneUserId();
if (!authorId) {
redirect(RouterAuth.login);
// return { status: 400, message: "Gagal mendapatkan authorId" };
}
const userLoginId = await funGetUserIdByToken();
const takeData = 10;
const skipData = page * takeData - takeData;
@@ -22,7 +17,7 @@ export async function vote_getAllDraft({ page }: { page: number }) {
},
where: {
voting_StatusId: "3",
authorId: authorId,
authorId: userLoginId,
isActive: true,
},
});

View File

@@ -1,16 +1,10 @@
"use server";
import prisma from "@/app/lib/prisma";
import { RouterAuth } from "@/app/lib/router_hipmi/router_auth";
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
import { redirect } from "next/navigation";
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
export async function vote_getAllPublish({ page }: { page: number }) {
const authorId = await user_funGetOneUserId();
if (!authorId) {
redirect(RouterAuth.login);
// return { status: 400, message: "Gagal mendapatkan authorId" };
}
const userLoginId = await funGetUserIdByToken();
const takeData = 5;
const skipData = page * takeData - takeData;
@@ -23,7 +17,7 @@ export async function vote_getAllPublish({ page }: { page: number }) {
},
where: {
voting_StatusId: "1",
authorId: authorId,
authorId: userLoginId,
isActive: true,
akhirVote: {
gte: new Date(),

View File

@@ -1,16 +1,10 @@
"use server";
import prisma from "@/app/lib/prisma";
import { RouterAuth } from "@/app/lib/router_hipmi/router_auth";
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
import { redirect } from "next/navigation";
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
export async function vote_getAllReject({ page }: { page: number }) {
const authorId = await user_funGetOneUserId();
if (!authorId) {
redirect(RouterAuth.login);
// return { status: 400, message: "Gagal mendapatkan authorId" };
}
const userLoginId = await funGetUserIdByToken();
const takeData = 10;
const skipData = page * takeData - takeData;
@@ -23,7 +17,7 @@ export async function vote_getAllReject({ page }: { page: number }) {
},
where: {
voting_StatusId: "4",
authorId: authorId,
authorId: userLoginId,
isActive: true,
},
});

View File

@@ -1,16 +1,10 @@
"use server";
import prisma from "@/app/lib/prisma";
import { RouterAuth } from "@/app/lib/router_hipmi/router_auth";
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
import { redirect } from "next/navigation";
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
export async function vote_getAllReview({ page }: { page: number }) {
const authorId = await user_funGetOneUserId();
if (!authorId) {
redirect(RouterAuth.login);
// return { status: 400, message: "Gagal mendapatkan authorId" };
}
const userLoginId = await funGetUserIdByToken();
const takeData = 10;
const skipData = page * takeData - takeData;
@@ -23,7 +17,7 @@ export async function vote_getAllReview({ page }: { page: number }) {
},
where: {
voting_StatusId: "2",
authorId: authorId,
authorId: userLoginId,
isActive: true,
},
});