Compare commits

...

15 Commits

Author SHA1 Message Date
ad6c5157e9 Merge pull request 'upd: fix route laporan divisi' (#35) from amalia/17-apr-26 into join
Reviewed-on: #35
2026-04-17 17:39:26 +08:00
73b19e0dd1 upd: fix route laporan divisi 2026-04-17 15:27:33 +08:00
abcbb3cd7f Merge pull request 'upd : api monitoring' (#34) from amalia/13-apr-26 into join
Reviewed-on: #34
2026-04-13 17:19:01 +08:00
ea3bf2cc3c upd : api monitoring 2026-04-13 11:36:26 +08:00
6b17378679 Merge pull request 'upd: fx api monitoring' (#33) from amalia/10-apr-26 into join
Reviewed-on: #33
2026-04-10 13:45:08 +08:00
d861a3ea86 upd: fx api monitoring 2026-04-10 13:44:15 +08:00
2f97ce81e4 Merge pull request 'upd : api monitoring' (#32) from amalia/09-apr-26 into join
Reviewed-on: #32
2026-04-09 17:34:25 +08:00
3c0a5639b6 upd : api monitoring 2026-04-09 17:33:21 +08:00
3ce650a27d Merge pull request 'amalia/08-apr-26' (#31) from amalia/08-apr-26 into join
Reviewed-on: #31
2026-04-08 17:27:06 +08:00
5efb96a92a upd: api monitoring--user 2026-04-08 17:24:50 +08:00
93ae77d335 upd: api monitoring log activity 2026-04-08 14:50:12 +08:00
0c131b80ef Merge pull request 'amalia/07-apr-26' (#30) from amalia/07-apr-26 into join
Reviewed-on: #30
2026-04-07 17:31:04 +08:00
5fd5c15394 upd: api monitoring detail desa 2026-04-07 17:25:14 +08:00
cb565ba0bd upd: api monitoring menu desa 2026-04-07 14:52:46 +08:00
940fa5a5b7 Merge pull request 'upd: api monitoring' (#29) from amalia/06-apr-26 into join
Reviewed-on: #29
2026-04-06 17:35:18 +08:00
5 changed files with 1500 additions and 160 deletions

View File

@@ -2,6 +2,7 @@ import { prisma } from "@/module/_global";
import { funGetUserById } from "@/module/auth";
import _, { ceil } from "lodash";
import { NextResponse } from "next/server";
import moment from "moment";
export async function GET(request: Request) {
try {
@@ -38,10 +39,10 @@ export async function GET(request: Request) {
DivisionProjectTask: {
some: {
dateStart: {
gte: new Date(String(date))
gte: moment(String(date)).startOf('day').toDate()
},
dateEnd: {
lte: new Date(String(dateAkhir))
lte: moment(String(dateAkhir)).endOf('day').toDate()
}
}
}
@@ -54,10 +55,10 @@ export async function GET(request: Request) {
DivisionProjectTask: {
some: {
dateStart: {
gte: new Date(String(date))
gte: moment(String(date)).startOf('day').toDate()
},
dateEnd: {
lte: new Date(String(dateAkhir))
lte: moment(String(dateAkhir)).endOf('day').toDate()
}
}
}
@@ -102,10 +103,10 @@ export async function GET(request: Request) {
DivisionProjectTask: {
some: {
dateStart: {
gte: new Date(String(date))
gte: moment(String(date)).startOf('day').toDate()
},
dateEnd: {
lte: new Date(String(dateAkhir))
lte: moment(String(dateAkhir)).endOf('day').toDate()
}
}
}
@@ -117,10 +118,10 @@ export async function GET(request: Request) {
DivisionProjectTask: {
some: {
dateStart: {
gte: new Date(String(date))
gte: moment(String(date)).startOf('day').toDate()
},
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)
},
createdAt: {
gte: new Date(String(date)),
lte: new Date(String(dateAkhir))
gte: moment(String(date)).startOf('day').toDate(),
lte: moment(String(dateAkhir)).endOf('day').toDate()
},
}
} else {
@@ -181,8 +182,8 @@ export async function GET(request: Request) {
category: 'FILE',
idDivision: String(division),
createdAt: {
gte: new Date(String(date)),
lte: new Date(String(dateAkhir))
gte: moment(String(date)).startOf('day').toDate(),
lte: moment(String(dateAkhir)).endOf('day').toDate()
},
}
}
@@ -252,8 +253,8 @@ export async function GET(request: Request) {
DivisionCalendarReminder: {
some: {
dateStart: {
gte: new Date(String(date)),
lte: new Date()
gte: moment(String(date)).startOf('day').toDate(),
lte: moment().toDate()
}
}
}
@@ -267,8 +268,8 @@ export async function GET(request: Request) {
DivisionCalendarReminder: {
some: {
dateStart: {
gt: new Date(),
lte: new Date(String(dateAkhir))
gt: moment().toDate(),
lte: moment(String(dateAkhir)).endOf('day').toDate()
}
}
}
@@ -293,8 +294,8 @@ export async function GET(request: Request) {
DivisionCalendarReminder: {
some: {
dateStart: {
gte: new Date(String(date)),
lte: new Date()
gte: moment(String(date)).startOf('day').toDate(),
lte: moment().toDate()
}
}
}
@@ -306,8 +307,8 @@ export async function GET(request: Request) {
DivisionCalendarReminder: {
some: {
dateStart: {
gt: new Date(),
lte: new Date(String(dateAkhir))
gt: moment().toDate(),
lte: moment(String(dateAkhir)).endOf('day').toDate()
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@ import { NextResponse } from "next/server";
export async function GET(request: Request) {
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) {
console.error(error);
return NextResponse.json({ success: false, version: "Gagal mendapatkan version, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });

11
src/lib/formatDateTime.ts Normal file
View File

@@ -0,0 +1,11 @@
function formatDateTime(date: Date) {
return new Intl.DateTimeFormat('id-ID', {
hour: '2-digit',
minute: '2-digit',
day: '2-digit',
month: 'short',
year: 'numeric',
}).format(date);
}
export default formatDateTime

38
src/lib/timeAgo.ts Normal file
View File

@@ -0,0 +1,38 @@
function timeAgo(date: Date) {
const now = new Date();
const d = new Date(date);
const diffMs = now.getTime() - d.getTime();
const seconds = Math.floor(diffMs / 1000);
const minutes = Math.floor(seconds / 60);
const hours = Math.floor(minutes / 60);
// 🔥 cek apakah masih hari yang sama
const isToday =
now.getDate() === d.getDate() &&
now.getMonth() === d.getMonth() &&
now.getFullYear() === d.getFullYear();
if (isToday) {
if (seconds < 60) return `${seconds} detik lalu`;
if (minutes < 60) return `${minutes} menit lalu`;
return `${hours} jam lalu`;
}
// 🔥 kalau bukan hari ini → tampil tanggal + jam
const time = d.toLocaleTimeString("id-ID", {
hour: "2-digit",
minute: "2-digit",
});
const datePart = d.toLocaleDateString("id-ID", {
day: "2-digit",
month: "short",
year: "numeric",
});
return `${time} ${datePart}`;
}
export default timeAgo