Project

General

Profile

Customer Database » History » Revision 5

Revision 4 (Ryan Supawarapong, 03/19/2026 02:44 AM) → Revision 5/9 (Ryan Supawarapong, 04/01/2026 01:21 AM)

# Customer Database 


 ``` 
 // 4 top layer 1 
 // Onboarding 
 // Customer 
 // Transaction: combine of customer and asset 
 // Digital Asset: asset_id 

 // Layer 2 
 // Fullname 
 // Customer info: link to transaction, onboarding 
 // customer suite test answer: answer 
 // suite test id: question and answer 

 // Layer 3 
 // suite test question and answer 
 // Knowledge test 


 // Layer 1 
 // ---------------------- 
 // Onboarding 
 Table onboarding appman { 
   id int 
   register_id uuid verification string 
   customer_info_id attribute_id int [ref: - customer_info.id] 
 } 

 Table appman_attribute { 
   idcard_id id int [ref: - idcard.id] 
   occupation_id int [ref: - occupation.id] 
   register_address_id int [ref : - address.id] 
   current_address_id int [ref : - address.id] 
   work_address_id int [ref : - address.id] 
   customer_suite_id int [ref: - customer_suite_submission.id] 
   cdd_id int [ref: - cdd.id] 
   bank_id int [ref: - bank.id] 
   secondary_bank_id int [ref: - bank.id] 
   source_of_fund_id int [ref: - source_of_fund.id] 
   thaid_id int [ref: - thaid.id] 
   ndid_id int [ref: - ndid.id] 
   approval_id int [ref: - approval.id] 
   appman_id int [ref: - appman.id] 
   risk_score_id int [ref: - risk_score.id] 
   has_done_knowledge_test bool 
   steps int 
 } 

 // Customer 
 Ref: appman_attribute.id - appman.attribute_id 

 Table customer identity { 
   id int uuid 
   customer_info_id customer_code int [ref: - customer_info.id] 
   risk_score_id fullname_id int [ref: - risk_score.id] 
   idcard_id current_address_id int [ref: - idcard.id] 
   occupation_id int [ref: - occupation.id] 
   register_address_id int [ref : - address.id] 
   current_address_id work_address_id int [ref : - address.id] 
   work_address_id suite_test_id int [ref : - address.id] 
   customer_suite_id occupation_id int [ref: - customer_suite_submission.id] 
   bank_id education_id int [ref: - bank.id] 
   secondary_bank_id workplace_id int [ref: - bank.id] 
   source_of_fund_id income_id int [ref: - source_of_fund.id] 

 } 

 // Transaction 
 Table transaction { 
   id uuid 
   seller_info_id customer_type int [ref: - customer_info.id] 
 } 

 // Digital Asset 
 Table digital_asset fullname { 
   id uuid 
   customer_info_id int [ref: - customer_info.id] 
   asset_detail_id int [ref: - asset_detail.id] 

 } 

 // ---------------------- 
 // Layer 2 
 // ---------------------- 
 Table customer_info { 
   id int 
   mobile th_first_name string 
   email th_middle_name string 
   title_id int [ref: - title.id] 
   first_name_th th_last_name string 
   middle_name_th en_first_name string 
   last_name_th en_middle_name string 
   first_name_en en_last_name string 
   middle_name_en string 
   last_name_en string 
   customer_type enum 
   ip_id int [ref: - ip_detail.id] 
 } 

 Table address { 
   id int 
   house_number string 
   floor string 
   village_building string 
   sub_street strign 
   street strign 
   country_code string 
   location_id    int 
 } 

 


 Table idcard location { 
   id int 
   citizen_id    string code int 
   laser_code zipcode string 
   date_of_birth timestamp 
   expire_date timestamp 
   issue_date timestamp 
 } 


 Ref: location.id < address.location_id 

 Table occupation { 
   id int 
   code string 
   position_name string 
   source_of_investment string 
   workplace_name string 
   education_id string [ref: Ref: fullname.id - education.id] 
   occupation_id int [ref: identity.fullname_id 
 Ref: address.id - occupation.id] 
   business_type_id int [ref: identity.current_address_id  
 Ref: address.id - business_type.id] 
   income_range_id int [ref: identity.register_address_id 
 Ref: address.id - income_range.id] 
  
 } identity.work_address_id 
 Ref: suitetest.id - identity.suite_test_id 
 Ref: education.id - identity.education_id 
 Ref: occupation.id - identity.occupation_id 
 Ref: workplace.id - identity.workplace_id 
 Ref: income.id - identity.income_id 

 Table customer_suite_answer suitetest { 
   id int 
   submission_id int [ref: > customer_suite_submission.id] 
   question_id int [ref: > suitability_question.id] 
   choice_id int [ref: > suitability_choice.id] 
 } 

 Table customer_suite_submission suitetest_question { 
   id int 
   customer_info_id int [ref: > customer_info.id] 
   total_score int 
   risk_level value string 
 } 


 Table cdd { 
   id int 
   mule string 
   freeze_04 string 
   freeze_05 string 
   pep bool 
   pep_message string 
   dopa bool 
 } 

 Table appman suitetest_answer { 
   id int 
   verification_id string 
   idcard_id suitetest_id int [ref: - appman_id_card.id] > suitetest.id] 
   liveness_id question_id int [ref: - appman_liveness.id] > suitetest_question.id] 
   liveness_attribute_id int [ref: - appman_liveness_attributes.id] 
   recognition int [ref: - appman_recognition.id] value stirng 
 } 

 


 Table bank occupation { // 
   id int 
   name code string 
   branch value string 
   account_no string 
 } 

 Table source_of_fund education { // 
   id int 
   source_of_fund code string 
   country_of_income value string 
   purpose_of_investment string 
 } 

 Table thaid income { 
   id int 
   url code string 
   state range string 
   thaid_detail_id int [ref: - thaid_detail.id] 
 } 

 Table ndid workplace { 
   id int 
   ndid_detail_id int [ref: - ndid_detail.id] 
 } 

 Table approval { 
   id int 
   by position string 
   name string 
   level int 
   message string 
   is_approve bool 
 } 

 Table risk_score { 
   id int 
   score int 
   risk_level int 
 } 

 Table asset_detail { 
   id int 
   name string 
   price float 
 } 

 // ---------------------- 
 // Layer 3 
 // ---------------------- 

 Table suitability_question verification { 
   id int uuid 
   question string 
 } 

 Table suitability_choice { 
   id email_id int  
   question_id int [ref: > suitability_question.id] 
   answer string 
   score mobile_id int 
 } 

 Table appman_id_card { 
   id appman_id int 
 } 

 Table appman_liveness { 
   id cdd_id int 
 } 

 Table appman_liveness_attributes { 
   id step int 
 } 

 Table appman_recognition mobile { 
   id int 
 } 

 Table education { 
   id int 
   code value string 
   name string 
 } 

 Table business_type email { 
   id int 
   name value string 
   risk_score int 
 } 

 Table income_range cdd { 
   id int 
   range face_compare_pass bool 
   mule string 
 } 

 Table thaid_detail { 
   id int 
 } 

 Table ndid_detail { 
   id int 
 } 

 Table ip_detail { 
   id int 
   ip_address freeze_04 string 
   country freeze_05 string 
 } 

 Table title { 
   id int pep bool 
   name_en pep_message string 
   name_th string dopa bool 
 } 

 // ---------------------- 




 Ref: mobile.id - verification.mobile_id 
 Ref: email.id - verification.email_id 
 Ref: appman.id - verification.appman_id 
 Ref: cdd.id - verification.cdd_id 

 ```