13.3 · Inter-service call map
บทนี้รวบรวมทุก "ใครเรียกใคร" ที่พิสูจน์ได้จากโค้ดจริงข้าม Volume 3-9 — เฉพาะการเรียกข้าม network (HTTP/GraphQL/WebSocket) เท่านั้น ไม่รวม database-level coupling (service ต่อฐานข้อมูลของอีก service ตรงด้วย connection string — เช่น workflow-api ต่อ vtrc/benefit/dbHRMI_Center ตรง, pms-api/chat-center-api/sso-api ต่อ dbHRMI_Center/dbWorkforce ตรง) รายการ database coupling จะอยู่ใน Volume 11 (Data Model — ยังไม่เขียนในรอบนี้) แต่ถูกกล่าวถึงในบทของแต่ละ repo เอง (ดู citation ในตารางที่ 13.3.4)
13.3.1 · แผนที่ระดับ platform group
Web/Mobile Frontends ──GraphQL──► vtrc-api ──GraphQL/REST──► cu-central-api ──► HRMI MSSQL/LDAP
│ │
│ (hardcode URL, ตรงจาก client)│ (REST call ที่ caller ไม่ยืนยัน)
▼ ▼
vtrc-common centralize-api (NestJS, อาจไม่มี caller จริง)
2way Platform (ภายในกลุ่มเรียกกันเยอะ, เรียกออกไป Legacy Core ด้วย 3 ทาง)
2way-meeting-backoffice ──► 2way-vtrc-api (backend หลักฝั่งพนักงาน)
2way-meeting-backoffice ──► 2way-api (บาง feature: survey/announce แอดมิน)
2way-meeting-backoffice ──► chat-center-api (Domain Microservices group ข้ามกลุ่ม)
2way-api ──► centralize-api (REST) + cu-central-api (GraphQL) + 2way-line-service
Meeting Platform (เรียกข้ามไป Legacy Core และข้ามไป 2way Platform)
meeting-backoffice(-new) ──► meeting-vtrc-api ──► vtrc-api + cu-central-api
meeting-backoffice(-new) ──► 2way-vtrc-api (endpoint getUserByCondition — ข้ามกลุ่ม)
Domain Microservices (ส่วนใหญ่คุยกับ Legacy Core ผ่าน HTTP + database ตรง, ไม่คุยกันเองในกลุ่ม)
benefit-api ──► vtrc-api + vtrc-common + centralize/cu-central (ไม่ยืนยันตัวไหน)
recruitment-api ──► workforce-api (repo ไม่ยืนยัน)
ai-recruitment-api ──► (ตัดขาดจาก legacy core 100% — เชื่อมแค่ผ่าน shared JWT secret + shared DB กับ recruitment-api)
job-scheduler-api ──► incident-management-api (repo ไม่มีในworkspace)
2way-meeting-backoffice ──► incident-management-api (repo เดียวกัน, เรียกจากสองทาง)13.3.2 · ตารางความสัมพันธ์ที่ยืนยันแล้ว (confirmed จากโค้ด)
| # | Caller | Callee | Protocol | ใช้ทำอะไร | หลักฐาน |
|---|---|---|---|---|---|
| 1 | vtrc-web | vtrc-api | GraphQL | ทุกฟีเจอร์ฝั่งพนักงาน | Canonical Truths |
| 2 | vtrc-rc-backoffice | vtrc-api | GraphQL | ทุกฟีเจอร์ฝั่งเจ้าหน้าที่ | Canonical Truths |
| 3 | vtrc-backoffice / vtrc-backoffice-new | vtrc-api | GraphQL | ทุกฟีเจอร์ back office | Canonical Truths |
| 4 | vtrc-mobile / new-vtrc-mobile | vtrc-api | GraphQL | ทุกฟีเจอร์บนมือถือ | Canonical Truths |
| 5 | vtrc-web | vtrc-common | REST | address/bank dropdown, file upload | vtrc-common/02-core-pipeline |
| 6 | vtrc-rc-backoffice | vtrc-common | REST | เดียวกับข้างบน | vtrc-common/02-core-pipeline |
| 7 | vtrc-mobile | vtrc-common | REST | file upload | vtrc-common/02-core-pipeline |
| 8 | vtrc-api | cu-central-api | GraphQL (END_POINT_CENTRALIZE) | HR data ทั้งหมด (profile, slip, leave, withdraw, fund, time attendance) | vtrc-api/04-centralize-bridge |
| 9 | vtrc-api | cu-central-api | REST auth (END_POINT_CENTRALIZE_AUTH) | signin/signinbypass/signout/token refresh | vtrc-api/04-centralize-bridge |
| 10 | vtrc-api | hrmi-api.redcross.or.th (legacy REST) | REST, TLS off | side channel ขนาน กับ cu-central-api | vtrc-api/04-centralize-bridge |
| 11 | vtrc-api | Conicle LMS | REST + cookie SSO | SSO เข้าระบบ e-learning ภายนอก | vtrc-api/04-centralize-bridge |
| 12 | vtrc-api | Firebase Cloud Messaging | REST (legacy HTTP v1, deprecated) | push notification | vtrc-api/04-centralize-bridge |
| 13 | 2way-api | centralize-api (NestJS REST) | REST | EmployeesService — organize/division/department/manager/position/group/getByEmpCode/bankAccount | 2way-api/03-persistence-integrations |
| 14 | 2way-api | cu-central-api | GraphQL (CENTRALIZE_API_URL) | fetchListEmployeeForTwoWay — employee directory | 2way-api/03-persistence-integrations |
| 15 | 2way-api | 2way-line-service | REST, hardcoded IP 20.212.116.206:8200 | nextPageLine/previousPageLine — สลับ rich menu LINE | 2way-api/03-persistence-integrations |
| 16 | 2way-vtrc-api | cu-central-api | GraphQL, hardcoded centralizeapi.redcross.or.th:25563 | fetchListEmployeeForTwoWay (URL คนละตัวจาก #14 แต่ query เดียวกัน) | 2way-vtrc-api/03-persistence-integrations |
| 17 | 2way-meeting-backoffice | 2way-vtrc-api | REST (appConnectChatAPI → /2way/...) | backend หลักของทุกหน้าฝั่งพนักงาน (Announce/Survey/Complaint/Incident/Register/FAQ) | 2way-meeting-backoffice/03-persistence-integrations |
| 18 | 2way-meeting-backoffice | 2way-api | REST (appConnectAPI) | survey list/types, announce list แอดมิน, auth login/verifyToken | 2way-api/index |
| 19 | 2way-meeting-backoffice | chat-center-api | REST + WebSocket (Socket.IO) | ChatCenter widget, chatRoomHistory, appointment | 2way-meeting-backoffice/03-persistence-integrations |
| 20 | meeting-vtrc-api | vtrc-api | GraphQL (vtrcConnector) | verify token (fetchEmployeeProfileForOtherService), push notification (sendNotificationFrom3Party) | meeting-vtrc-api/03-persistence-integrations |
| 21 | meeting-vtrc-api | cu-central-api | GraphQL (cdbConnector) | fetchListEmployeeForTwoWay — แปลง empCode เป็นชื่อผู้เข้าร่วมประชุม | meeting-vtrc-api/03-persistence-integrations |
| 22 | meeting-backoffice | meeting-vtrc-api | REST (NEXT_PUBLIC_APP_MEETING_API) | CRUD กลุ่มผู้ใช้/ผู้อนุมัติ, ค้นหา org | meeting-backoffice/03-persistence-integrations |
| 23 | meeting-backoffice | 2way-vtrc-api | REST (NEXT_PUBLIC_APP_2WAY_API → /2way) | POST /getUserByCondition — ค้นหาพนักงานเพิ่มเข้ากลุ่ม (ข้ามไป 2way Platform group) | meeting-backoffice/03-persistence-integrations |
| 24 | meeting-backoffice-new | meeting-vtrc-api | REST (REACT_APP_MEETING_API) | เดียวกับ #22 | meeting-backoffice-new/03-persistence-integrations |
| 25 | meeting-backoffice-new | 2way-vtrc-api | REST (REACT_APP_2WAY_API) | เดียวกับ #23 | meeting-backoffice-new/03-persistence-integrations |
| 26 | benefit-api | vtrc-api | HTTP (VTRC_SERVER) | listTermFeeForApprover, cancelStudyEducation | benefit-api/04-auth-integrations |
| 27 | benefit-api | vtrc-common | REST | file/save, file/delete, file/getFileArray (เก็บไฟล์แนบเบิกเงิน) | vtrc-common/02-core-pipeline, benefit-api/04-auth-integrations |
| 28 | benefit-api | centralize server พอร์ต 3100 (identity ไม่ยืนยัน 100%) | REST | getEmployeeDisaster, getByEmpCode, bankAccount | benefit-api/04-auth-integrations |
| 29 | recruitment-web | recruitment-api | REST | OTP login, สร้าง/แก้ไขใบสมัครงาน, สมัครตำแหน่ง | recruitment-web/02-core-pipeline |
| 30 | recruitment-api | workforce-api (identity ไม่ยืนยัน 100%) | HTTP (WORKFORCE_SERVER) | ข้อมูลพนักงาน/manpower สำหรับสัญญาจ้าง | recruitment-api/04-auth-integrations |
| 31 | job-scheduler-api | incident-management-api (repo ไม่อยู่ใน workspace) | REST (cron รายวัน) | POST /incident-management-api/crontab/summary | job-scheduler-api/03-persistence-integrations |
| 32 | 2way-meeting-backoffice | incident-management-api (repo เดียวกับ #31) | REST | master/list/003, incidents/list/empCode/{empCode}, incidents/{id} | 2way-meeting-backoffice/03-persistence-integrations |
| 33 | pms-api | pms-ai-api (โดเมนภายนอก vtrcsupport.com) | REST | vector-embedding สำหรับ course recommendation | pms-api/04-auth-integrations |
| 34 | workflow-api | AI Router (AI_ROUTER_BASE_URL, ManageAI) | REST | chat completion + embedding สำหรับ course embedding | workflow-api/03-persistence-integrations |
นับได้ 34 ความสัมพันธ์ caller→callee ที่ยืนยันจากโค้ดจริง ไม่รวมความสัมพันธ์กับ third-party SaaS ที่ไม่ใช่ repo ในแพลตฟอร์ม (LINE, SMTP, OpenAI, remove.bg, SFTP, reCAPTCHA, Sentry, qrserver.com, SSO ภายนอก, Conicle, FCM — ดู 13.3.5)
13.3.3 · ความสัมพันธ์ที่พบซ้ำ 2 จุดที่น่าสนใจ
fetchListEmployeeForTwoWay ถูกเรียกจาก 3 caller ที่ไม่ใช่ 2way Platform โดยตรง — query นี้ชื่อสื่อว่าออกแบบไว้ให้ 2way-api ใช้ (#14) แต่กลายเป็น general-purpose employee-directory query ที่ 2way-vtrc-api (#16) และ meeting-vtrc-api (#21) ก็ยืมใช้เหมือนกัน — คนละ URL ที่ hardcode ต่างกัน (CENTRALIZE_API_URL env vs centralizeapi.redcross.or.th:25563 hardcode vs CDB_BASE_CONNECT env) ชี้ไปที่ schema เดียวกันของ cu-central-api แต่ไม่มีหลักฐานยืนยันว่าทั้ง 3 จุดชี้ไป instance เดียวกันจริง 100%
incident-management-api ถูกอ้างถึงจาก 2 repo คนละกลุ่ม (job-scheduler-api ใน Domain Microservices และ 2way-meeting-backoffice ใน 2way Platform) แต่ repo นี้ไม่มีอยู่ในเวิร์กสเปซที่ตรวจสอบได้ — เป็นหลักฐานว่ามี microservice ที่ 26 (incident-management-api) ทำงานอยู่จริงในแพลตฟอร์ม แต่ยังไม่ถูก scaffold เข้าเอกสารชุดนี้ ควรเพิ่มเข้า canonical-truths.md เป็นรายการ "repo ที่รู้จักแต่ยังไม่มีเอกสาร"
13.3.4 · Database-level coupling (ไม่ใช่ network call — อ้างอิงไว้เพื่อความสมบูรณ์)
รายการนี้ไม่ถูกนับใน "34 ความสัมพันธ์" ข้างบนเพราะไม่ใช่ network call แต่ทำหน้าที่คล้าย inter-service coupling — สำคัญพอที่ engineer ต้องรู้ก่อนแก้ schema:
| Service ที่ต่อ DB ตรง | DB ของใคร | หลักฐาน |
|---|---|---|
benefit-api | schema vtrc ของ vtrc-api (raw SQL, cancel/update WDHospitals) | benefit-api/04-auth-integrations |
workflow-api | schema vtrc (vtrc-api), benefit/benefit_write (benefit-api), dbHRMI_Center/dbHRMI_Center_NBC | workflow-api/03-persistence-integrations |
pms-api | dbWorkforce, dbWorkforce_temp | pms-api/index |
chat-center-api | dbHRMI_Center.dbo.temp_pee_na_table (cross-database query) | chat-center-api/03-persistence-integrations |
sso-api | dbHRMI_Center.dbo.temp_pee_na_table, dbHRMI_Center.dbo.emPerson | sso-api/03-persistence-integrations |
2way-api | schema pms (pms.dbo.tbnotify) ข้าม schema จาก [2way].dbo.userline | 2way-api/03-persistence-integrations |
ai-recruitment-api / recruitment-api | database recruitment_ai ใช้ร่วมกัน 100% | ai-recruitment-api/index |
13.3.5 · Third-party SaaS ที่ไม่ใช่ repo ภายใน
| Service ที่เรียก | ปลายทาง | Caller (repo ในแพลตฟอร์ม) |
|---|---|---|
| LINE Messaging API | api.line.me | vtrc-api, 2way-api, 2way-vtrc-api, chat-center-api |
| OpenAI (Chat + Images) | api.openai.com | ai-recruitment-api |
| remove.bg | api.remove.bg | ai-recruitment-api |
| HCTI | hcti.io | ai-recruitment-api (ประกาศ env, ไม่พบจุดเรียกที่ยืนยันได้) |
| qrserver.com | api.qrserver.com | ai-recruitment-api |
| SMTP (Outlook) | smtp-mail.outlook.com | recruitment-api, pms-api, meeting-vtrc-api, vtrc-api |
| SFTP (FMIS) | 10.188.128.22:22 | benefit-api |
| SSO ภายนอก | SSO_END_POINT (โดเมนไม่ยืนยัน) | sso-api, 2way-api |
| Conicle LMS | cookie SSO | vtrc-api |
| Firebase Cloud Messaging | legacy HTTP v1 | vtrc-api |
| Sentry | error tracking SaaS | 2way-vtrc-api, meeting-vtrc-api, meeting-backoffice, 2way-meeting-backoffice |
| AI Router (ManageAI) | LLM ภายนอก | workflow-api |
| Google reCAPTCHA | google.com/recaptcha | recruitment-api (ประกาศ env, จุดเรียกไม่ยืนยัน), recruitment-web |
13.3.6 · Hub service ที่มี fan-in/fan-out สูงสุด
| Service | Fan-in (จำนวน caller ที่ยืนยัน) | Fan-out (จำนวน callee ที่ยืนยัน) |
|---|---|---|
cu-central-api | 4 (vtrc-api, 2way-api, 2way-vtrc-api, meeting-vtrc-api) | 0 (ปลายทางคือ database/LDAP ไม่ใช่ network call ไป repo อื่น) |
vtrc-api | 6 frontend + benefit-api + 2way-api (dead code) + meeting-vtrc-api = 9 | 6 (cu-central-api, hrmi-api legacy, Conicle, FCM, log-event, centralize REST auth) |
2way-vtrc-api | 2way-meeting-backoffice, meeting-backoffice, meeting-backoffice-new = 3 (ข้าม 2 platform group) | cu-central-api, LINE |
vtrc-common | benefit-api, vtrc-web, vtrc-rc-backoffice, vtrc-mobile = 4 | 0 |
meeting-vtrc-api | meeting-backoffice, meeting-backoffice-new = 2 | vtrc-api, cu-central-api |
cu-central-api และ vtrc-api ยังเป็นจุดศูนย์กลางของแพลตฟอร์มทั้งหมดแม้จะมี microservice ใหม่เกิดขึ้น 20+ ตัว — ถ้า cu-central-api ล่ม จะกระทบ 4 service โดยตรง (ตรงกับที่ vtrc-api/04-centralize-bridge ระบุว่าไม่มี circuit breaker/timeout ใดๆ)
2way-vtrc-api เป็นตัวอย่างที่ชัดว่า "ชื่อกลุ่ม" (2way Platform) ไม่ได้แปลว่า service ในกลุ่มอื่นจะไม่พึ่งพา — ทั้ง Meeting Platform (meeting-backoffice/meeting-backoffice-new) เรียกเข้ามาที่ 2way-vtrc-api โดยตรงสำหรับ endpoint ค้นหาพนักงาน (getUserByCondition) แทนที่จะมี shared employee-directory service กลาง