create-entity-server 0.0.26 → 0.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/package.json +1 -1
  2. package/template/.env.example +26 -0
  3. package/template/configs/auth/cors.json +15 -0
  4. package/template/configs/auth/jwt.json +12 -0
  5. package/template/configs/{oauth.json → auth/oauth.json} +7 -4
  6. package/template/configs/auth/password.json +45 -0
  7. package/template/configs/{security.json → auth/security.json} +4 -2
  8. package/template/configs/cache.json +2 -1
  9. package/template/configs/keys/.gitkeep +0 -0
  10. package/template/configs/keys/apns.p8.example +7 -0
  11. package/template/configs/keys/firebase.pem.example +7 -0
  12. package/template/configs/server.json +1 -0
  13. package/template/entities/README.md +13 -16
  14. package/template/entities/System/Auth/account.json +172 -16
  15. package/template/entities/System/Auth/account_audit.json +31 -0
  16. package/template/entities/System/Auth/account_device.json +64 -0
  17. package/template/entities/System/Auth/account_login_log.json +69 -0
  18. package/template/entities/System/Auth/account_oauth.json +74 -0
  19. package/template/entities/System/Auth/api_keys.json +18 -9
  20. package/template/entities/System/Auth/identity_verification.json +106 -0
  21. package/template/entities/System/Auth/license.json +41 -20
  22. package/template/entities/System/Auth/password_history.json +19 -0
  23. package/template/entities/System/Auth/rbac_roles.json +10 -7
  24. package/template/entities/System/Backup/backup_log.json +66 -0
  25. package/template/entities/System/Email/smtp_log.json +87 -0
  26. package/template/entities/System/Email/smtp_msg.json +104 -0
  27. package/template/entities/System/Notification/alimtalk_log.json +65 -0
  28. package/template/entities/System/Notification/alimtalk_msg.json +53 -0
  29. package/template/entities/System/Notification/friendtalk_log.json +89 -0
  30. package/template/entities/System/Notification/friendtalk_msg.json +91 -0
  31. package/template/entities/System/Notification/sms_log.json +65 -0
  32. package/template/entities/System/Notification/sms_msg.json +82 -0
  33. package/template/entities/System/Notification/sms_verification.json +50 -0
  34. package/template/entities/System/Payment/pg_cancel.json +60 -0
  35. package/template/entities/System/Payment/pg_order.json +115 -0
  36. package/template/entities/System/Payment/pg_webhook_log.json +52 -0
  37. package/template/entities/System/Push/push_log.json +86 -0
  38. package/template/entities/System/Push/push_msg.json +56 -0
  39. package/template/entities/System/Storage/file_backup_log.json +51 -0
  40. package/template/entities/System/Storage/file_download_log.json +43 -0
  41. package/template/entities/System/Storage/file_meta.json +72 -0
  42. package/template/entities/System/system_audit_log.json +39 -34
  43. package/template/entities/company.json +5 -2
  44. package/template/entities/{product.json → goods.json} +9 -6
  45. package/template/entities/todo.json +4 -2
  46. package/template/samples/entities/01_basic_fields.json +15 -2
  47. package/template/samples/entities/02_types_and_defaults.json +15 -5
  48. package/template/samples/entities/03_hash_and_unique.json +18 -3
  49. package/template/samples/entities/04_fk_and_composite_unique.json +18 -3
  50. package/template/samples/entities/05_cache.json +15 -9
  51. package/template/samples/entities/06_history_and_hard_delete.json +19 -6
  52. package/template/samples/entities/07_license_scope.json +18 -3
  53. package/template/samples/entities/08_hook_sql.json +24 -5
  54. package/template/samples/entities/09_hook_entity.json +12 -2
  55. package/template/samples/entities/10_hook_submit_delete.json +14 -5
  56. package/template/samples/entities/11_hook_webhook.json +20 -6
  57. package/template/samples/entities/12_hook_push.json +15 -2
  58. package/template/samples/entities/13_read_only.json +8 -4
  59. package/template/samples/entities/14_optimistic_lock.json +13 -2
  60. package/template/samples/entities/15_reset_defaults.json +7 -1
  61. package/template/samples/entities/16_isolated_license.json +19 -6
  62. package/template/scripts/reset-all.sh +57 -3
  63. package/template/scripts/run.sh +56 -6
  64. package/template/templates/email/auth/2fa_disabled.html +23 -0
  65. package/template/templates/email/auth/2fa_recovery_regenerated.html +31 -0
  66. package/template/templates/email/auth/2fa_setup_complete.html +43 -0
  67. package/template/templates/email/auth/welcome.html +18 -0
  68. package/template/templates/email/backup/backup_completed.html +35 -0
  69. package/template/templates/email/backup/backup_failed.html +27 -0
  70. package/template/templates/email/backup/backup_partial.html +31 -0
  71. package/template/templates/email/layout.html +47 -0
  72. package/template/templates/email/order/order_confirmation.html +30 -0
  73. package/template/templates/email/storage/storage_quota_exceeded.html +37 -0
  74. package/template/templates/email/storage/storage_quota_warning.html +37 -0
  75. package/template/templates/ocr/business_reg.json +145 -0
  76. package/template/templates/ocr/career_cert.json +93 -0
  77. package/template/templates/ocr/driver_license.json +89 -0
  78. package/template/templates/ocr/facility_card.json +82 -0
  79. package/template/templates/ocr/id_card.json +55 -0
  80. package/template/templates/ocr/invoice.json +92 -0
  81. package/template/templates/ocr/namecard.json +116 -0
  82. package/template/templates/ocr/prompts/business_reg.json +14 -0
  83. package/template/templates/ocr/prompts/career_cert.json +16 -0
  84. package/template/templates/ocr/prompts/driver_license.json +14 -0
  85. package/template/templates/ocr/prompts/facility_card.json +15 -0
  86. package/template/templates/ocr/prompts/general.json +13 -0
  87. package/template/templates/ocr/prompts/id_card.json +11 -0
  88. package/template/templates/ocr/prompts/invoice.json +17 -0
  89. package/template/templates/ocr/prompts/namecard.json +15 -0
  90. package/template/templates/ocr/prompts/receipt.json +14 -0
  91. package/template/templates/ocr/receipt.json +79 -0
  92. package/template/configs/cors.json +0 -7
  93. package/template/configs/jwt.json +0 -8
  94. package/template/entities/Account/account_audit.json +0 -16
  95. /package/template/configs/{backup.json → extensions/backup.json} +0 -0
  96. /package/template/configs/{storage.json → extensions/storage.json} +0 -0
  97. /package/template/configs/{push.json → notification/push.json} +0 -0
  98. /package/template/configs/{smtp.json → notification/smtp.json} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-entity-server",
