Compare commits

..

7 Commits

Author SHA1 Message Date
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
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
0b9f07e543 upd: api monitoring 2026-04-06 17:23:32 +08:00
8440374424 Merge pull request 'upd: url otp' (#28) from amalia/27-mar-26 into join
Reviewed-on: #28
2026-03-27 14:09:48 +08:00
6 changed files with 1404 additions and 1 deletions

View File

@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Village" ADD COLUMN "isDummy" BOOLEAN NOT NULL DEFAULT false;

View File

@@ -51,6 +51,7 @@ model Village {
name String
desc String @db.Text
isActive Boolean @default(true)
isDummy Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
Group Group[]

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.8", tahap: "beta", update: "-api untuk dashboard noc; -perbaikan otp" }, { status: 200 });
return NextResponse.json({ success: true, version: "2.1.9", tahap: "beta", update: "-api untuk dashboard monitoring" }, { 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