feat(apbdes): make image and file optional for edit page too

Changes:

Backend (updt.ts, index.ts):
- Update FormUpdateBody: imageId?: string | null
- Update Elysia schema: t.Optional(t.String())
- Handle null/undefined values when updating

UI (edit/page.tsx):
- Remove mandatory validation for imageId and fileId
- Update labels to show '(Opsional)'
- Simplify handleSubmit logic (no validation check)
- Keep existing file IDs if no new upload

User Flow:
Before: Edit required imageId and fileId to be present
After: Can update APBDes without files, preserve existing or set to null

Files changed:
- src/app/api/[[...slugs]]/_lib/landing_page/apbdes/updt.ts
- src/app/api/[[...slugs]]/_lib/landing_page/apbdes/index.ts
- src/app/admin/(dashboard)/landing-page/apbdes/[id]/edit/page.tsx

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
2026-03-05 15:53:26 +08:00
parent 4821934224
commit 159fb3cec6
7 changed files with 47 additions and 55 deletions

View File

@@ -134,7 +134,7 @@ export default function FixedPlayerBar() {
p="sm"
shadow="lg"
style={{
zIndex: 1000,
zIndex: 1,
borderTop: '1px solid rgba(0,0,0,0.1)',
}}
>