Skip to content

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 จากโค้ด)

#CallerCalleeProtocolใช้ทำอะไรหลักฐาน
1vtrc-webvtrc-apiGraphQLทุกฟีเจอร์ฝั่งพนักงานCanonical Truths
2vtrc-rc-backofficevtrc-apiGraphQLทุกฟีเจอร์ฝั่งเจ้าหน้าที่Canonical Truths
3vtrc-backoffice / vtrc-backoffice-newvtrc-apiGraphQLทุกฟีเจอร์ back officeCanonical Truths
4vtrc-mobile / new-vtrc-mobilevtrc-apiGraphQLทุกฟีเจอร์บนมือถือCanonical Truths
5vtrc-webvtrc-commonRESTaddress/bank dropdown, file uploadvtrc-common/02-core-pipeline
6vtrc-rc-backofficevtrc-commonRESTเดียวกับข้างบนvtrc-common/02-core-pipeline
7vtrc-mobilevtrc-commonRESTfile uploadvtrc-common/02-core-pipeline
8vtrc-apicu-central-apiGraphQL (END_POINT_CENTRALIZE)HR data ทั้งหมด (profile, slip, leave, withdraw, fund, time attendance)vtrc-api/04-centralize-bridge
9vtrc-apicu-central-apiREST auth (END_POINT_CENTRALIZE_AUTH)signin/signinbypass/signout/token refreshvtrc-api/04-centralize-bridge
10vtrc-apihrmi-api.redcross.or.th (legacy REST)REST, TLS offside channel ขนาน กับ cu-central-apivtrc-api/04-centralize-bridge
11vtrc-apiConicle LMSREST + cookie SSOSSO เข้าระบบ e-learning ภายนอกvtrc-api/04-centralize-bridge
12vtrc-apiFirebase Cloud MessagingREST (legacy HTTP v1, deprecated)push notificationvtrc-api/04-centralize-bridge
132way-apicentralize-api (NestJS REST)RESTEmployeesService — organize/division/department/manager/position/group/getByEmpCode/bankAccount2way-api/03-persistence-integrations
142way-apicu-central-apiGraphQL (CENTRALIZE_API_URL)fetchListEmployeeForTwoWay — employee directory2way-api/03-persistence-integrations
152way-api2way-line-serviceREST, hardcoded IP 20.212.116.206:8200nextPageLine/previousPageLine — สลับ rich menu LINE2way-api/03-persistence-integrations
162way-vtrc-apicu-central-apiGraphQL, hardcoded centralizeapi.redcross.or.th:25563fetchListEmployeeForTwoWay (URL คนละตัวจาก #14 แต่ query เดียวกัน)2way-vtrc-api/03-persistence-integrations
172way-meeting-backoffice2way-vtrc-apiREST (appConnectChatAPI/2way/...)backend หลักของทุกหน้าฝั่งพนักงาน (Announce/Survey/Complaint/Incident/Register/FAQ)2way-meeting-backoffice/03-persistence-integrations
182way-meeting-backoffice2way-apiREST (appConnectAPI)survey list/types, announce list แอดมิน, auth login/verifyToken2way-api/index
192way-meeting-backofficechat-center-apiREST + WebSocket (Socket.IO)ChatCenter widget, chatRoomHistory, appointment2way-meeting-backoffice/03-persistence-integrations
20meeting-vtrc-apivtrc-apiGraphQL (vtrcConnector)verify token (fetchEmployeeProfileForOtherService), push notification (sendNotificationFrom3Party)meeting-vtrc-api/03-persistence-integrations
21meeting-vtrc-apicu-central-apiGraphQL (cdbConnector)fetchListEmployeeForTwoWay — แปลง empCode เป็นชื่อผู้เข้าร่วมประชุมmeeting-vtrc-api/03-persistence-integrations
22meeting-backofficemeeting-vtrc-apiREST (NEXT_PUBLIC_APP_MEETING_API)CRUD กลุ่มผู้ใช้/ผู้อนุมัติ, ค้นหา orgmeeting-backoffice/03-persistence-integrations
23meeting-backoffice2way-vtrc-apiREST (NEXT_PUBLIC_APP_2WAY_API/2way)POST /getUserByCondition — ค้นหาพนักงานเพิ่มเข้ากลุ่ม (ข้ามไป 2way Platform group)meeting-backoffice/03-persistence-integrations
24meeting-backoffice-newmeeting-vtrc-apiREST (REACT_APP_MEETING_API)เดียวกับ #22meeting-backoffice-new/03-persistence-integrations
25meeting-backoffice-new2way-vtrc-apiREST (REACT_APP_2WAY_API)เดียวกับ #23meeting-backoffice-new/03-persistence-integrations
26benefit-apivtrc-apiHTTP (VTRC_SERVER)listTermFeeForApprover, cancelStudyEducationbenefit-api/04-auth-integrations
27benefit-apivtrc-commonRESTfile/save, file/delete, file/getFileArray (เก็บไฟล์แนบเบิกเงิน)vtrc-common/02-core-pipeline, benefit-api/04-auth-integrations
28benefit-apicentralize server พอร์ต 3100 (identity ไม่ยืนยัน 100%)RESTgetEmployeeDisaster, getByEmpCode, bankAccountbenefit-api/04-auth-integrations
29recruitment-webrecruitment-apiRESTOTP login, สร้าง/แก้ไขใบสมัครงาน, สมัครตำแหน่งrecruitment-web/02-core-pipeline
30recruitment-apiworkforce-api (identity ไม่ยืนยัน 100%)HTTP (WORKFORCE_SERVER)ข้อมูลพนักงาน/manpower สำหรับสัญญาจ้างrecruitment-api/04-auth-integrations
31job-scheduler-apiincident-management-api (repo ไม่อยู่ใน workspace)REST (cron รายวัน)POST /incident-management-api/crontab/summaryjob-scheduler-api/03-persistence-integrations
322way-meeting-backofficeincident-management-api (repo เดียวกับ #31)RESTmaster/list/003, incidents/list/empCode/{empCode}, incidents/{id}2way-meeting-backoffice/03-persistence-integrations
33pms-apipms-ai-api (โดเมนภายนอก vtrcsupport.com)RESTvector-embedding สำหรับ course recommendationpms-api/04-auth-integrations
34workflow-apiAI Router (AI_ROUTER_BASE_URL, ManageAI)RESTchat completion + embedding สำหรับ course embeddingworkflow-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-apischema vtrc ของ vtrc-api (raw SQL, cancel/update WDHospitals)benefit-api/04-auth-integrations
workflow-apischema vtrc (vtrc-api), benefit/benefit_write (benefit-api), dbHRMI_Center/dbHRMI_Center_NBCworkflow-api/03-persistence-integrations
pms-apidbWorkforce, dbWorkforce_temppms-api/index
chat-center-apidbHRMI_Center.dbo.temp_pee_na_table (cross-database query)chat-center-api/03-persistence-integrations
sso-apidbHRMI_Center.dbo.temp_pee_na_table, dbHRMI_Center.dbo.emPersonsso-api/03-persistence-integrations
2way-apischema pms (pms.dbo.tbnotify) ข้าม schema จาก [2way].dbo.userline2way-api/03-persistence-integrations
ai-recruitment-api / recruitment-apidatabase recruitment_ai ใช้ร่วมกัน 100%ai-recruitment-api/index

13.3.5 · Third-party SaaS ที่ไม่ใช่ repo ภายใน

Service ที่เรียกปลายทางCaller (repo ในแพลตฟอร์ม)
LINE Messaging APIapi.line.mevtrc-api, 2way-api, 2way-vtrc-api, chat-center-api
OpenAI (Chat + Images)api.openai.comai-recruitment-api
remove.bgapi.remove.bgai-recruitment-api
HCTIhcti.ioai-recruitment-api (ประกาศ env, ไม่พบจุดเรียกที่ยืนยันได้)
qrserver.comapi.qrserver.comai-recruitment-api
SMTP (Outlook)smtp-mail.outlook.comrecruitment-api, pms-api, meeting-vtrc-api, vtrc-api
SFTP (FMIS)10.188.128.22:22benefit-api
SSO ภายนอกSSO_END_POINT (โดเมนไม่ยืนยัน)sso-api, 2way-api
Conicle LMScookie SSOvtrc-api
Firebase Cloud Messaginglegacy HTTP v1vtrc-api
Sentryerror tracking SaaS2way-vtrc-api, meeting-vtrc-api, meeting-backoffice, 2way-meeting-backoffice
AI Router (ManageAI)LLM ภายนอกworkflow-api
Google reCAPTCHAgoogle.com/recaptcharecruitment-api (ประกาศ env, จุดเรียกไม่ยืนยัน), recruitment-web

13.3.6 · Hub service ที่มี fan-in/fan-out สูงสุด

ServiceFan-in (จำนวน caller ที่ยืนยัน)Fan-out (จำนวน callee ที่ยืนยัน)
cu-central-api4 (vtrc-api, 2way-api, 2way-vtrc-api, meeting-vtrc-api)0 (ปลายทางคือ database/LDAP ไม่ใช่ network call ไป repo อื่น)
vtrc-api6 frontend + benefit-api + 2way-api (dead code) + meeting-vtrc-api = 96 (cu-central-api, hrmi-api legacy, Conicle, FCM, log-event, centralize REST auth)
2way-vtrc-api2way-meeting-backoffice, meeting-backoffice, meeting-backoffice-new = 3 (ข้าม 2 platform group)cu-central-api, LINE
vtrc-commonbenefit-api, vtrc-web, vtrc-rc-backoffice, vtrc-mobile = 40
meeting-vtrc-apimeeting-backoffice, meeting-backoffice-new = 2vtrc-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 กลาง