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