fix(realisasi): add kode field to RealisasiItem and simplify table display
- Add kode field to RealisasiItem model in Prisma schema - Update API endpoints (create, update) to accept kode parameter - Update state management with proper type definitions - Add kode input field in RealisasiManager component - Simplify realisasiTable to show flat list (Kode, Uraian, Realisasi, %) - Remove section grouping and expandable details - Fix race condition in findUnique.load() with loading guard - Fix linting errors across multiple files Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
@@ -69,6 +69,7 @@ const APBDes = new Elysia({
|
||||
.post("/:itemId/realisasi", realisasiCreate, {
|
||||
params: t.Object({ itemId: t.String() }),
|
||||
body: t.Object({
|
||||
kode: t.String(),
|
||||
jumlah: t.Number(),
|
||||
tanggal: t.String(),
|
||||
keterangan: t.Optional(t.String()),
|
||||
@@ -80,6 +81,7 @@ const APBDes = new Elysia({
|
||||
.put("/realisasi/:realisasiId", realisasiUpdate, {
|
||||
params: t.Object({ realisasiId: t.String() }),
|
||||
body: t.Object({
|
||||
kode: t.Optional(t.String()),
|
||||
jumlah: t.Optional(t.Number()),
|
||||
tanggal: t.Optional(t.String()),
|
||||
keterangan: t.Optional(t.String()),
|
||||
|
||||
@@ -3,6 +3,7 @@ import prisma from "@/lib/prisma";
|
||||
import { Context } from "elysia";
|
||||
|
||||
type RealisasiCreateBody = {
|
||||
kode: string;
|
||||
jumlah: number;
|
||||
tanggal: string; // ISO format
|
||||
keterangan?: string;
|
||||
@@ -33,6 +34,7 @@ export default async function realisasiCreate(context: Context) {
|
||||
const realisasi = await prisma.realisasiItem.create({
|
||||
data: {
|
||||
apbdesItemId: itemId,
|
||||
kode: body.kode,
|
||||
jumlah: body.jumlah,
|
||||
tanggal: new Date(body.tanggal),
|
||||
keterangan: body.keterangan,
|
||||
|
||||
@@ -3,6 +3,7 @@ import prisma from "@/lib/prisma";
|
||||
import { Context } from "elysia";
|
||||
|
||||
type RealisasiUpdateBody = {
|
||||
kode?: string;
|
||||
jumlah?: number;
|
||||
tanggal?: string;
|
||||
keterangan?: string;
|
||||
@@ -33,6 +34,7 @@ export default async function realisasiUpdate(context: Context) {
|
||||
const updated = await prisma.realisasiItem.update({
|
||||
where: { id: realisasiId },
|
||||
data: {
|
||||
...(body.kode !== undefined && { kode: body.kode }),
|
||||
...(body.jumlah !== undefined && { jumlah: body.jumlah }),
|
||||
...(body.tanggal !== undefined && { tanggal: new Date(body.tanggal) }),
|
||||
...(body.keterangan !== undefined && { keterangan: body.keterangan }),
|
||||
|
||||
Reference in New Issue
Block a user