domain design - Ikki-Dai/immigrant GitHub Wiki

Note: view this page with mermaid browser plugin, such as markdown diagrams

classDiagram

subject<-- account_pool: N-1
subject_profile <-- subject: 1-1

subject<-- client_app: 1-N

customer --> account_pool: 1-N

class customer {
  int id
  String name
  int[] pool_ids
}

class subject {
  bigint uid
  String phone
  String email
  int status
  +signup_time
  +update_time
  register()
  update()
}
subject --> credentials: 1-N

class credentials {
  long uid
  String authStr
  String type
  String identifier
  String alias
  auth_by_password()
  auth_by_fido()
  auth_by_auth()
  auth_by_TFA()
}



class account_pool {
  int id
  int customer_id
  String pool_name
  String pool_desc
  String pool_logo
  String pub_key
  String prv_key
  token_ttl
  refresh_token_ttl
  renew_refresh_token
  list()
  create()
  update()
  delete()
}

class subject_profile {
  bigint uid
  String first_name
  String last_name
  String nickname
  String gender
  String birthday
  String avatar
  String country
  String province
  String city
  String address
  CRUD()
}

class client_app {
  String app_id
  String app_secret
  String app_type // web, apk, ios, h5
  String app_name
  String app_desc
  pool_id
  customer_id
  created_time
  CRUD()
}

pool_auth_registry --> account_pool: N-1

class pool_auth_registry {
  pool_id
  app_name
  app_home_url
  app_callback_url
  String client_id
  String client_secret
  int status;
  create_time
  int auth_type social/internal
  online()
  offline()
}

pool_auth_registry <-- auth_out_record: 1-N

class auth_out_record {
 bigint openid
 String client_id
 bigint subject_id
 int pool_id
 datetime auth_time
 String auth_token // need revoke
 String auth_code
 String scope;
 auth();
 revoke();
}

pool_auth_registry <-- auth_in_record: 1-N

class auth_in_record {
  varchar openid
  String client_id
  bigint subject_id
  int pool_id
  datetime auth_time
  String auth_token
  create();
  revoke();
}

class audit_log {
  bigint subject_id
  int event_type
  datetime opstime
  int geoip
  varchar device_id
  varchar device_os
  varchar device_web
  varchar device_model
  log();
  query(subject_id);
}

class security_setting {
  
}