feat(rw): crud rw - #63
Closed
aaz132 wants to merge 1 commit into
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Lanjutan EV5-7-S1 (
RegionController) — CRUD untuk resourcerws(RW): list (dengan filterhamlet_id), tambah, edit, dan hapus. Polanya mengikuti persis PRhamletssebelumnya (guard otorisasi + guard integritas data warga), termasuk validasi nomor RW unik per dusun.Jira Ticket
Ticket: EV5-7-S1
Type of Change
Changes Made
indexRws,storeRw,updateRw,destroyRwdiRegionController.phppetugas_desayang boleh create/update/delete RW (403 untuk role lain)numberRW harus unik perhamlet_id, dengan pesan error custom Bahasa IndonesiaguardDeactivationsekarang menerima parameter$message, biar bisa dipakai bareng antara hamlets dan rws tanpa mengubah pesan error yang sudah ada di endpoint hamletsroutes/api.phpdalam groupauth:sanctum:GET/POST /rws,PATCH/DELETE /rws/{rw}RegionControllerTest.php: create/list/update/delete sukses, non-petugas_desa ditolak, duplicate number ditolak, guard nonaktifkan & hapus dengan warga aktifHow to Test
role=petugas_desayang punyavillage_idterisi (bukan useradminseeder yangvillage_id-nya null) lewatphp artisan tinkerAuthorization: Bearer <token>:GET /api/rws?hamlet_id=1→ daftar RW di dusun tersebutPOST /api/rwsbody{"hamlet_id": 1, "number": "002"}→ 201POST /api/rwsdenganhamlet_id+numberyang sama lagi → 422 (duplikat)PATCH /api/rws/{id}body{"is_active": false}→ 200 kalau tidak ada warga aktif, 409 kalau masih adaDELETE /api/rws/{id}→ 200 kalau tidak ada warga terdaftar, 409 kalau masih adapetugas_desa→ harus dapat 403php artisan test --filter=RegionControllerTest— semua 9 test (5 hamlets + 4 rws) harus passScreenshots (if applicable)
Checklist
dev(bukan langsung kemain)