upd: fix api
No Issues
This commit is contained in:
@@ -37,7 +37,7 @@ export async function GET(request: Request) {
|
||||
isActive: true,
|
||||
idDivision: idDivision,
|
||||
dateStart: new Date(String(isDate)),
|
||||
DivisionCalendar:{
|
||||
DivisionCalendar: {
|
||||
isActive: true
|
||||
}
|
||||
},
|
||||
@@ -62,9 +62,17 @@ export async function GET(request: Request) {
|
||||
}
|
||||
}
|
||||
},
|
||||
orderBy: {
|
||||
createdAt: 'desc'
|
||||
}
|
||||
orderBy: [
|
||||
{
|
||||
dateStart: 'asc'
|
||||
},
|
||||
{
|
||||
timeStart: 'asc'
|
||||
},
|
||||
{
|
||||
timeEnd: 'asc'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const allOmit = data.map((v: any) => ({
|
||||
|
||||
@@ -58,12 +58,15 @@ export async function GET(request: Request, context: { params: { id: string } })
|
||||
}
|
||||
})
|
||||
|
||||
const kalender = await prisma.divisionCalendar.count({
|
||||
const kalender = await prisma.divisionCalendarReminder.count({
|
||||
where: {
|
||||
idDivision: String(id),
|
||||
isActive: true,
|
||||
dateStart: {
|
||||
lte: new Date()
|
||||
},
|
||||
DivisionCalendar: {
|
||||
isActive: true
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -242,7 +242,10 @@ export async function GET(request: Request) {
|
||||
Group: {
|
||||
isActive: true,
|
||||
}
|
||||
}
|
||||
},
|
||||
DivisionCalendar: {
|
||||
isActive: true
|
||||
},
|
||||
}
|
||||
} else {
|
||||
kondisi = {
|
||||
@@ -250,35 +253,50 @@ export async function GET(request: Request) {
|
||||
dateStart: new Date(),
|
||||
Division: {
|
||||
idGroup: idGroup
|
||||
}
|
||||
},
|
||||
DivisionCalendar: {
|
||||
isActive: true
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const data = await prisma.divisionCalendar.findMany({
|
||||
const data = await prisma.divisionCalendarReminder.findMany({
|
||||
skip: 0,
|
||||
take: 5,
|
||||
where: kondisi,
|
||||
select: {
|
||||
id: true,
|
||||
idDivision: true,
|
||||
title: true,
|
||||
desc: true,
|
||||
status: true,
|
||||
idCalendar: true,
|
||||
timeStart: true,
|
||||
dateStart: true,
|
||||
timeEnd: true,
|
||||
dateEnd: true,
|
||||
createdAt: true,
|
||||
User: {
|
||||
status: true,
|
||||
DivisionCalendar: {
|
||||
select: {
|
||||
name: true
|
||||
title: true,
|
||||
desc: true,
|
||||
User: {
|
||||
select: {
|
||||
name: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
orderBy: {
|
||||
createdAt: 'desc'
|
||||
}
|
||||
orderBy: [
|
||||
{
|
||||
dateStart: 'asc'
|
||||
},
|
||||
{
|
||||
timeStart: 'asc'
|
||||
},
|
||||
{
|
||||
timeEnd: 'asc'
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
allData = data.map((v: any) => ({
|
||||
|
||||
@@ -42,7 +42,7 @@ export default function ListEventHome() {
|
||||
|
||||
return (
|
||||
<Box pt={10}>
|
||||
<Text c={WARNA.biruTua} mb={10} fw={'bold'} fz={16}>Event Hari Ini</Text>
|
||||
<Text c={WARNA.biruTua} mb={10} fw={'bold'} fz={16}>Acara Hari Ini</Text>
|
||||
<Box bg={"white"} style={{
|
||||
borderRadius: 10,
|
||||
border: `1px solid ${"#D6D8F6"}`,
|
||||
@@ -60,7 +60,7 @@ export default function ListEventHome() {
|
||||
_.isEmpty(isData)
|
||||
?
|
||||
<Box style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '20vh' }}>
|
||||
<Text c="dimmed" ta={"center"} fs={"italic"}>Tidak ada event</Text>
|
||||
<Text c="dimmed" ta={"center"} fs={"italic"}>Tidak ada acara</Text>
|
||||
</Box>
|
||||
:
|
||||
isData.map((event, index) => {
|
||||
|
||||
Reference in New Issue
Block a user