Merge pull request 'nico/25-feb-26' (#70) from nico/25-feb-26 into staggingweb

Reviewed-on: #70
This commit is contained in:
2026-02-25 21:34:28 +08:00
13 changed files with 114 additions and 58 deletions

View File

@@ -17,7 +17,6 @@ export default async function kategoriBeritaDelete(context: Context) {
where: {
kategoriBeritaId: id,
isActive: true,
deletedAt: null,
},
});

View File

@@ -23,10 +23,9 @@ export default async function findUnique(
// ✅ Filter by isActive and deletedAt
const data = await prisma.potensiDesa.findFirst({
where: {
where: {
id,
isActive: true,
deletedAt: null,
},
include: {
image: true,

View File

@@ -17,7 +17,6 @@ export default async function kategoriPotensiDelete(context: Context) {
where: {
kategoriId: id,
isActive: true,
deletedAt: null,
},
});

View File

@@ -1,10 +1,9 @@
import prisma from "@/lib/prisma";
import { requireAuth } from "@/lib/api-auth";
export default async function sejarahDesaFindFirst(request: Request) {
export default async function sejarahDesaFindFirst() {
// ✅ Authentication check
const headers = new Headers(request.url);
const authResult = await requireAuth({ headers });
const authResult = await requireAuth();
if (!authResult.authenticated) {
return authResult.response;
}
@@ -12,9 +11,8 @@ export default async function sejarahDesaFindFirst(request: Request) {
try {
// Get the first active record
const data = await prisma.sejarahDesa.findFirst({
where: {
where: {
isActive: true,
deletedAt: null
},
orderBy: { createdAt: 'asc' } // Get the oldest one first
});

View File

@@ -7,8 +7,8 @@ const SejarahDesa = new Elysia({
prefix: "/sejarah",
tags: ["Desa/Profile"],
})
.get("/first", async (context) => {
const response = await sejarahDesaFindFirst(new Request(context.request));
.get("/first", async () => {
const response = await sejarahDesaFindFirst();
return response;
})
.get("/:id", async (context) => {

View File

@@ -4,7 +4,7 @@ import { Context } from "elysia";
export default async function sejarahDesaUpdate(context: Context) {
// ✅ Authentication check
const authResult = await requireAuth(context);
const authResult = await requireAuth();
if (!authResult.authenticated) {
return authResult.response;
}