Deskripsi:
- UI Voting: bagian kontribusi dan riwayat
## No issue
This commit is contained in:
2024-07-17 11:28:07 +08:00
parent 7e21694324
commit 3ee32351e2
26 changed files with 269 additions and 257 deletions

View File

@@ -2,45 +2,51 @@
import prisma from "@/app/lib/prisma"
export async function Vote_getAllListRiwayat() {
const data = await prisma.voting.findMany({
orderBy: {
createdAt: "asc",
},
where: {
voting_StatusId: "1",
isActive: true,
akhirVote: {
lte: new Date(),
},
},
select: {
id: true,
title: true,
isActive: true,
createdAt: true,
updatedAt: true,
deskripsi: true,
awalVote: true,
akhirVote: true,
catatan: true,
authorId: true,
voting_StatusId: true,
Voting_DaftarNamaVote: {
orderBy: {
createdAt: "asc",
},
},
Author: {
select: {
id: true,
username: true,
nomor: true,
Profile: true,
},
},
},
});
export async function vote_getAllListRiwayat({ page }: { page: number }) {
const takeData = 5;
const skipData = page * takeData - takeData;
return data
const data = await prisma.voting.findMany({
take: takeData,
skip: skipData,
orderBy: {
createdAt: "asc",
},
where: {
voting_StatusId: "1",
isActive: true,
akhirVote: {
lte: new Date(),
},
},
select: {
id: true,
title: true,
isActive: true,
createdAt: true,
updatedAt: true,
deskripsi: true,
awalVote: true,
akhirVote: true,
catatan: true,
authorId: true,
voting_StatusId: true,
Voting_DaftarNamaVote: {
orderBy: {
createdAt: "asc",
},
},
Author: {
select: {
id: true,
username: true,
nomor: true,
Profile: true,
},
},
},
});
return data;
}

View File

@@ -3,9 +3,16 @@
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
import prisma from "@/app/lib/prisma";
export async function Vote_getAllListRiwayatSaya() {
export async function Vote_getAllListRiwayatSaya({ page }: { page: number }) {
const authorId = await user_getOneUserId();
const takeData = 5;
const skipData = page * takeData - takeData;
const data = await prisma.voting.findMany({
take: takeData,
skip: skipData,
orderBy: {
createdAt: "asc",
},

View File

@@ -3,9 +3,18 @@
import prisma from "@/app/lib/prisma";
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
export async function Vote_getAllListKontribusiByAuthorId() {
export async function vote_getAllListKontribusiByAuthorId({
page,
}: {
page: number;
}) {
const takeData = 5;
const skipData = page * takeData - takeData;
const authorId = await user_getOneUserId();
const data = await prisma.voting_Kontributor.findMany({
take: takeData,
skip: skipData,
orderBy: {
createdAt: "asc",
},