Sub-task EP-08-T07-S01 Yuqori 05_customers erpbom-backend

Node biriktirish / olib tashlash + validatsiya

Bajarildi
Status:

Tavsif

`customer_organization.manage` bilan mijozga org-node qo'shish va olib tashlash (UC4).

Texnik ko'rsatma

Agent uchun

🔴 Rule alohida (09_auth Q27): `customer.update` ilgari IKKI DOIRANI qamrardi (anketa `tenant` ↔ `customer_organizations` `org_node`) — endi ajratilgan. Seed'da `default_scope_type='org_node'`. Validatsiya (§9, 2026-08-04 soddalashuvi): node MAVJUD va `active` mi — shu darajada. "Boshqa korxona node'i" tekshiruvi KERAK EMAS: DB'da org-tree bitta (09_auth R17). Olib tashlashda (UC4 2-qadam): ochiq buyurtmalar O'ZGARMAYDI (05 da `orders` yo'q — hech narsa qilinmaydi); faqat biriktirish qatori o'chiriladi. Takroriy biriktirish — `UNIQUE(customer_id, organization_id)` bo'yicha aniq xato.

Qabul mezonlari (DoD)

3 / 3 bajarildi

  • Mavjud bo'lmagan yoki nofaol node biriktirilsa aniq xato qaytadi

    qa-ep-08-t07-s01 · 1 о аввал

  • Bir node ikki marta biriktirilsa 409/422 (500 emas)

    qa-ep-08-t07-s01 · 1 о аввал

  • `customer_organization.manage` huquqisiz chaqiruv 403; `customer.update` huquqi buni OCHMAYDI (alohida test)

    qa-ep-08-t07-s01 · 1 о аввал

O'zgargan fayllar

8 ta

  • modified src/test/java/uz/erpbom/customers/controller/CustomerOrganizationControllerIntegrationTest.java
  • modified src/main/java/uz/erpbom/auth/service/OrganizationService.java
  • modified src/main/java/uz/erpbom/customers/repository/CustomerOrganizationRepository.java
  • modified src/main/java/uz/erpbom/customers/mapper/CustomerOrganizationMapper.java
  • modified src/main/java/uz/erpbom/customers/dto/CustomerOrganizationCreateRequest.java
  • modified src/main/java/uz/erpbom/customers/dto/CustomerOrganizationResponse.java
  • modified src/main/java/uz/erpbom/customers/service/CustomerOrganizationService.java
  • modified src/main/java/uz/erpbom/customers/controller/CustomerOrganizationController.java

Izoh qoldirish

Tarix

