# Event Join

## feat
- Join event
- History semua event dan event saya
### No Issuue
This commit is contained in:
2024-01-31 10:48:20 +08:00
parent ca9214d9e0
commit c01906c063
40 changed files with 682 additions and 98 deletions

View File

@@ -5,9 +5,15 @@ import prisma from "@/app/lib/prisma";
export async function Event_getByStatusId(statusId: string, authorId: string) {
if (statusId === "1") {
const data = await prisma.event.findMany({
orderBy: {
tanggal: "desc",
},
where: {
eventMaster_StatusId: "1",
authorId: authorId,
tanggal: {
gte: new Date(),
},
},
select: {
id: true,
@@ -20,6 +26,9 @@ export async function Event_getByStatusId(statusId: string, authorId: string) {
}
if (statusId === "2") {
const data = await prisma.event.findMany({
orderBy: {
createdAt: "desc",
},
where: {
eventMaster_StatusId: "2",
authorId: authorId,

View File

@@ -0,0 +1,34 @@
"use server";
import prisma from "@/app/lib/prisma";
import _ from "lodash";
export async function Event_getListRiwayatSaya(authorId: string) {
const data = await prisma.event.findMany({
orderBy: {
tanggal: "desc",
},
where: {
authorId: authorId,
eventMaster_StatusId: "1",
tanggal: {
lte: new Date(),
},
},
select: {
id: true,
title: true,
tanggal: true,
deskripsi: true,
active: true,
authorId: true,
Author: {
select: {
Profile: true,
},
},
},
});
return data;
}

View File

@@ -0,0 +1,33 @@
"use server";
import prisma from "@/app/lib/prisma";
import _ from "lodash";
export async function Event_getListSemuaRiwayat() {
const data = await prisma.event.findMany({
orderBy: {
tanggal: "desc",
},
where: {
eventMaster_StatusId: "1",
tanggal: {
lte: new Date(),
},
},
select: {
id: true,
title: true,
tanggal: true,
deskripsi: true,
active: true,
authorId: true,
Author: {
select: {
Profile: true,
},
},
},
});
return data;
}