upd: calender
Deskripsi: - repeat pengulangan - install new package - tambah field table - ubah semua api mengikuti struktur tb baru No Issues
This commit is contained in:
@@ -29,21 +29,29 @@ export async function GET(request: Request) {
|
||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan divisi, data tidak ditemukan" }, { status: 404 });
|
||||
}
|
||||
|
||||
const data = await prisma.divisionCalendar.findMany({
|
||||
const data = await prisma.divisionCalendarReminder.findMany({
|
||||
where: {
|
||||
isActive: true,
|
||||
idDivision: idDivision,
|
||||
title: {
|
||||
contains: (name == undefined || name == "null") ? "" : name,
|
||||
mode: "insensitive"
|
||||
DivisionCalendar: {
|
||||
title: {
|
||||
contains: (name == undefined || name == "null") ? "" : name,
|
||||
mode: "insensitive"
|
||||
},
|
||||
isActive: true
|
||||
}
|
||||
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
timeStart: true,
|
||||
dateStart: true,
|
||||
timeEnd: true,
|
||||
DivisionCalendar: {
|
||||
select: {
|
||||
title: true,
|
||||
}
|
||||
}
|
||||
},
|
||||
orderBy: [
|
||||
{
|
||||
@@ -59,8 +67,8 @@ export async function GET(request: Request) {
|
||||
});
|
||||
|
||||
const allOmit = data.map((v: any) => ({
|
||||
..._.omit(v, [""]),
|
||||
dateStart: v.dateStart,
|
||||
..._.omit(v, ["DivisionCalendar"]),
|
||||
title: v.DivisionCalendar.title
|
||||
}))
|
||||
|
||||
// groupBy untuk dateStart
|
||||
|
||||
Reference in New Issue
Block a user