api/docs/history/2026-07-25-modul-user-pengguna.md

46 lines
2.3 KiB
Markdown

# Modul User / Pengguna
**Tanggal:** 2026-07-25
**Status:** Selesai
## Tujuan
Membuat modul manajemen pengguna (user) dengan CRUD, mengikuti pola module jenis bisnis (business-types) dan paket (plans).
## Yang Dikerjakan
### 1. Simplify List Users Endpoint
- **Sebelum:** Menggunakan pagination (`page`, `limit`) dengan response headers
- **Sesudah:** List tanpa pagination, mendukung filter `status` (opsional)
- Mengikuti pola yang sama seperti business-types dan plans
### 2. Update UserProfile Model
- **Hapus:** field `timezone`
- **Tambah:** field `address` (Text), `pob` (String 100), `dob` (Date)
- Update schema, service, auth router, factory, seeder
### 3. Frontend CRUD Users
- Halaman baru `/admin/users` dengan DataTable, filter, create/edit dialog, delete
- Form create/edit: email, username, password, full_name, phone, address, pob, dob
## File yang Diubah
| File | Aksi | Detail |
|------|------|--------|
| `api/app/models/user_profile.py` | Diubah | Hapus `timezone`, tambah `address`, `pob`, `dob` |
| `api/app/schemas/user.py` | Diubah | Update `UserCreate`, `UserUpdate`, `UserProfileResponse` |
| `api/app/services/user_service.py` | Diubah | Update `create_user`, `profile_fields` |
| `api/app/routers/auth.py` | Diubah | Hapus `timezone` dari register & google-login |
| `api/app/factories/user_profile_factory.py` | Diubah | Hapus `timezone` |
| `api/app/seeders/user_seeder.py` | Diubah | Hapus `timezone` |
| `api/app/services/user_service.py` | Diubah | Update `get_user_list` (tanpa pagination + filter `status`) |
| `api/app/routers/users.py` | Diubah | Update `GET /` tanpa pagination |
| `api/tests/test_user_service.py` | Diubah | Update test `get_user_list` |
| `api/tests/test_user_api.py` | Diubah | Update test list tanpa pagination |
| `core/app/pages/admin/users/columns.ts` | Dibuat | Column definitions untuk tabel users |
| `core/app/pages/admin/users/index.vue` | Dibuat | Halaman CRUD users (list, create, edit, delete) |
| `core/app/components/AppSidebar.vue` | Diubah | Tambah menu "Pengguna" dengan icon `Users` |
## Notes
- Migrasi DB: `ALTER TABLE user_profiles DROP COLUMN timezone, ADD COLUMN address TEXT, ADD COLUMN pob VARCHAR(100), ADD COLUMN dob DATE;`
- Menggunakan field `status` yang sudah ada (ACTIVE/INACTIVE) untuk menampilkan status