upd: fix route laporan divisi
This commit is contained in:
@@ -2,6 +2,7 @@ import { prisma } from "@/module/_global";
|
|||||||
import { funGetUserById } from "@/module/auth";
|
import { funGetUserById } from "@/module/auth";
|
||||||
import _, { ceil } from "lodash";
|
import _, { ceil } from "lodash";
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
|
import moment from "moment";
|
||||||
|
|
||||||
export async function GET(request: Request) {
|
export async function GET(request: Request) {
|
||||||
try {
|
try {
|
||||||
@@ -38,10 +39,10 @@ export async function GET(request: Request) {
|
|||||||
DivisionProjectTask: {
|
DivisionProjectTask: {
|
||||||
some: {
|
some: {
|
||||||
dateStart: {
|
dateStart: {
|
||||||
gte: new Date(String(date))
|
gte: moment(String(date)).startOf('day').toDate()
|
||||||
},
|
},
|
||||||
dateEnd: {
|
dateEnd: {
|
||||||
lte: new Date(String(dateAkhir))
|
lte: moment(String(dateAkhir)).endOf('day').toDate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,10 +55,10 @@ export async function GET(request: Request) {
|
|||||||
DivisionProjectTask: {
|
DivisionProjectTask: {
|
||||||
some: {
|
some: {
|
||||||
dateStart: {
|
dateStart: {
|
||||||
gte: new Date(String(date))
|
gte: moment(String(date)).startOf('day').toDate()
|
||||||
},
|
},
|
||||||
dateEnd: {
|
dateEnd: {
|
||||||
lte: new Date(String(dateAkhir))
|
lte: moment(String(dateAkhir)).endOf('day').toDate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -102,10 +103,10 @@ export async function GET(request: Request) {
|
|||||||
DivisionProjectTask: {
|
DivisionProjectTask: {
|
||||||
some: {
|
some: {
|
||||||
dateStart: {
|
dateStart: {
|
||||||
gte: new Date(String(date))
|
gte: moment(String(date)).startOf('day').toDate()
|
||||||
},
|
},
|
||||||
dateEnd: {
|
dateEnd: {
|
||||||
lte: new Date(String(dateAkhir))
|
lte: moment(String(dateAkhir)).endOf('day').toDate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -117,10 +118,10 @@ export async function GET(request: Request) {
|
|||||||
DivisionProjectTask: {
|
DivisionProjectTask: {
|
||||||
some: {
|
some: {
|
||||||
dateStart: {
|
dateStart: {
|
||||||
gte: new Date(String(date))
|
gte: moment(String(date)).startOf('day').toDate()
|
||||||
},
|
},
|
||||||
dateEnd: {
|
dateEnd: {
|
||||||
lte: new Date(String(dateAkhir))
|
lte: moment(String(dateAkhir)).endOf('day').toDate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -171,8 +172,8 @@ export async function GET(request: Request) {
|
|||||||
idGroup: String(grup)
|
idGroup: String(grup)
|
||||||
},
|
},
|
||||||
createdAt: {
|
createdAt: {
|
||||||
gte: new Date(String(date)),
|
gte: moment(String(date)).startOf('day').toDate(),
|
||||||
lte: new Date(String(dateAkhir))
|
lte: moment(String(dateAkhir)).endOf('day').toDate()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -181,8 +182,8 @@ export async function GET(request: Request) {
|
|||||||
category: 'FILE',
|
category: 'FILE',
|
||||||
idDivision: String(division),
|
idDivision: String(division),
|
||||||
createdAt: {
|
createdAt: {
|
||||||
gte: new Date(String(date)),
|
gte: moment(String(date)).startOf('day').toDate(),
|
||||||
lte: new Date(String(dateAkhir))
|
lte: moment(String(dateAkhir)).endOf('day').toDate()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -252,8 +253,8 @@ export async function GET(request: Request) {
|
|||||||
DivisionCalendarReminder: {
|
DivisionCalendarReminder: {
|
||||||
some: {
|
some: {
|
||||||
dateStart: {
|
dateStart: {
|
||||||
gte: new Date(String(date)),
|
gte: moment(String(date)).startOf('day').toDate(),
|
||||||
lte: new Date()
|
lte: moment().toDate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -267,8 +268,8 @@ export async function GET(request: Request) {
|
|||||||
DivisionCalendarReminder: {
|
DivisionCalendarReminder: {
|
||||||
some: {
|
some: {
|
||||||
dateStart: {
|
dateStart: {
|
||||||
gt: new Date(),
|
gt: moment().toDate(),
|
||||||
lte: new Date(String(dateAkhir))
|
lte: moment(String(dateAkhir)).endOf('day').toDate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -293,8 +294,8 @@ export async function GET(request: Request) {
|
|||||||
DivisionCalendarReminder: {
|
DivisionCalendarReminder: {
|
||||||
some: {
|
some: {
|
||||||
dateStart: {
|
dateStart: {
|
||||||
gte: new Date(String(date)),
|
gte: moment(String(date)).startOf('day').toDate(),
|
||||||
lte: new Date()
|
lte: moment().toDate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -306,8 +307,8 @@ export async function GET(request: Request) {
|
|||||||
DivisionCalendarReminder: {
|
DivisionCalendarReminder: {
|
||||||
some: {
|
some: {
|
||||||
dateStart: {
|
dateStart: {
|
||||||
gt: new Date(),
|
gt: moment().toDate(),
|
||||||
lte: new Date(String(dateAkhir))
|
lte: moment(String(dateAkhir)).endOf('day').toDate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { NextResponse } from "next/server";
|
|||||||
|
|
||||||
export async function GET(request: Request) {
|
export async function GET(request: Request) {
|
||||||
try {
|
try {
|
||||||
return NextResponse.json({ success: true, version: "2.1.9", tahap: "beta", update: "-api untuk dashboard monitoring" }, { status: 200 });
|
return NextResponse.json({ success: true, version: "2.1.10", tahap: "beta", update: "-perbaikan grafik divisi" }, { status: 200 });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, version: "Gagal mendapatkan version, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, version: "Gagal mendapatkan version, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
|
||||||
|
|||||||
Reference in New Issue
Block a user