3
- "version": "0.0.26",
3
+ "version": "0.0.31",
4
4
  "description": "Create a new entity-server project in one command — like create-react-app or create-vite.",
5
5
  "keywords": [
6
6
  "entity-server",
@@ -41,3 +41,29 @@ DB_PASSWORD_PRODUCTION=your-production-db-password
41
41
 
42
42
  # 푸시 알림 (push.json에서 ${FCM_PROJECT_ID} 등으로 참조 가능)
43
43
  # FCM_PROJECT_ID=your-firebase-project-id
44
+
45
+ # OAuth 소셜 로그인 (configs/auth/oauth.json)
46
+ # OAUTH_STATE_SECRET=your-random-oauth-state-secret
47
+ # OAUTH_SUCCESS_REDIRECT_URL=https://your-frontend.example.com/auth/success
48
+ # OAUTH_FAILURE_REDIRECT_URL=https://your-frontend.example.com/auth/fail
49
+ # GOOGLE_CLIENT_ID=your-google-client-id
50
+ # GOOGLE_CLIENT_SECRET=your-google-client-secret
51
+ # GITHUB_CLIENT_ID=your-github-client-id
52
+ # GITHUB_CLIENT_SECRET=your-github-client-secret
53
+ # NAVER_CLIENT_ID=your-naver-client-id
54
+ # NAVER_CLIENT_SECRET=your-naver-client-secret
55
+ # KAKAO_CLIENT_ID=your-kakao-client-id
56
+ # KAKAO_CLIENT_SECRET=your-kakao-client-secret
57
+
58
+ # SMS (configs/notification/sms.json)
59
+ # SMS_SENDER_NUMBER=029302266
60
+ # ALIGO_USER_ID=your-aligo-user-id
61
+ # ALIGO_API_KEY=your-aligo-api-key
62
+ # AWS_SNS_ACCESS_KEY=your-aws-access-key
63
+ # AWS_SNS_SECRET_KEY=your-aws-secret-key
64
+ # AWS_SNS_REGION=ap-northeast-2
65
+
66
+ # 카카오 알림톡 (configs/notification/alimtalk.json)
67
+ # ALIMTALK_SENDER_KEY=your-kakao-sender-key
68
+ # ALIGO_USER_ID=your-aligo-user-id
69
+ # ALIGO_API_KEY=your-aligo-api-key
@@ -0,0 +1,15 @@
1
+ {
2
+ "_comment": "CORS 설정 예시. cors_allow_origins 는 프로덕션에서 반드시 구체적인 도메인으로 제한하세요.",
3
+ "cors_enabled": true,
4
+ "cors_allow_credentials": false,
5
+ "cors_allow_headers": "Origin,Content-Type,Accept,Authorization,X-API-Key,X-Signature,X-Timestamp,X-Nonce,X-Transaction-ID",
6
+ "cors_allow_methods": "GET,POST,PUT,PATCH,DELETE,OPTIONS",
7
+ "cors_allow_origins": "https://your-domain.com",
8
+
9
+ "environments": {
10
+ "development": {
11
+ "_comment": "개발 환경에서만 와일드카드 허용",
12
+ "cors_allow_origins": "*"
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "_comment": "JWT 설정 예시. secret 은 반드시 환경변수로 주입하세요. access_ttl_sec 은 보안 수준에 맞게 조정하세요.",
3
+ "enabled": true,
4
+ "secret": "${JWT_SECRET}",
5
+ "access_ttl_sec": 3600,
6
+ "refresh_ttl_sec": 1209600,
7
+ "issuer": "entity-server",
8
+ "algorithm": "HS256",
9
+
10
+ "_comment_algorithm": "지원 알고리즘: HS256 | HS384 | HS512 | RS256 | RS384 | RS512",
11
+ "_comment_ttl": "access_ttl_sec=3600(1시간), refresh_ttl_sec=1209600(14일) 기본값"
12
+ }
@@ -1,31 +1,34 @@
1
1
  {
2
2
  "_comment": "OAuth 2.0 설정 예시. 사용할 프로바이더만 남기고 실제 값으로 교체하세요.",
3
+ "enabled": false,
3
4
 
4
5
  "state_secret": "${OAUTH_STATE_SECRET}",
5
6
  "state_ttl_sec": 600,
7
+ "success_redirect_url": "/auth/callback",
8
+ "failure_redirect_url": "/auth/error",
6
9
 
7
10
  "providers": {
8
11
  "google": {
9
12
  "client_id": "${GOOGLE_CLIENT_ID}",
10
13
  "client_secret": "${GOOGLE_CLIENT_SECRET}",
11
- "redirect_url": "https://your-domain.com/v1/oauth/google/callback",
14
+ "redirect_url": "/v1/oauth/google/callback",
12
15
  "scopes": ["openid", "email", "profile"]
13
16
  },
14
17
  "github": {
15
18
  "client_id": "${GITHUB_CLIENT_ID}",
16
19
  "client_secret": "${GITHUB_CLIENT_SECRET}",
17
- "redirect_url": "https://your-domain.com/v1/oauth/github/callback"
20
+ "redirect_url": "/v1/oauth/github/callback"
18
21
  },
19
22
  "naver": {
20
23
  "client_id": "${NAVER_CLIENT_ID}",
21
24
  "client_secret": "${NAVER_CLIENT_SECRET}",
22
- "redirect_url": "https://your-domain.com/v1/oauth/naver/callback"
25
+ "redirect_url": "/v1/oauth/naver/callback"
23
26
  },
24
27
  "kakao": {
25
28
  "_comment": "Kakao — 커스텀 엔드포인트 예시",
26
29
  "client_id": "${KAKAO_CLIENT_ID}",
27
30
  "client_secret": "${KAKAO_CLIENT_SECRET}",
28
- "redirect_url": "https://your-domain.com/v1/oauth/kakao/callback",
31
+ "redirect_url": "/v1/oauth/kakao/callback",
29
32
  "auth_url": "https://kauth.kakao.com/oauth/authorize",
30
33
  "token_url": "https://kauth.kakao.com/oauth/token",
31
34
  "user_info_url": "https://kapi.kakao.com/v2/user/me",
@@ -0,0 +1,45 @@
1
+ {
2
+ "password_policy": {
3
+ "min_length": 8,
4
+ "max_length": 128,
5
+ "require_mixed_case": false,
6
+ "require_number": false,
7
+ "require_special": false,
8
+ "history_count": 5,
9
+ "forbidden_patterns": {
10
+ "sequential_digits": true,
11
+ "repeated_chars": true,
12
+ "keyboard_patterns": false,
13
+ "sequential_length": 4
14
+ },
15
+ "pii_check": {
16
+ "enabled": false,
17
+ "entity": "user",
18
+ "fields": ["phone", "birthday"]
19
+ }
20
+ },
21
+ "admin_force_reset": {
22
+ "temp_password_length": 12,
23
+ "require_change": true,
24
+ "notify_email": true
25
+ },
26
+ "password_reset": {
27
+ "enabled": true,
28
+ "temp_password_ttl_sec": 300,
29
+ "temp_password_length": 12,
30
+ "rate_limit": {
31
+ "per_email_per_hour": 5,
32
+ "per_ip_per_minute": 10
33
+ }
34
+ },
35
+ "email_verification": {
36
+ "enabled": true,
37
+ "required": false,
38
+ "code_length": 6,
39
+ "code_ttl_sec": 300,
40
+ "max_attempts": 5,
41
+ "rate_limit": {
42
+ "per_email_per_hour": 5
43
+ }
44
+ }
45
+ }
@@ -1,10 +1,12 @@
1
1
  {
2
- "enable_hmac": false,
2
+ "enable_hmac": true,
3
3
  "enable_rbac": true,
4
+ "enable_data_encryption": true,
4
5
  "enable_packet_encryption": false,
5
- "packet_magic_len": 4,
6
6
  "timestamp_skew_sec": 300,
7
7
  "nonce_ttl_sec": 300,
8
+ "auth_fail_limit_per_min": 120,
9
+ "auth_block_sec": 60,
8
10
  "nonce_store": {
9
11
  "driver": "redis",
10
12
  "memcache_servers": ["localhost:11211"],
@@ -16,7 +16,8 @@
16
16
  "addr": "127.0.0.1:6379",
17
17
  "password": "",
18
18
  "db": 0,
19
- "prefix": "entity_cache:"
19
+ "prefix": "entity_cache:",
20
+ "op_timeout_seconds": 2
20
21
  }
21
22
  }
22
23
  }
File without changes
@@ -0,0 +1,7 @@
1
+ -----BEGIN PRIVATE KEY-----
2
+ (샘플) Apple Developer Console → Certificates, Identifiers & Profiles
3
+ → Keys → "+" 버튼으로 APNs 키 생성 후 다운로드한 .p8 파일 내용을 여기에 붙여넣으세요.
4
+
5
+ 실제 키는 아래와 같은 형식입니다:
6
+ MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQg...
7
+ -----END PRIVATE KEY-----
@@ -0,0 +1,7 @@
1
+ -----BEGIN PRIVATE KEY-----
2
+ (샘플) Firebase Console → 프로젝트 설정 → 서비스 계정 → 새 비공개 키 생성
3
+ 으로 다운로드한 JSON 파일의 private_key 값을 여기에 붙여넣으세요.
4
+
5
+ 실제 키는 아래와 같은 형식입니다:
6
+ MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC...
7
+ -----END PRIVATE KEY-----
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "namespace": "entity-prod",
3
+ "public_url": "https://api.example.com",
3
4
  "default_email_domain": "example.com",
4
5
  "language": "ko",
5
6
  "timezone": "Asia/Seoul",
@@ -4,16 +4,15 @@
4
4
 
5
5
  ## 예제 엔티티 목록
6
6
 
7
- | 파일 | 설명 | 주요 특징 |
8
- | -------------------------------------------------------------------------- | -------------- | ------------------------------------------------------------------------- |
9
- | [todo.json](#1-todojson) | 할 일 목록 | 기본 인덱스, 해시 필드 |
10
- | [product.json](#2-productjson) | 제품 관리 | 유니크 제약, reset_defaults 시딩 |
11
- | [examples/Auth/account.json](#3-examplesauthaccountjson) | 사용자 관리 | rbac_role, 인증 훅 / **JWT 사용 시 필수** |
12
- | [examples/Auth/rbac_roles.json](#4-examplesauthrbac_rolesjson) | RBAC 역할 정의 | permissions 포함 5개 역할, reset-all 시 자동 시딩 / **RBAC 사용 시 필수** |
13
- | [examples/Auth/api_keys.json](#5-examplesauthauthapi_keysjson) | API 키 관리 | HMAC 인증 키, 역할 연결, user_seq 연결 / **HMAC 사용 시 필수** |
14
- | [license.json](#6-licensejson) | 라이선스 관리 | 계약/만료일, 유니크 제약, 자동 시딩 |
15
- | [company.json](#7-companyjson) | 회사 정보 | license_scope, 사업자번호 해시, 캐시 |
16
- | [examples/Account/account_audit.json](#8-examplesaccountaccount_auditjson) | 감사 로그 | INSERT 전용, 훅으로 자동 기록 |
7
+ | 파일 | 설명 | 주요 특징 |
8
+ | -------------------------------------------------------------- | -------------- | ------------------------------------------------------------------------- |
9
+ | [todo.json](#1-todojson) | 할 일 목록 | 기본 인덱스, 해시 필드 |
10
+ | [goods.json](#2-goodsjson) | 상품 관리 | 유니크 제약, reset_defaults 시딩 |
11
+ | [examples/Auth/account.json](#3-examplesauthaccountjson) | 사용자 관리 | rbac_role, 인증 훅 / **JWT 사용 시 필수** |
12
+ | [examples/Auth/rbac_roles.json](#4-examplesauthrbac_rolesjson) | RBAC 역할 정의 | permissions 포함 5개 역할, reset-all 시 자동 시딩 / **RBAC 사용 시 필수** |
13
+ | [examples/Auth/api_keys.json](#5-examplesauthauthapi_keysjson) | API 키 관리 | HMAC 인증 키, 역할 연결, user_seq 연결 / **HMAC 사용 시 필수** |
14
+ | [license.json](#6-licensejson) | 라이선스 관리 | 계약/만료일, 유니크 제약, 자동 시딩 |
15
+ | [company.json](#7-companyjson) | 회사 정보 | license_scope, 사업자번호 해시, 캐시 |
17
16
 
18
17
  ## 문서 바로가기
19
18
 
@@ -38,7 +37,7 @@
38
37
  - 기본 인덱스 필드 (`title`, `status`, `created_time`)
39
38
  - 해시 필드 (`user_id`) - 암호화되어 저장
40
39
 
41
- ### 2. product.json
40
+ ### 2. goods.json
42
41
 
43
42
  제품 관리 엔티티
44
43
 
@@ -50,7 +49,7 @@
50
49
 
51
50
  ### 3. examples/Auth/account.json
52
51
 
53
- 사용자 관리 엔티티 (`entities/examples/Auth/` 에 위치 → 배포 시 `dist/entities/System/Auth/account.json`)
52
+ 사용자 관리 엔티티 (`entities-example/Auth/` 에 위치 → 배포 시 `dist/entities/System/Auth/account.json`)
54
53
 
55
54
  > **⚠️ JWT 인증을 사용하려면 필수입니다.**
56
55
  > HMAC 인증만 사용하는 경우에는 필요하지 않습니다.
@@ -68,7 +67,7 @@
68
67
 
69
68
  ### 4. examples/Auth/rbac_roles.json
70
69
 
71
- RBAC 역할 정의 엔티티 (`entities/examples/Auth/` 에 위치 → 배포 시 `dist/entities/System/Auth/rbac_roles.json`)
70
+ RBAC 역할 정의 엔티티 (`entities-example/Auth/` 에 위치 → 배포 시 `dist/entities/System/Auth/rbac_roles.json`)
72
71
 
73
72
  > **⚠️ RBAC 인증을 사용하려면 필수입니다.**
74
73
  > `reset-all` 실행 시 `reset_defaults`의 5개 역할이 자동 시딩됩니다.
@@ -84,7 +83,7 @@ RBAC 역할 정의 엔티티 (`entities/examples/Auth/` 에 위치 → 배포
84
83
 
85
84
  ### 5. examples/Auth/api_keys.json
86
85
 
87
- API 키 관리 엔티티 (`entities/examples/Auth/` 에 위치 → 배포 시 `dist/entities/System/Auth/api_keys.json`)
86
+ API 키 관리 엔티티 (`entities-example/Auth/` 에 위치 → 배포 시 `dist/entities/System/Auth/api_keys.json`)
88
87
 
89
88
  > **⚠️ HMAC 인증을 사용하려면 필수입니다.**
90
89
  > `reset-all` 실행 시 admin 역할의 API 키 1개가 자동 생성되며 `key_value`와 `hmac_secret`이 출력됩니다.
@@ -130,8 +129,6 @@ API_KEY=<admin-key> ./scripts/api-keys.sh delete 3
130
129
  - 해시 필드 (`tax_id`) - 사업자번호 암호화
131
130
  - 캐시 활성화 (TTL 300초)
132
131
 
133
- ### 8. examples/Account/account_audit.json
134
-
135
132
  사용자 감사 로그 엔티티
136
133
 
137
134
  **특징**:
@@ -1,36 +1,125 @@
1
1
  {
2
2
  "name": "account",
3
- "description": "JWT 로그인/인증 계정 예제",
4
- "index": {
5
- "user_seq": {
6
- "comment": "사용자번호"
7
- },
3
+ "description": "JWT 로그인/인증용 계정 정보. 사용자 환경에 맞게 fields를 자유롭게 확장할 수 있습니다.",
4
+ "fields": {
8
5
  "email": {
6
+ "index": true,
7
+ "hash": true,
9
8
  "comment": "이메일",
10
9
  "type": "email",
11
10
  "required": true,
12
11
  "unique": true
13
12
  },
14
- "status": {
15
- "comment": "상태",
16
- "type": ["active", "inactive", "blocked"],
17
- "default": "active"
18
- },
19
13
  "rbac_role": {
20
- "comment": "RBAC 역할 (JWT 인증/인가에 사용)",
14
+ "index": true,
15
+ "comment": "엔티티 접근 역할",
21
16
  "type": ["admin", "editor", "viewer", "auditor", "user"],
22
17
  "default": "user"
18
+ },
19
+ "status": {
20
+ "index": true,
21
+ "comment": "계정 상태",
22
+ "type": ["active", "inactive", "blocked", "dormant"],
23
+ "default": "active"
24
+ },
25
+ "user_seq": {
26
+ "index": true,
27
+ "comment": "사용자번호"
28
+ },
29
+ "max_session_cnt": {
30
+ "type": "uint"
31
+ },
32
+ "has_password": {
33
+ "type": "bool",
34
+ "comment": "비밀번호 설정 여부 (소셜 전용 계정 구분)"
35
+ },
36
+ "last_login_time": {
37
+ "comment": "마지막 로그인 시각 (휴면 판단 기준)"
38
+ },
39
+ "passwd_changed_time": {
40
+ "comment": "마지막 비밀번호 변경 시각 (만료 정책 기준)"
41
+ },
42
+ "temp_password_hash": {
43
+ "type": "varchar(128)",
44
+ "comment": "임시 비밀번호 해시 (비밀번호 초기화 요청 시 발급)"
45
+ },
46
+ "temp_password_issued_time": {
47
+ "comment": "임시 비밀번호 발급 시각"
48
+ },
49
+ "force_password_change": {
50
+ "type": "bool",
51
+ "default": false,
52
+ "comment": "다음 로그인 시 비밀번호 변경 강제"
53
+ },
54
+ "name": {
55
+ "no_store": true,
56
+ "comment": "가입 요청 시 전달되는 이름. account에는 저장되지 않고 after_insert 훅(user 엔티티 생성 등)에서만 사용됩니다."
57
+ },
58
+ "phone": {
59
+ "no_store": true,
60
+ "comment": "가입 요청 시 전달되는 전화번호. no_store."
61
+ },
62
+ "birth_date": {
63
+ "no_store": true,
64
+ "comment": "가입 요청 시 전달되는 생년월일. no_store."
65
+ },
66
+ "gender": {
67
+ "no_store": true,
68
+ "comment": "가입 요청 시 전달되는 성별. no_store."
69
+ },
70
+ "profile_image": {
71
+ "no_store": true,
72
+ "comment": "가입 요청 시 전달되는 프로필 이미지. no_store."
23
73
  }
24
74
  },
25
- "fk": {
26
- "user_seq": "user.seq"
27
- },
28
75
  "reset_defaults": [
29
76
  {
30
- "email": "admin@example.com",
77
+ "email": "admin1@${DEFAULT_EMAIL_DOMAIN}",
78
+ "passwd": "admin12345",
79
+ "rbac_role": "admin",
80
+ "status": "active"
81
+ },
82
+ {
83
+ "email": "admin2@${DEFAULT_EMAIL_DOMAIN}",
31
84
  "passwd": "admin12345",
32
85
  "rbac_role": "admin",
33
86
  "status": "active"
87
+ },
88
+ {
89
+ "email": "admin3@${DEFAULT_EMAIL_DOMAIN}",
90
+ "passwd": "admin12345",
91
+ "rbac_role": "admin",
92
+ "status": "active"
93
+ },
94
+ {
95
+ "email": "test1@${DEFAULT_EMAIL_DOMAIN}",
96
+ "passwd": "test12345",
97
+ "rbac_role": "user",
98
+ "status": "active"
99
+ },
100
+ {
101
+ "email": "test2@${DEFAULT_EMAIL_DOMAIN}",
102
+ "passwd": "test12345",
103
+ "rbac_role": "user",
104
+ "status": "active"
105
+ },
106
+ {
107
+ "email": "test3@${DEFAULT_EMAIL_DOMAIN}",
108
+ "passwd": "test12345",
109
+ "rbac_role": "user",
110
+ "status": "active"
111
+ },
112
+ {
113
+ "email": "test4@${DEFAULT_EMAIL_DOMAIN}",
114
+ "passwd": "test12345",
115
+ "rbac_role": "user",
116
+ "status": "active"
117
+ },
118
+ {
119
+ "email": "test5@${DEFAULT_EMAIL_DOMAIN}",
120
+ "passwd": "test12345",
121
+ "rbac_role": "user",
122
+ "status": "active"
34
123
  }
35
124
  ],
36
125
  "hooks": {
@@ -39,7 +128,74 @@
39
128
  "type": "sql",
40
129
  "query": "INSERT INTO account_audit (account_seq, action, email, created_time) VALUES (?, ?, ?, NOW())",
41
130
  "params": ["${new.seq}", "INSERT", "${new.email}"],
42
- "async": false
131
+ "required": true
132
+ },
133
+ {
134
+ "_comment": "가입 시 user 엔티티 자동 생성. enabled: true로 바꾸면 활성화됩니다. assign_seq_to로 account.user_seq에 자동 반영됩니다.",
135
+ "type": "submit",
136
+ "enabled": false,
137
+ "entity": "user",
138
+ "data": {
139
+ "account_seq": "${new.seq}",
140
+ "name": "${new.name}",
141
+ "phone": "${new.phone}",
142
+ "birth_date": "${new.birth_date}",
143
+ "gender": "${new.gender}",
144
+ "profile_image": "${new.profile_image}"
145
+ },
146
+ "assign_seq_to": "user_seq"
147
+ }
148
+ ],
149
+ "after_update": [
150
+ {
151
+ "type": "sql",
152
+ "query": "INSERT INTO account_audit (account_seq, action, email, created_time) VALUES (?, ?, ?, NOW())",
153
+ "params": ["${new.seq}", "UPDATE", "${new.email}"],
154
+ "required": true
155
+ },
156
+ {
157
+ "_comment": "계정 업데이트 시 user 프로필 동기화. enabled: true로 바꾸면 활성화됩니다.",
158
+ "type": "submit",
159
+ "enabled": false,
160
+ "entity": "user",
161
+ "match": {
162
+ "account_seq": "${new.seq}"
163
+ },
164
+ "data": {
165
+ "name": "${new.name}",
166
+ "phone": "${new.phone}",
167
+ "birth_date": "${new.birth_date}",
168
+ "gender": "${new.gender}",
169
+ "profile_image": "${new.profile_image}"
170
+ }
171
+ }
172
+ ],
173
+ "after_delete": [
174
+ {
175
+ "type": "sql",
176
+ "query": "INSERT INTO account_audit (account_seq, action, email, created_time) VALUES (?, ?, ?, NOW())",
177
+ "params": ["${old.seq}", "DELETE", "${old.email}"],
178
+ "required": true
179
+ }
180
+ ],
181
+ "after_get": [
182
+ {
183
+ "type": "entity",
184
+ "entity": "user",
185
+ "action": "find",
186
+ "conditions": {
187
+ "seq": "${new.user_seq}"
188
+ },
189
+ "assign_to": "user_profile"
190
+ },
191
+ {
192
+ "type": "entity",
193
+ "entity": "account_device",
194
+ "action": "list",
195
+ "conditions": {
196
+ "account_seq": "${new.seq}"
197
+ },
198
+ "assign_to": "devices"
43
199
  }
44
200
  ]
45
201
  }
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "account_audit",
3
+ "description": "account 감사 로그. account.json 훅(after_insert/after_update/after_delete)에 의해 자동 기록됩니다. 사용자 환경에 맞게 fields를 자유롭게 확장할 수 있습니다.",
4
+ "hard_delete": true,
5
+ "read_only": true,
6
+ "compress": true,
7
+ "fields": {
8
+ "account_seq": {
9
+ "index": true,
10
+ "comment": "계정 seq (JWT 인증 시 account.seq 참조. HMAC은 nullable)",
11
+ "type": "bigint",
12
+ "nullable": true
13
+ },
14
+ "action": {
15
+ "index": true,
16
+ "comment": "작업 유형 (after_insert → INSERT, after_update → UPDATE, after_delete → DELETE)",
17
+ "type": [
18
+ "INSERT",
19
+ "UPDATE",
20
+ "DELETE"
21
+ ],
22
+ "required": true
23
+ },
24
+ "email": {
25
+ "index": true,
26
+ "hash": true,
27
+ "comment": "작업 대상 계정 이메일",
28
+ "nullable": true
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "account_device",
3
+ "description": "계정 기기 정보 및 푸시 토큰 관리. JWT 인증 시 account_seq로 계정과 연결. 사용자 환경에 맞게 fields를 자유롭게 확장할 수 있습니다.",
4
+ "license_scope": false,
5
+ "fields": {
6
+ "account_seq": {
7
+ "index": true,
8
+ "comment": "계정seq (JWT 인증 시 필수. HMAC 인증은 nullable)"
9
+ },
10
+ "id": {
11
+ "index": true,
12
+ "comment": "기기ID"
13
+ },
14
+ "push_enabled": {
15
+ "index": true,
16
+ "comment": "푸시 수신 허용",
17
+ "type": "bool",
18
+ "default": true
19
+ },
20
+ "device_type": {
21
+ "comment": "기기유형",
22
+ "type": [
23
+ "mobile",
24
+ "tablet",
25
+ "desktop",
26
+ "watch"
27
+ ],
28
+ "default": "mobile"
29
+ },
30
+ "platform": {
31
+ "comment": "플랫폼",
32
+ "type": [
33
+ "android",
34
+ "ios",
35
+ "web",
36
+ "windows",
37
+ "macos",
38
+ "linux"
39
+ ]
40
+ },
41
+ "browser": {
42
+ "comment": "브라우저"
43
+ },
44
+ "browser_version": {
45
+ "comment": "브라우저버전"
46
+ },
47
+ "push_token": {
48
+ "comment": "푸시 디바이스 토큰",
49
+ "nullable": true
50
+ },
51
+ "last_login_time": {
52
+ "comment": "마지막로그인시각"
53
+ },
54
+ "last_ip_addr": {
55
+ "comment": "마지막IP주소"
56
+ }
57
+ },
58
+ "unique": [
59
+ [
60
+ "id",
61
+ "account_seq"
62
+ ]
63
+ ]
64
+ }
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "account_login_log",
3
+ "description": "account_login_log 엔티티. 사용자 환경에 맞게 fields를 자유롭게 확장할 수 있습니다.",
4
+ "compress": true,
5
+ "fields": {
6
+ "browser": {
7
+ "index": true,
8
+ "comment": "브라우저"
9
+ },
10
+ "country_code": {
11
+ "index": true,
12
+ "comment": "국가코드 iso2"
13
+ },
14
+ "device_id": {
15
+ "index": true,
16
+ "comment": "디바이스 ID",
17
+ "type": "string"
18
+ },
19
+ "device_type": {
20
+ "index": true,
21
+ "comment": "장치종류"
22
+ },
23
+ "domain": {
24
+ "index": true,
25
+ "comment": "도메인"
26
+ },
27
+ "email": {
28
+ "index": true,
29
+ "hash": true,
30
+ "comment": "로그인 이메일"
31
+ },
32
+ "ip_address": {
33
+ "index": true,
34
+ "hash": true,
35
+ "comment": "접속아이피"
36
+ },
37
+ "is_success": {
38
+ "index": true,
39
+ "comment": "성공여부"
40
+ },
41
+ "language": {
42
+ "comment": "언어"
43
+ },
44
+ "user_seq": {
45
+ "index": true,
46
+ "comment": "사용자번호"
47
+ },
48
+ "auth_method": {
49
+ "index": true,
50
+ "comment": "인증 방식",
51
+ "type": [
52
+ "password",
53
+ "oauth",
54
+ "2fa_totp",
55
+ "2fa_recovery"
56
+ ],
57
+ "default": "password"
58
+ },
59
+ "location_info": {
60
+ "comment": "위치"
61
+ },
62
+ "passwd": {
63
+ "comment": "로그인 비밀번호"
64
+ },
65
+ "user_agent": {
66
+ "comment": "User Agent"
67
+ }
68
+ }
69
+ }