feat(ekonomi): unify UMKM and Pasar Desa models, add business profile and product forms

This commit is contained in:
2026-04-21 15:19:57 +08:00
parent a2d157ee02
commit e286cb4f2b
22 changed files with 586 additions and 80 deletions

View File

@@ -0,0 +1,26 @@
# Plan: Refactor UMKM and Pasar Desa Model
## Objective
Unify `ProdukUmkm` and `PasarDesa` into a single `PasarDesa` model to avoid data redundancy and simplify management.
## Changes:
1. **Schema Refactor**:
- Merge fields from `ProdukUmkm` (`stok`, `umkmId`) into `PasarDesa`.
- Update `PenjualanProduk` to relate directly to `PasarDesa`.
- Remove `ProdukUmkm` model.
- Update `FileStorage` relations.
2. **Backend/API Refactor**:
- Update Pasar Desa `findMany` to only show products where `umkmId` is null.
- Update UMKM Produk APIs (`create`, `updt`, `findMany`, `del`) to use the `PasarDesa` model with `umkmId` filter.
- Update Penjualan logic to adjust `stok` in `PasarDesa`.
- Update UMKM Dashboard analytics to query `PasarDesa`.
3. **Admin UI Refactor**:
- Update `umkmState` to handle `kategoriId` for products.
- Create "Tambah UMKM" form for business profile management.
- Create "Tambah Produk UMKM" form for product management with `umkmId` binding.
- Update list views to link to the new forms.
- Implement logical separation between "Pasar Desa Admin" and "UMKM Admin" contexts.
## Verification:
- Successful build (`bun run build`).
- Verify API responses for both Pasar Desa and UMKM Produk filters.

View File

@@ -0,0 +1,10 @@
# Task: Refactor UMKM and Pasar Desa Model
- [x] Refactor `prisma/schema.prisma` and run `db push` <!-- id: 0 -->
- [x] Update Pasar Desa `findMany` API with `umkmId: null` filter <!-- id: 1 -->
- [x] Update UMKM Produk APIs (CRUD) to use `PasarDesa` model <!-- id: 2 -->
- [x] Update UMKM Dashboard analytics and Penjualan logic <!-- id: 3 -->
- [x] Create Admin Form for "Data UMKM" (Business Profile) <!-- id: 4 -->
- [x] Create Admin Form for "Produk UMKM" (Product) <!-- id: 5 -->
- [x] Link list views to new forms and update state <!-- id: 6 -->
- [ ] Run build and verify <!-- id: 7 -->