13 yozuv

  • ✎

    finalize-ep-08 yangiladi

    Yangilandi: pr_url

  • ⇄

    qa-ep-08-t07-s01 statusni o'zgartirdi Review → Bajarildi

  • 💬

    qa-ep-08-t07-s01 izoh qoldirdi

    QA (qa-EP-08-T07-S01), commit 1dfb06d — QABUL QILINDI (done). Test: CustomerOrganizationControllerIntegrationTest — 13 test, 0 failures, 0 errors (izolyatsiyalangan git worktree, flock ostida, bloklovchi). Regressiya: CustomerQueryTest(20)+CustomerCreateTest(11)+OrganizationControllerIntegrationTest(9) = 40 test yashil. MEZONLAR (har biri MUTATSIYA bilan tasdiqlandi, yashil testga ishonilmadi): - AC3509 (404/409 ORGANIZATION_INACTIVE) — IKKI YARMI ham qoplangan. M1 (Service:60 `if (!organization.active())` bloki olib tashlandi) -> addingInactiveNodeReturns...InactiveConflict YIQILDI (kutilgan 409, olingan 201), boshqa 12 test tirik. M4 (auth OrganizationService.get 404 o'rniga stub qaytardi) -> addingUnknownNodeReturnsNotFound YIQILDI (kutilgan 404, olingan 409). Fixture xilma-xil: activeOrgId(active=true) va inactiveOrgId(active=false) alohida node'lar, har testda yangi id. - AC3510 (409, 500 EMAS) — M2 (`saveOrThrowDuplicate` dagi catch(DataIntegrityViolationException) olib tashlandi) -> addingSameNodeTwiceReturns... YIQILDI aynan `expected 409 but was 500 INTERNAL_SERVER_ERROR`, ya'ni test mezonda taqiqlangan 500 ni haqiqatan ushlaydi. javap: metodda Exception table qolmagani tasdiqlandi. Test qator sonini ham tekshiradi (countLinks==1). - AC3511 (alohida test talabi) — M3 RequirePermissionAspect:50 ga `customer.update` super-huquq sifatida qo'shildi (javap bilan bytecode'da tasdiqlandi). Natija IKKI TOMONLAMA: addingWithOnlyCustomerUpdatePermissionReturnsForbidden (201 oldi) va removingWithOnlyCustomerUpdatePermissionReturnsForbidden (204 oldi) YIQILDI, ammo addingWithoutManagePermission/removingWithoutManagePermission YASHIL qoldi — demak ikki ssenariy chinakam ALOHIDA testlar, biri ikkinchisini qoplab yurmayapti. QO'SHIMCHA: M5 (DELETE'da topilmagan biriktirish jim o'tkazildi) -> removingUnknownLink va removingAlreadyRemovedLink YIQILDI (204 o'rniga 404 kutilardi). M7 (201->200) -> happy-path va duplicate testlar YIQILDI. Kontrakt (openapi/v1/customers.yaml, MUZLATILGAN, tegilmadi): maydon nomlari/tiplari (organization_id, organization_name, organization_active, created_by_user_id, created_at), status kodlari (201/204/404/409/403) va xato kodlari aynan mos; global SNAKE_CASE. MODUL CHEGARASI (ADR-001) — BUZILMAGAN: customers paketi faqat `auth.service.OrganizationService` + `auth.dto.OrganizationResponse` ni import qiladi, auth entity/repository'ga TEGMAYDI. Qo'shilgan `OrganizationService.get(id)` sof additiv, @Transactional(readOnly=true). KUZATUV (bloklamaydi, keyingi bargga tavsiya): 1. M6 TIRIK QOLDI: `organization_name` qiymati buzilsa (mapperga 'MUTANT-NAME' uzatildi) 13 testdan hech biri yiqilmadi — test faqat `hasNonNull("organization_name")` deydi (test fayli 138-qator). Kontrakt bu maydonni `organizations.name` deb ta'riflaydi, lekin qiymat sinalmagan. EP-08-T07-S02 (GET ro'yxat) da fixture nomi bilan solishtiruvchi assert qo'shilsa yopiladi. (`required` ro'yxatida bo'lmagani va kod to'g'ri bo'lgani uchun bu mezon yiqilishi emas.) 2. `saveOrThrowDuplicate` HAR QANDAY DataIntegrityViolationException ni CUSTOMER_ORGANIZATION_EXISTS deb talqin qiladi — M4 ostida bu FK buzilishini 'allaqachon biriktirilgan' deb niqoblab qo'ydi. Amalda erishib bo'lmaydi (get()/requireCustomer oldin 404 beradi) va EmployeeProfessionService bilan bir xil naqsh, shuning uchun defekt emas; ammo constraint nomi bo'yicha ajratish kelajakda aniqroq bo'lardi. Toza: worktree /tmp/qa-EP-08-T07-S01 o'chirildi (git worktree list — faqat asosiy daraxt), asosiy daraxt `git status --short` BO'SH, HEAD hamon 1dfb06d, `grep -rn MUTANT src/` bo'sh. Kod/test/openapi/docs o'zgartirilmadi, commit qilinmadi.

  • ✓

    qa-ep-08-t07-s01 qabul mezonini belgiladi

    ✓ `customer_organization.manage` huquqisiz chaqiruv 403; `customer.update` huquqi buni OCHMAYDI (alohida test)

  • ✓

    qa-ep-08-t07-s01 qabul mezonini belgiladi

    ✓ Bir node ikki marta biriktirilsa 409/422 (500 emas)

  • ✓

    qa-ep-08-t07-s01 qabul mezonini belgiladi

    ✓ Mavjud bo'lmagan yoki nofaol node biriktirilsa aniq xato qaytadi

  • ⇄

    coder-ep-08-t07-s01 statusni o'zgartirdi Ishlanyapti → Review

  • ✎

    coder-ep-08-t07-s01 yangiladi

    Yangilandi: branch, commit_sha

  • 💬

    coder-ep-08-t07-s01 izoh qoldirdi

    POST/DELETE /api/v1/customers/{id}/organizations amalga oshirildi (GET - S02da). Validatsiya: node yoq -> 404 NOT_FOUND, organizations.active=false -> 409 ORGANIZATION_INACTIVE, takroriy -> 409 CUSTOMER_ORGANIZATION_EXISTS (UNIQUE buzilishi saveAndFlush+catch bilan toza 409ga aylantirildi, 500 emas). Rule customer_organization.manage (customer.update buni ochmaydi, alohida test). Cross-module: auth.OrganizationService ga get(id) metodi qoshildi (repository/entity ga togridan-togri tegilmadi, ADR-001 par2.3). 13/13 test yashil; 3 mutatsiya (inactive-check, duplicate-catch, permission) alohida tekshirildi - har biri faqat kutilgan testni yiqitdi, tiklandi.

  • 📄

    coder-ep-08-t07-s01 fayllarni qayd etdi

    8 ta fayl qayd etildi

  • ⇄

    coder-ep-08-t07-s01 statusni o'zgartirdi Backlog → Ishlanyapti

    Agent ishni boshladi

  • ⚑

    coder-ep-08-t07-s01 ishga oldi

  • ✦

    pm-agent yaratdi

    Node biriktirish / olib tashlash + validatsiya

Ma'lumot

Agent
coder-ep-08-t07-s01
Olingan
1 о аввал
Boshlandi
27.08.2026 14:20
Tugadi
27.08.2026 15:10
Baho
3 soat
Spec
erp/docs/modules/05_customers.md#8
Branch
feat/EP-08-erpbom-backend
Commit
1dfb06d1fc94

Bog'liqliklar

Bundan oldin tugashi kerak

Yo'q — bu ish mustaqil.

Agent uchun

Bu ishni AI agent quyidagicha oladi:

curl -s -X POST https://pmboard.ferp.uz/api/items/EP-08-T07-S01/claim \
  -H "X-Agent: backend-dev-1"

Tugatgach:

curl -s -X POST https://pmboard.ferp.uz/api/items/EP-08-T07-S01/status \
  -H "X-Agent: backend-dev-1" \
  -H "Content-Type: application/json" \
  -d '{"status":"review","note":"..."}'