Merge pull request 'Api Mobile Event' (#15) from mobile/16-sep-25 into staging
Reviewed-on: bip/hipmi#15
This commit is contained in:
@@ -83,7 +83,6 @@ async function GET(request: Request) {
|
|||||||
|
|
||||||
if (!updateArsip) {
|
if (!updateArsip) {
|
||||||
console.log("gagal update arsip");
|
console.log("gagal update arsip");
|
||||||
return [];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -138,6 +137,19 @@ async function GET(request: Request) {
|
|||||||
id: true,
|
id: true,
|
||||||
title: true,
|
title: true,
|
||||||
tanggal: true,
|
tanggal: true,
|
||||||
|
Author: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
username: true,
|
||||||
|
Profile: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
name: true,
|
||||||
|
imageId: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
Event_Peserta: {
|
Event_Peserta: {
|
||||||
take: 4,
|
take: 4,
|
||||||
orderBy: {
|
orderBy: {
|
||||||
@@ -162,25 +174,25 @@ async function GET(request: Request) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
User: {
|
// User: {
|
||||||
select: {
|
// select: {
|
||||||
id: true,
|
// id: true,
|
||||||
username: true,
|
// username: true,
|
||||||
Profile: {
|
// Profile: {
|
||||||
select: {
|
// select: {
|
||||||
id: true,
|
// id: true,
|
||||||
name: true,
|
// name: true,
|
||||||
imageId: true,
|
// imageId: true,
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
fixData = data;
|
fixData = data;
|
||||||
} else if (category === "all-history") {
|
} else if (category === "all-history") {
|
||||||
fixData = await prisma.event.findMany({
|
const data = await prisma.event.findMany({
|
||||||
orderBy: {
|
orderBy: {
|
||||||
tanggal: "desc",
|
tanggal: "desc",
|
||||||
},
|
},
|
||||||
@@ -204,8 +216,10 @@ async function GET(request: Request) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
fixData = data;
|
||||||
} else if (category === "my-history") {
|
} else if (category === "my-history") {
|
||||||
fixData = await prisma.event.findMany({
|
const data = await prisma.event.findMany({
|
||||||
orderBy: {
|
orderBy: {
|
||||||
tanggal: "desc",
|
tanggal: "desc",
|
||||||
},
|
},
|
||||||
@@ -230,15 +244,14 @@ async function GET(request: Request) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
fixData = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{
|
{
|
||||||
success: true,
|
success: true,
|
||||||
message:
|
message: "Success get event",
|
||||||
category === ""
|
|
||||||
? "Success get event, but category is empty"
|
|
||||||
: "Success get event",
|
|
||||||
data: fixData,
|
data: fixData,
|
||||||
},
|
},
|
||||||
{ status: 200 }
|
{ status: 200 }
|
||||||
|
|||||||
Reference in New Issue
Block a user