638362df1c
feat: improve move-draft-to-current with differential sync
...
Implement differential sync for organization structure and positions
instead of delete-all-and-insert-all approach.
Changes:
- Add OrgIdMapping and AllOrgMappings interfaces for tracking ID mappings
- Implement syncOrgLevel() helper for differential sync per org level
- Add syncPositionsForPosMaster() helper for position table sync
- Process org levels bottom-up (Child4→Child3→Child2→Child1→Root)
- Use ancestorDNA matching with Like operator for descendant sync
- Cascade delete positions before deleting org nodes
- Batch DELETE/UPDATE/INSERT operations for better performance
- Track draft→current ID mappings for position updates
- Add comprehensive documentation in docs/move-draft-to-current.md
Benefits:
- Preserve IDs for unchanged nodes (better tracking)
- More efficient (fewer database operations)
- Better data integrity with proper FK handling
- Sync all descendants under given rootDnaId
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 12:35:59 +07:00
3177ffc42f
merge
2026-02-06 21:46:41 +07:00
528f8f75c1
add query
2026-02-06 16:50:31 +07:00
256296672d
privilege
Build & Deploy on Dev / build (push) Successful in 48s
2026-02-06 15:25:54 +07:00
77b545d392
fix child privilege
Build & Deploy on Dev / build (push) Successful in 48s
2026-02-06 15:12:52 +07:00
8a649086f7
fix : #2239
Build & Deploy on Dev / build (push) Successful in 48s
2026-02-06 14:55:59 +07:00
631d634074
#2239
Build & Deploy on Dev / build (push) Successful in 49s
2026-02-05 13:37:28 +07:00
d0241016fb
disciption
Build & Deploy on Dev / build (push) Successful in 1m3s
2026-02-05 11:45:10 +07:00
561dc7f66c
change method
2026-02-05 11:43:59 +07:00
39a07482cd
add api find dna by keycloak
Build & Deploy on Dev / build (push) Successful in 1m0s
2026-02-05 11:23:38 +07:00
1a324af483
fix: api /super-admin/{id} memory cache
2026-01-28 18:26:03 +07:00
7c70229579
fix: query use Promise all
2026-01-28 17:48:28 +07:00
5dcb59632f
fix: Api GET /super-admin/{id}
2026-01-28 17:43:26 +07:00
bca25a7a52
feat: optimize detailSuperAdmin API to fix database connection issue
...
ปัญหา: API GET /api/v1/org/super-admin/{id} ทำให้ระบบดับเพราะ N+1 queries
- เดิม: >1,000,000 queries (100 orgRoots × 10 children × 10 counts/level)
- ใหม่: ~10 queries (query รวมครั้งเดียว + 5 org queries)
การเปลี่ยนแปลง:
1. สร้าง OrganizationController-optimized.ts
- getPositionCounts(): query posMaster ทั้งหมดครั้งเดียว
- สร้าง maps (orgRootMap, orgChild1Map, etc.) สำหรับ lookup
- ลด queries จาก 1,000,000+ → ~10 queries
2. เพิ่ม import สำหรับ helper functions ใน OrganizationController.ts
- import { getPositionCounts, getCounts, getRootCounts }
- ต้อง replace ฟังก์ชัน detailSuperAdmin ด้วย optimized version
- ดู OPTIMIZED_FUNCTION.ts สำหรับฟังก์ชันใหม่
ไฟล์ที่เพิ่ม:
- src/controllers/OrganizationController-optimized.ts (helper functions)
- OPTIMIZED_FUNCTION.ts (optimized function reference)
- src/utils/log-memory-store.ts (from earlier log middleware fix)
หมายเหตุ: ฟังก์ชัน detailSuperAdmin ใน OrganizationController.ts
ยังไม่ถูก replace (ต้องทำ manual) - ดู OPTIMIZED_FUNCTION.ts
Co-Authored-By: Claude (glm-4.7) <noreply@anthropic.com>
2026-01-28 13:45:52 +07:00
mamoss
32e682d05e
search dna
2026-01-02 21:43:57 +07:00
mamoss
3a4e16deb0
add permission brother
2025-12-12 01:36:51 +07:00
mamoss
f814454003
update permission
2025-12-07 13:51:01 +07:00
AdisakKanthawilang
39a1a3bbb0
#1767 ( #205 )
release / release (push) Failing after 9s
2025-11-03 11:56:26 +07:00
f32debfbb6
test commit
2025-11-03 10:48:04 +07:00
04484444ec
owner privilege
2025-10-22 11:59:49 +07:00
ad3a04ad3f
Merge branch 'develop' into adiDev
2025-10-22 11:35:46 +07:00
35011ea959
#1893
2025-10-22 11:34:56 +07:00
42c8f34f15
fix script: retire remove from org
2025-10-21 10:12:23 +07:00
e59ccf88b3
fix: script create keycloak
2025-10-21 00:11:18 +07:00
2429159020
fix: send token in keycloak function & change script fix retire
2025-10-20 23:04:04 +07:00
AdisakKanthawilang
45cc074e81
update validate privilege ( #201 )
2025-10-20 17:45:43 +07:00
0d059f24ea
update validate สิทธิ์จัดการโครงสร้างในเมนูโครงสร้างอัตตรากำลัง
2025-10-17 17:38:54 +07:00
5cdcc2a91e
update privilage validate (NORMAL) and update calRetireLaw
2025-10-17 16:05:42 +07:00
645f9760f0
update privilege validate (OWNER)
2025-10-17 13:51:43 +07:00
mamoss
58274b479c
สิทธิ์ดูโครงสร้าง
2025-10-16 00:33:48 +07:00
mamoss
fd17f366b8
add parent
2025-10-07 11:14:00 +07:00
abab998cd0
fix bug run delete keycloak
2025-10-03 22:18:32 +07:00
decb2433de
fix script run retire this year
2025-10-03 17:14:20 +07:00
aadcec440e
fix sort registry and add script update retire emp / position select
2025-10-03 17:04:05 +07:00
d8d376386d
fix
2025-10-01 16:37:23 +07:00
08af004d4a
fix script update retire of 2569
2025-10-01 13:01:54 +07:00
aff6958149
fix error script retire
2025-10-01 12:10:27 +07:00
a366e5ca0d
update scrip update retire
2025-10-01 11:33:00 +07:00
mamoss
7eae9d2c8d
ลบคนออกจากโครงสร้าง
2025-10-01 08:59:18 +07:00
mamoss
c5b54d55de
api add permission org
2025-09-28 14:24:46 +07:00
mamoss
b90e4114a8
หา สกก1
2025-09-15 16:24:07 +07:00
adisak
0df264e900
update #1675
2025-08-26 12:07:03 +07:00
f05e2fef55
ปิด validate
2025-08-25 16:05:39 +07:00
6f57be2fe9
validate draft and publish
2025-08-21 18:25:24 +07:00
018aae2c57
#1305 ลบ posMasterAct
2025-07-25 17:54:26 +07:00
c297572c79
fix bug return array org-chart
2025-07-24 16:58:19 +07:00
554e3f2e22
add org chart by root id
2025-07-24 16:18:41 +07:00
bda80475d1
tuning api org chart
2025-07-22 10:29:07 +07:00
mamoss
3ae17c23e2
filter รักษาการ
2025-07-18 16:33:09 +07:00
cd6aa9b1a2
CheckQueueInProgress
2025-07-11 16:50:12 +07:00