mega-framework 0.1.6 → 0.1.7
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.
- package/bin/mega-ws-hub.js +2 -2
- package/package.json +32 -8
- package/sample/crud/.env +1 -1
- package/sample/crud/.env.example +1 -1
- package/sample/crud/.mega/journal/history/20260612092543-create-users.json +261 -0
- package/sample/crud/.mega/journal/snapshot.json +261 -0
- package/sample/crud/apps/main/controllers/auth-controller.js +22 -14
- package/sample/crud/apps/main/controllers/web-controller.js +7 -5
- package/sample/crud/apps/main/migrations/20260606000001-create-users.js +91 -13
- package/sample/crud/apps/main/migrations/20260606000002-create-boards.js +165 -0
- package/sample/crud/apps/main/migrations/20260606000003-create-logs.js +107 -0
- package/sample/crud/apps/main/models/log-partition-model.js +105 -0
- package/sample/crud/apps/main/models/note-model.js +79 -0
- package/sample/crud/apps/main/models/user-level-model.js +24 -0
- package/sample/crud/apps/main/models/user-model.js +146 -0
- package/sample/crud/apps/main/models/user-type-model.js +21 -0
- package/sample/crud/apps/main/models/wallet-model.js +24 -0
- package/sample/crud/apps/main/routes/users.js +55 -10
- package/sample/crud/apps/main/schedules/log-partition-schedule.js +33 -0
- package/sample/crud/apps/main/services/auth-service.js +39 -24
- package/sample/crud/apps/main/services/log-partition-service.js +101 -0
- package/sample/crud/apps/main/services/note-service.js +6 -6
- package/sample/crud/apps/main/services/redis-demo-service.js +3 -3
- package/sample/crud/apps/main/services/user-service.js +62 -21
- package/sample/crud/apps/main/views/auth/login.ejs +6 -6
- package/sample/crud/apps/main/views/auth/register.ejs +46 -5
- package/sample/crud/apps/main/views/users/edit.ejs +42 -5
- package/sample/crud/apps/main/views/users/list.ejs +6 -2
- package/sample/crud/apps/main/views/users/new.ejs +56 -4
- package/sample/crud/docs/log_partition_design.mm.md +23 -0
- package/sample/crud/mega.config.js +3 -2
- package/sample/crud/package.json +1 -1
- package/sample/crud/scripts/start-ws-hub.sh +2 -2
- package/sample/simple/package.json +2 -2
- package/src/adapters/adapter-manager.js +2 -1
- package/src/adapters/adapter-options.js +30 -0
- package/src/adapters/maria-adapter.js +26 -3
- package/src/adapters/mega-db-adapter.js +7 -1
- package/src/adapters/mongo-adapter.js +19 -1
- package/src/adapters/postgres-adapter.js +25 -2
- package/src/adapters/sqlite-adapter.js +20 -1
- package/src/cli/commands/new.js +13 -3
- package/src/cli/commands/scaffold.js +137 -33
- package/src/cli/generators/index.js +82 -2
- package/src/cli/index.js +353 -100
- package/src/core/ajv-mapper.js +27 -2
- package/src/core/boot.js +464 -245
- package/src/core/cluster-metrics.js +13 -4
- package/src/core/ctx-builder.js +6 -2
- package/src/core/envelope.js +112 -12
- package/src/core/hub-link.js +65 -4
- package/src/core/i18n.js +11 -1
- package/src/core/index.js +6 -2
- package/src/core/mega-app.js +201 -463
- package/src/core/mega-cluster.js +4 -1
- package/src/core/mega-server.js +40 -9
- package/src/core/migration/dialect-registry.js +107 -0
- package/src/core/migration/dialects/README.md +62 -0
- package/src/core/migration/dialects/maria.js +496 -0
- package/src/core/migration/dialects/mongo.js +824 -0
- package/src/core/migration/dialects/postgres.js +563 -0
- package/src/core/migration/dialects/sqlite.js +476 -0
- package/src/core/migration/differ.js +456 -0
- package/src/core/migration/generate.js +508 -0
- package/src/core/migration/journal.js +167 -0
- package/src/core/migration/model-scan.js +84 -0
- package/src/core/migration/mongo-migration-db.js +97 -0
- package/src/core/migration/schema-builder.js +400 -0
- package/src/core/migration/schema-validator.js +315 -0
- package/src/core/migration-lock.js +205 -0
- package/src/core/migration-runner.js +166 -38
- package/src/core/multipart.js +28 -5
- package/src/core/pipeline.js +129 -0
- package/src/core/router.js +70 -65
- package/src/core/security.js +67 -9
- package/src/core/workers-manager.js +12 -1
- package/src/core/ws-cluster.js +10 -3
- package/src/core/ws-message.js +48 -4
- package/src/core/ws-presence.js +624 -0
- package/src/core/ws-roster.js +4 -1
- package/src/core/ws-upgrade.js +118 -12
- package/src/index.js +1 -1
- package/src/lib/hub-protocol.js +29 -0
- package/src/lib/mega-health.js +25 -4
- package/src/lib/mega-job-queue.js +98 -21
- package/src/lib/mega-job.js +29 -0
- package/src/lib/mega-metrics.js +3 -12
- package/src/lib/mega-plugin.js +34 -3
- package/src/lib/mega-schedule.js +40 -22
- package/src/lib/mega-shutdown.js +114 -39
- package/src/lib/mega-tracing.js +66 -19
- package/src/lib/mega-worker.js +5 -1
- package/src/lib/otel-resource.js +36 -0
- package/src/{cli → lib}/ws-hub.js +51 -8
- package/src/models/crud-sql-builder.js +133 -0
- package/src/models/mega-model.js +82 -2
- package/src/models/model-crud.js +483 -0
- package/src/models/mongo-crud.js +285 -0
- package/templates/model/code-mongo.tpl +35 -0
- package/templates/model/code.tpl +15 -1
- package/templates/model/test-mongo.tpl +38 -0
- package/templates/model/test.tpl +4 -0
- package/types/adapters/adapter-manager.d.ts +95 -0
- package/types/adapters/adapter-options.d.ts +91 -0
- package/types/adapters/file-adapter.d.ts +94 -0
- package/types/adapters/file-session-adapter.d.ts +101 -0
- package/types/adapters/index.d.ts +20 -0
- package/types/adapters/maria-adapter.d.ts +115 -0
- package/types/adapters/mega-adapter.d.ts +215 -0
- package/types/adapters/mega-bus-adapter.d.ts +45 -0
- package/types/adapters/mega-cache-adapter.d.ts +47 -0
- package/types/adapters/mega-db-adapter.d.ts +47 -0
- package/types/adapters/mega-lock-adapter.d.ts +62 -0
- package/types/adapters/mega-log-sink-adapter.d.ts +15 -0
- package/types/adapters/mega-session-adapter.d.ts +32 -0
- package/types/adapters/mongo-adapter.d.ts +139 -0
- package/types/adapters/nats-adapter.d.ts +108 -0
- package/types/adapters/postgres-adapter.d.ts +139 -0
- package/types/adapters/redis-adapter.d.ts +70 -0
- package/types/adapters/redis-session-adapter.d.ts +82 -0
- package/types/adapters/redlock-adapter.d.ts +149 -0
- package/types/adapters/registry.d.ts +46 -0
- package/types/adapters/sqlite-adapter.d.ts +106 -0
- package/types/auth/index.d.ts +24 -0
- package/types/cli/commands/console-cmd.d.ts +37 -0
- package/types/cli/commands/new.d.ts +16 -0
- package/types/cli/commands/routes.d.ts +36 -0
- package/types/cli/commands/scaffold.d.ts +78 -0
- package/types/cli/commands/test-cmd.d.ts +14 -0
- package/types/cli/generators/index.d.ts +112 -0
- package/types/cli/index.d.ts +249 -0
- package/types/cli/template-engine.d.ts +40 -0
- package/types/core/ajv-mapper.d.ts +27 -0
- package/types/core/boot.d.ts +233 -0
- package/types/core/cluster-metrics.d.ts +52 -0
- package/types/core/config-loader.d.ts +13 -0
- package/types/core/config-validator.d.ts +30 -0
- package/types/core/ctx-builder.d.ts +80 -0
- package/types/core/envelope.d.ts +79 -0
- package/types/core/error-mapper.d.ts +17 -0
- package/types/core/formbody.d.ts +41 -0
- package/types/core/hub-link.d.ts +264 -0
- package/types/core/i18n.d.ts +178 -0
- package/types/core/index.d.ts +28 -0
- package/types/core/mega-app.d.ts +529 -0
- package/types/core/mega-cluster.d.ts +104 -0
- package/types/core/mega-server.d.ts +91 -0
- package/types/core/mega-service.d.ts +31 -0
- package/types/core/migration/dialect-registry.d.ts +22 -0
- package/types/core/migration/dialects/maria.d.ts +99 -0
- package/types/core/migration/dialects/mongo.d.ts +89 -0
- package/types/core/migration/dialects/postgres.d.ts +117 -0
- package/types/core/migration/dialects/sqlite.d.ts +111 -0
- package/types/core/migration/differ.d.ts +47 -0
- package/types/core/migration/generate.d.ts +56 -0
- package/types/core/migration/journal.d.ts +52 -0
- package/types/core/migration/model-scan.d.ts +19 -0
- package/types/core/migration/mongo-migration-db.d.ts +7 -0
- package/types/core/migration/schema-builder.d.ts +197 -0
- package/types/core/migration/schema-validator.d.ts +20 -0
- package/types/core/migration-lock.d.ts +33 -0
- package/types/core/migration-runner.d.ts +101 -0
- package/types/core/multipart.d.ts +86 -0
- package/types/core/openapi.d.ts +62 -0
- package/types/core/pipeline.d.ts +92 -0
- package/types/core/router.d.ts +159 -0
- package/types/core/routes-loader.d.ts +21 -0
- package/types/core/scope-registry.d.ts +14 -0
- package/types/core/security.d.ts +77 -0
- package/types/core/services-loader.d.ts +27 -0
- package/types/core/session-cleanup-schedule.d.ts +19 -0
- package/types/core/session-store.d.ts +18 -0
- package/types/core/session.d.ts +77 -0
- package/types/core/static-assets.d.ts +73 -0
- package/types/core/template.d.ts +106 -0
- package/types/core/workers-manager.d.ts +79 -0
- package/types/core/ws-cluster.d.ts +208 -0
- package/types/core/ws-compression.d.ts +112 -0
- package/types/core/ws-controller.d.ts +65 -0
- package/types/core/ws-message.d.ts +106 -0
- package/types/core/ws-presence.d.ts +273 -0
- package/types/core/ws-roster.d.ts +96 -0
- package/types/core/ws-upgrade.d.ts +231 -0
- package/types/errors/config-error.d.ts +10 -0
- package/types/errors/http-errors.d.ts +120 -0
- package/types/errors/index.d.ts +3 -0
- package/types/errors/mega-error.d.ts +32 -0
- package/types/index.d.ts +39 -0
- package/types/lib/asp/config.d.ts +49 -0
- package/types/lib/asp/crypto.d.ts +43 -0
- package/types/lib/asp/errors.d.ts +30 -0
- package/types/lib/asp/nonce-cache.d.ts +52 -0
- package/types/lib/asp/plugin.d.ts +30 -0
- package/types/lib/asp/ws-terminator.d.ts +45 -0
- package/types/lib/env-mapper.d.ts +14 -0
- package/types/lib/hub-protocol.d.ts +106 -0
- package/types/lib/index.d.ts +22 -0
- package/types/lib/logger/telegram-core.d.ts +104 -0
- package/types/lib/logger/telegram-transport.d.ts +45 -0
- package/types/lib/mega-brute-force.d.ts +66 -0
- package/types/lib/mega-circuit-breaker.d.ts +241 -0
- package/types/lib/mega-cron.d.ts +66 -0
- package/types/lib/mega-hash.d.ts +32 -0
- package/types/lib/mega-health.d.ts +41 -0
- package/types/lib/mega-job-queue.d.ts +176 -0
- package/types/lib/mega-job-worker.d.ts +130 -0
- package/types/lib/mega-job.d.ts +138 -0
- package/types/lib/mega-logger.d.ts +45 -0
- package/types/lib/mega-metrics.d.ts +285 -0
- package/types/lib/mega-plugin.d.ts +245 -0
- package/types/lib/mega-retry.d.ts +85 -0
- package/types/lib/mega-schedule.d.ts +260 -0
- package/types/lib/mega-shutdown.d.ts +135 -0
- package/types/lib/mega-tracing.d.ts +224 -0
- package/types/lib/mega-worker.d.ts +127 -0
- package/types/lib/otel-resource.d.ts +16 -0
- package/types/lib/worker-runner/process-entry.d.ts +1 -0
- package/types/lib/worker-runner/task-dispatch.d.ts +28 -0
- package/types/lib/worker-runner/thread-entry.d.ts +1 -0
- package/types/lib/ws-hub.d.ts +234 -0
- package/types/models/crud-sql-builder.d.ts +48 -0
- package/types/models/index.d.ts +1 -0
- package/types/models/mega-model.d.ts +138 -0
- package/types/models/model-crud.d.ts +82 -0
- package/types/models/mongo-crud.d.ts +59 -0
- package/types/test/index.d.ts +84 -0
- package/.env +0 -127
- package/sample/crud/apps/main/migrations/20260606000002-add-auth-to-users.js +0 -30
- package/sample/crud/apps/main/models/note.js +0 -71
- package/sample/crud/apps/main/models/user.js +0 -86
- package/sample/crud/package-lock.json +0 -5665
- package/sample/crud/yarn.lock +0 -2142
- package/sample/simple/package-lock.json +0 -1851
package/bin/mega-ws-hub.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// @ts-check
|
|
3
3
|
/**
|
|
4
|
-
* `mega ws-hub` 실행 launcher (ADR-032). 실제 로직은 src/
|
|
4
|
+
* `mega ws-hub` 실행 launcher (ADR-032). 실제 로직은 src/lib/ws-hub.js.
|
|
5
5
|
*
|
|
6
6
|
* 사용: MEGA_WSHUB_TOKENS=tok1,tok2 [MEGA_WSHUB_PORT=3100] [MEGA_WSHUB_HOST=0.0.0.0]
|
|
7
7
|
* [MEGA_WSHUB_HEARTBEAT_MS=25000] mega-ws-hub
|
|
8
8
|
*/
|
|
9
|
-
import { runWsHubCli } from '../src/
|
|
9
|
+
import { runWsHubCli } from '../src/lib/ws-hub.js'
|
|
10
10
|
|
|
11
11
|
runWsHubCli().catch((err) => {
|
|
12
12
|
// 부팅 실패는 fail-fast — 메시지 출력 후 비정상 종료 (P4: 이유 명확, silent X).
|
package/package.json
CHANGED
|
@@ -1,33 +1,53 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mega-framework",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Node.js 마이크로프레임웍 + CLI — Slim의 가벼움 + Rails의 관례",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=20.6.0"
|
|
8
8
|
},
|
|
9
9
|
"main": "src/index.js",
|
|
10
|
+
"types": "types/index.d.ts",
|
|
11
|
+
"workspaces": [
|
|
12
|
+
"sample/crud",
|
|
13
|
+
"sample/simple"
|
|
14
|
+
],
|
|
10
15
|
"repository": {
|
|
11
16
|
"type": "git",
|
|
12
17
|
"url": "git+https://git.nyx-zone.com/mega/mega-framework.git"
|
|
13
18
|
},
|
|
14
19
|
"exports": {
|
|
15
|
-
".":
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"./
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./types/index.d.ts",
|
|
22
|
+
"default": "./src/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./lib": {
|
|
25
|
+
"types": "./types/lib/index.d.ts",
|
|
26
|
+
"default": "./src/lib/index.js"
|
|
27
|
+
},
|
|
28
|
+
"./errors": {
|
|
29
|
+
"types": "./types/errors/index.d.ts",
|
|
30
|
+
"default": "./src/errors/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./auth": {
|
|
33
|
+
"types": "./types/auth/index.d.ts",
|
|
34
|
+
"default": "./src/auth/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./test": {
|
|
37
|
+
"types": "./types/test/index.d.ts",
|
|
38
|
+
"default": "./src/test/index.js"
|
|
39
|
+
},
|
|
20
40
|
"./eslint-plugin": "./src/eslint-plugin/index.js",
|
|
21
41
|
"./package.json": "./package.json"
|
|
22
42
|
},
|
|
23
43
|
"files": [
|
|
24
44
|
"src/**/*.js",
|
|
45
|
+
"types/**/*.d.ts",
|
|
25
46
|
"bin/**/*.js",
|
|
26
47
|
"templates/**",
|
|
27
48
|
"sample/**",
|
|
28
49
|
"infra/**",
|
|
29
50
|
"docker-compose.yml",
|
|
30
|
-
".env",
|
|
31
51
|
".env.example",
|
|
32
52
|
"eslint.config.js",
|
|
33
53
|
"vitest.config.js",
|
|
@@ -51,6 +71,7 @@
|
|
|
51
71
|
"test:coverage": "vitest run --coverage",
|
|
52
72
|
"lint": "eslint src test",
|
|
53
73
|
"typecheck": "tsc -p jsconfig.json --noEmit",
|
|
74
|
+
"build:types": "rm -rf types && tsc -p tsconfig.build.json",
|
|
54
75
|
"format": "prettier -w src test packages",
|
|
55
76
|
"infra:up": "docker compose up -d --wait",
|
|
56
77
|
"infra:down": "docker compose down -v",
|
|
@@ -58,7 +79,8 @@
|
|
|
58
79
|
"infra:reset": "docker compose down -v && docker compose up -d --wait",
|
|
59
80
|
"test:integration": "npm run infra:up && vitest run test/integration && npm run infra:down",
|
|
60
81
|
"test:unit": "vitest run test/unit",
|
|
61
|
-
"prepublishOnly": "npm run lint && npm run typecheck && npm run test:unit",
|
|
82
|
+
"prepublishOnly": "npm run build:types && npm run lint && npm run typecheck && npm run test:unit",
|
|
83
|
+
"prepare": "npm run build:types",
|
|
62
84
|
"release": "bash scripts/publish.sh"
|
|
63
85
|
},
|
|
64
86
|
"devDependencies": {
|
|
@@ -89,6 +111,7 @@
|
|
|
89
111
|
"@fastify/swagger": "^9.7.0",
|
|
90
112
|
"@fastify/swagger-ui": "^5.2.6",
|
|
91
113
|
"@opentelemetry/api": "^1.9.1",
|
|
114
|
+
"@opentelemetry/core": "^2.7.1",
|
|
92
115
|
"@opentelemetry/exporter-prometheus": "^0.218.0",
|
|
93
116
|
"@opentelemetry/exporter-trace-otlp-http": "^0.218.0",
|
|
94
117
|
"@opentelemetry/exporter-zipkin": "^2.7.1",
|
|
@@ -97,6 +120,7 @@
|
|
|
97
120
|
"@opentelemetry/sdk-trace-base": "^2.7.1",
|
|
98
121
|
"@opentelemetry/semantic-conventions": "^1.41.1",
|
|
99
122
|
"ajv": "^8.20.0",
|
|
123
|
+
"ajv-formats": "^3.0.1",
|
|
100
124
|
"better-sqlite3": "^12.10.0",
|
|
101
125
|
"commander": "^15.0.0",
|
|
102
126
|
"croner": "^10.0.1",
|
package/sample/crud/.env
CHANGED
|
@@ -71,7 +71,7 @@ NATS_JOBS_URL=nats://localhost:4222
|
|
|
71
71
|
|
|
72
72
|
# ── WS Hub: 클러스터 채팅 브릿지 (ADR-059/065/137/176) ────────────────────────
|
|
73
73
|
# crud 는 app.config.js 의 bridgeHub 로 /ws/chat 을 클러스터 전파한다. 허브는 `mega ws-hub`(scripts/
|
|
74
|
-
# start-ws-hub.sh)로 별도 프로세스 기동. 아래 MEGA_WSHUB_* 는 src/
|
|
74
|
+
# start-ws-hub.sh)로 별도 프로세스 기동. 아래 MEGA_WSHUB_* 는 src/lib/ws-hub.js 가 읽는다.
|
|
75
75
|
# --- 허브 서버가 읽는 값 (`mega ws-hub`) ---
|
|
76
76
|
# 수락 토큰 CSV(필수) — 브릿지 인증. 빈 값이면 허브 기동 실패. 운영 교체.
|
|
77
77
|
MEGA_WSHUB_TOKENS=dev-bridge-token-change-me
|
package/sample/crud/.env.example
CHANGED
|
@@ -71,7 +71,7 @@ NATS_JOBS_URL=nats://localhost:4222
|
|
|
71
71
|
|
|
72
72
|
# ── WS Hub: 클러스터 채팅 브릿지 (ADR-059/065/137/176) ────────────────────────
|
|
73
73
|
# crud 는 app.config.js 의 bridgeHub 로 /ws/chat 을 클러스터 전파한다. 허브는 `mega ws-hub`(scripts/
|
|
74
|
-
# start-ws-hub.sh)로 별도 프로세스 기동. 아래 MEGA_WSHUB_* 는 src/
|
|
74
|
+
# start-ws-hub.sh)로 별도 프로세스 기동. 아래 MEGA_WSHUB_* 는 src/lib/ws-hub.js 가 읽는다.
|
|
75
75
|
# --- 허브 서버가 읽는 값 (`mega ws-hub`) ---
|
|
76
76
|
# 수락 토큰 CSV(필수) — 브릿지 인증. 빈 값이면 허브 기동 실패. 운영 교체.
|
|
77
77
|
MEGA_WSHUB_TOKENS=change-me-hub-token
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"generatedAt": "2026-06-12T09:25:43.484Z",
|
|
4
|
+
"adapters": {
|
|
5
|
+
"primary": {
|
|
6
|
+
"driver": "postgres",
|
|
7
|
+
"models": [
|
|
8
|
+
{
|
|
9
|
+
"name": "UserLevelModel",
|
|
10
|
+
"table": "user_levels",
|
|
11
|
+
"record": {
|
|
12
|
+
"table": "user_levels",
|
|
13
|
+
"adapter": "primary",
|
|
14
|
+
"columns": {
|
|
15
|
+
"id": {
|
|
16
|
+
"type": "serial",
|
|
17
|
+
"primary": true
|
|
18
|
+
},
|
|
19
|
+
"code": {
|
|
20
|
+
"type": "text",
|
|
21
|
+
"notNull": true,
|
|
22
|
+
"unique": true,
|
|
23
|
+
"comment": "회원 등급 코드"
|
|
24
|
+
},
|
|
25
|
+
"type_code": {
|
|
26
|
+
"type": "text",
|
|
27
|
+
"notNull": true,
|
|
28
|
+
"references": {
|
|
29
|
+
"model": "UserTypeModel",
|
|
30
|
+
"column": "code",
|
|
31
|
+
"onDelete": "cascade",
|
|
32
|
+
"table": "user_types"
|
|
33
|
+
},
|
|
34
|
+
"comment": "회원 유형 코드"
|
|
35
|
+
},
|
|
36
|
+
"sort_order": {
|
|
37
|
+
"type": "integer",
|
|
38
|
+
"notNull": true,
|
|
39
|
+
"default": 0,
|
|
40
|
+
"comment": "정렬 순서"
|
|
41
|
+
},
|
|
42
|
+
"name": {
|
|
43
|
+
"type": "text",
|
|
44
|
+
"notNull": true,
|
|
45
|
+
"comment": "회원 등급명"
|
|
46
|
+
},
|
|
47
|
+
"created_at": {
|
|
48
|
+
"type": "timestamptz",
|
|
49
|
+
"notNull": true,
|
|
50
|
+
"default": {
|
|
51
|
+
"raw": "now()"
|
|
52
|
+
},
|
|
53
|
+
"comment": "생성 시간"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"indexes": [
|
|
57
|
+
{
|
|
58
|
+
"columns": [
|
|
59
|
+
"type_code"
|
|
60
|
+
],
|
|
61
|
+
"name": "idx_user_levels_type_code"
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "UserModel",
|
|
68
|
+
"table": "users",
|
|
69
|
+
"record": {
|
|
70
|
+
"table": "users",
|
|
71
|
+
"adapter": "primary",
|
|
72
|
+
"columns": {
|
|
73
|
+
"id": {
|
|
74
|
+
"type": "bigSerial",
|
|
75
|
+
"primary": true
|
|
76
|
+
},
|
|
77
|
+
"uuid": {
|
|
78
|
+
"type": "uuid",
|
|
79
|
+
"notNull": true,
|
|
80
|
+
"default": {
|
|
81
|
+
"raw": "gen_random_uuid()"
|
|
82
|
+
},
|
|
83
|
+
"comment": "고유값"
|
|
84
|
+
},
|
|
85
|
+
"username": {
|
|
86
|
+
"type": "text",
|
|
87
|
+
"notNull": true,
|
|
88
|
+
"unique": true,
|
|
89
|
+
"comment": "로그인 아이디"
|
|
90
|
+
},
|
|
91
|
+
"password_hash": {
|
|
92
|
+
"type": "text",
|
|
93
|
+
"notNull": true,
|
|
94
|
+
"comment": "비밀번호 해시"
|
|
95
|
+
},
|
|
96
|
+
"type_code": {
|
|
97
|
+
"type": "text",
|
|
98
|
+
"notNull": true,
|
|
99
|
+
"default": "USER",
|
|
100
|
+
"comment": "회원 유형"
|
|
101
|
+
},
|
|
102
|
+
"level_code": {
|
|
103
|
+
"type": "text",
|
|
104
|
+
"notNull": true,
|
|
105
|
+
"default": "lv1",
|
|
106
|
+
"comment": "회원 등급"
|
|
107
|
+
},
|
|
108
|
+
"name": {
|
|
109
|
+
"type": "text",
|
|
110
|
+
"notNull": true,
|
|
111
|
+
"comment": "실명"
|
|
112
|
+
},
|
|
113
|
+
"nickname": {
|
|
114
|
+
"type": "text",
|
|
115
|
+
"notNull": true,
|
|
116
|
+
"unique": true,
|
|
117
|
+
"comment": "별명"
|
|
118
|
+
},
|
|
119
|
+
"email": {
|
|
120
|
+
"type": "text",
|
|
121
|
+
"comment": "이메일"
|
|
122
|
+
},
|
|
123
|
+
"phone_number": {
|
|
124
|
+
"type": "text",
|
|
125
|
+
"comment": "전화번호"
|
|
126
|
+
},
|
|
127
|
+
"last_login_at": {
|
|
128
|
+
"type": "timestamptz",
|
|
129
|
+
"comment": "마지막 로그인 시간"
|
|
130
|
+
},
|
|
131
|
+
"created_at": {
|
|
132
|
+
"type": "timestamptz",
|
|
133
|
+
"notNull": true,
|
|
134
|
+
"default": {
|
|
135
|
+
"raw": "now()"
|
|
136
|
+
},
|
|
137
|
+
"comment": "생성 시간"
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
"indexes": [
|
|
141
|
+
{
|
|
142
|
+
"columns": [
|
|
143
|
+
"uuid"
|
|
144
|
+
],
|
|
145
|
+
"name": "idx_users_uuid",
|
|
146
|
+
"unique": true
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"columns": [
|
|
150
|
+
"email"
|
|
151
|
+
],
|
|
152
|
+
"name": "idx_users_email"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"columns": [
|
|
156
|
+
"type_code"
|
|
157
|
+
],
|
|
158
|
+
"name": "idx_users_type_code"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"columns": [
|
|
162
|
+
"level_code"
|
|
163
|
+
],
|
|
164
|
+
"name": "idx_users_level_code"
|
|
165
|
+
}
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"name": "UserTypeModel",
|
|
171
|
+
"table": "user_types",
|
|
172
|
+
"record": {
|
|
173
|
+
"table": "user_types",
|
|
174
|
+
"adapter": "primary",
|
|
175
|
+
"columns": {
|
|
176
|
+
"id": {
|
|
177
|
+
"type": "serial",
|
|
178
|
+
"primary": true
|
|
179
|
+
},
|
|
180
|
+
"code": {
|
|
181
|
+
"type": "text",
|
|
182
|
+
"notNull": true,
|
|
183
|
+
"unique": true,
|
|
184
|
+
"comment": "회원 유형 코드"
|
|
185
|
+
},
|
|
186
|
+
"sort_order": {
|
|
187
|
+
"type": "integer",
|
|
188
|
+
"notNull": true,
|
|
189
|
+
"default": 0,
|
|
190
|
+
"comment": "정렬 순서"
|
|
191
|
+
},
|
|
192
|
+
"name": {
|
|
193
|
+
"type": "text",
|
|
194
|
+
"notNull": true,
|
|
195
|
+
"comment": "회원 유형명"
|
|
196
|
+
},
|
|
197
|
+
"created_at": {
|
|
198
|
+
"type": "timestamptz",
|
|
199
|
+
"notNull": true,
|
|
200
|
+
"default": {
|
|
201
|
+
"raw": "now()"
|
|
202
|
+
},
|
|
203
|
+
"comment": "생성 시간"
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
"indexes": []
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"name": "WalletModel",
|
|
211
|
+
"table": "wallets",
|
|
212
|
+
"record": {
|
|
213
|
+
"table": "wallets",
|
|
214
|
+
"adapter": "primary",
|
|
215
|
+
"columns": {
|
|
216
|
+
"id": {
|
|
217
|
+
"type": "serial",
|
|
218
|
+
"primary": true
|
|
219
|
+
},
|
|
220
|
+
"user_id": {
|
|
221
|
+
"type": "bigInteger",
|
|
222
|
+
"notNull": true,
|
|
223
|
+
"references": {
|
|
224
|
+
"model": "UserModel",
|
|
225
|
+
"column": "id",
|
|
226
|
+
"onDelete": "cascade",
|
|
227
|
+
"table": "users"
|
|
228
|
+
},
|
|
229
|
+
"comment": "회원 ID"
|
|
230
|
+
},
|
|
231
|
+
"balance": {
|
|
232
|
+
"type": "decimal",
|
|
233
|
+
"precision": 20,
|
|
234
|
+
"scale": 4,
|
|
235
|
+
"notNull": true,
|
|
236
|
+
"default": 0,
|
|
237
|
+
"comment": "잔액"
|
|
238
|
+
},
|
|
239
|
+
"created_at": {
|
|
240
|
+
"type": "timestamptz",
|
|
241
|
+
"notNull": true,
|
|
242
|
+
"default": {
|
|
243
|
+
"raw": "now()"
|
|
244
|
+
},
|
|
245
|
+
"comment": "생성 시간"
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
"indexes": [
|
|
249
|
+
{
|
|
250
|
+
"columns": [
|
|
251
|
+
"user_id"
|
|
252
|
+
],
|
|
253
|
+
"name": "idx_wallets_user_id"
|
|
254
|
+
}
|
|
255
|
+
]
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
]
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"generatedAt": "2026-06-12T09:25:43.485Z",
|
|
4
|
+
"adapters": {
|
|
5
|
+
"primary": {
|
|
6
|
+
"driver": "postgres",
|
|
7
|
+
"models": [
|
|
8
|
+
{
|
|
9
|
+
"name": "UserLevelModel",
|
|
10
|
+
"table": "user_levels",
|
|
11
|
+
"record": {
|
|
12
|
+
"table": "user_levels",
|
|
13
|
+
"adapter": "primary",
|
|
14
|
+
"columns": {
|
|
15
|
+
"id": {
|
|
16
|
+
"type": "serial",
|
|
17
|
+
"primary": true
|
|
18
|
+
},
|
|
19
|
+
"code": {
|
|
20
|
+
"type": "text",
|
|
21
|
+
"notNull": true,
|
|
22
|
+
"unique": true,
|
|
23
|
+
"comment": "회원 등급 코드"
|
|
24
|
+
},
|
|
25
|
+
"type_code": {
|
|
26
|
+
"type": "text",
|
|
27
|
+
"notNull": true,
|
|
28
|
+
"references": {
|
|
29
|
+
"model": "UserTypeModel",
|
|
30
|
+
"column": "code",
|
|
31
|
+
"onDelete": "cascade",
|
|
32
|
+
"table": "user_types"
|
|
33
|
+
},
|
|
34
|
+
"comment": "회원 유형 코드"
|
|
35
|
+
},
|
|
36
|
+
"sort_order": {
|
|
37
|
+
"type": "integer",
|
|
38
|
+
"notNull": true,
|
|
39
|
+
"default": 0,
|
|
40
|
+
"comment": "정렬 순서"
|
|
41
|
+
},
|
|
42
|
+
"name": {
|
|
43
|
+
"type": "text",
|
|
44
|
+
"notNull": true,
|
|
45
|
+
"comment": "회원 등급명"
|
|
46
|
+
},
|
|
47
|
+
"created_at": {
|
|
48
|
+
"type": "timestamptz",
|
|
49
|
+
"notNull": true,
|
|
50
|
+
"default": {
|
|
51
|
+
"raw": "now()"
|
|
52
|
+
},
|
|
53
|
+
"comment": "생성 시간"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"indexes": [
|
|
57
|
+
{
|
|
58
|
+
"columns": [
|
|
59
|
+
"type_code"
|
|
60
|
+
],
|
|
61
|
+
"name": "idx_user_levels_type_code"
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "UserModel",
|
|
68
|
+
"table": "users",
|
|
69
|
+
"record": {
|
|
70
|
+
"table": "users",
|
|
71
|
+
"adapter": "primary",
|
|
72
|
+
"columns": {
|
|
73
|
+
"id": {
|
|
74
|
+
"type": "bigSerial",
|
|
75
|
+
"primary": true
|
|
76
|
+
},
|
|
77
|
+
"uuid": {
|
|
78
|
+
"type": "uuid",
|
|
79
|
+
"notNull": true,
|
|
80
|
+
"default": {
|
|
81
|
+
"raw": "gen_random_uuid()"
|
|
82
|
+
},
|
|
83
|
+
"comment": "고유값"
|
|
84
|
+
},
|
|
85
|
+
"username": {
|
|
86
|
+
"type": "text",
|
|
87
|
+
"notNull": true,
|
|
88
|
+
"unique": true,
|
|
89
|
+
"comment": "로그인 아이디"
|
|
90
|
+
},
|
|
91
|
+
"password_hash": {
|
|
92
|
+
"type": "text",
|
|
93
|
+
"notNull": true,
|
|
94
|
+
"comment": "비밀번호 해시"
|
|
95
|
+
},
|
|
96
|
+
"type_code": {
|
|
97
|
+
"type": "text",
|
|
98
|
+
"notNull": true,
|
|
99
|
+
"default": "USER",
|
|
100
|
+
"comment": "회원 유형"
|
|
101
|
+
},
|
|
102
|
+
"level_code": {
|
|
103
|
+
"type": "text",
|
|
104
|
+
"notNull": true,
|
|
105
|
+
"default": "lv1",
|
|
106
|
+
"comment": "회원 등급"
|
|
107
|
+
},
|
|
108
|
+
"name": {
|
|
109
|
+
"type": "text",
|
|
110
|
+
"notNull": true,
|
|
111
|
+
"comment": "실명"
|
|
112
|
+
},
|
|
113
|
+
"nickname": {
|
|
114
|
+
"type": "text",
|
|
115
|
+
"notNull": true,
|
|
116
|
+
"unique": true,
|
|
117
|
+
"comment": "별명"
|
|
118
|
+
},
|
|
119
|
+
"email": {
|
|
120
|
+
"type": "text",
|
|
121
|
+
"comment": "이메일"
|
|
122
|
+
},
|
|
123
|
+
"phone_number": {
|
|
124
|
+
"type": "text",
|
|
125
|
+
"comment": "전화번호"
|
|
126
|
+
},
|
|
127
|
+
"last_login_at": {
|
|
128
|
+
"type": "timestamptz",
|
|
129
|
+
"comment": "마지막 로그인 시간"
|
|
130
|
+
},
|
|
131
|
+
"created_at": {
|
|
132
|
+
"type": "timestamptz",
|
|
133
|
+
"notNull": true,
|
|
134
|
+
"default": {
|
|
135
|
+
"raw": "now()"
|
|
136
|
+
},
|
|
137
|
+
"comment": "생성 시간"
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
"indexes": [
|
|
141
|
+
{
|
|
142
|
+
"columns": [
|
|
143
|
+
"uuid"
|
|
144
|
+
],
|
|
145
|
+
"name": "idx_users_uuid",
|
|
146
|
+
"unique": true
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"columns": [
|
|
150
|
+
"email"
|
|
151
|
+
],
|
|
152
|
+
"name": "idx_users_email"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"columns": [
|
|
156
|
+
"type_code"
|
|
157
|
+
],
|
|
158
|
+
"name": "idx_users_type_code"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"columns": [
|
|
162
|
+
"level_code"
|
|
163
|
+
],
|
|
164
|
+
"name": "idx_users_level_code"
|
|
165
|
+
}
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"name": "UserTypeModel",
|
|
171
|
+
"table": "user_types",
|
|
172
|
+
"record": {
|
|
173
|
+
"table": "user_types",
|
|
174
|
+
"adapter": "primary",
|
|
175
|
+
"columns": {
|
|
176
|
+
"id": {
|
|
177
|
+
"type": "serial",
|
|
178
|
+
"primary": true
|
|
179
|
+
},
|
|
180
|
+
"code": {
|
|
181
|
+
"type": "text",
|
|
182
|
+
"notNull": true,
|
|
183
|
+
"unique": true,
|
|
184
|
+
"comment": "회원 유형 코드"
|
|
185
|
+
},
|
|
186
|
+
"sort_order": {
|
|
187
|
+
"type": "integer",
|
|
188
|
+
"notNull": true,
|
|
189
|
+
"default": 0,
|
|
190
|
+
"comment": "정렬 순서"
|
|
191
|
+
},
|
|
192
|
+
"name": {
|
|
193
|
+
"type": "text",
|
|
194
|
+
"notNull": true,
|
|
195
|
+
"comment": "회원 유형명"
|
|
196
|
+
},
|
|
197
|
+
"created_at": {
|
|
198
|
+
"type": "timestamptz",
|
|
199
|
+
"notNull": true,
|
|
200
|
+
"default": {
|
|
201
|
+
"raw": "now()"
|
|
202
|
+
},
|
|
203
|
+
"comment": "생성 시간"
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
"indexes": []
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"name": "WalletModel",
|
|
211
|
+
"table": "wallets",
|
|
212
|
+
"record": {
|
|
213
|
+
"table": "wallets",
|
|
214
|
+
"adapter": "primary",
|
|
215
|
+
"columns": {
|
|
216
|
+
"id": {
|
|
217
|
+
"type": "serial",
|
|
218
|
+
"primary": true
|
|
219
|
+
},
|
|
220
|
+
"user_id": {
|
|
221
|
+
"type": "bigInteger",
|
|
222
|
+
"notNull": true,
|
|
223
|
+
"references": {
|
|
224
|
+
"model": "UserModel",
|
|
225
|
+
"column": "id",
|
|
226
|
+
"onDelete": "cascade",
|
|
227
|
+
"table": "users"
|
|
228
|
+
},
|
|
229
|
+
"comment": "회원 ID"
|
|
230
|
+
},
|
|
231
|
+
"balance": {
|
|
232
|
+
"type": "decimal",
|
|
233
|
+
"precision": 20,
|
|
234
|
+
"scale": 4,
|
|
235
|
+
"notNull": true,
|
|
236
|
+
"default": 0,
|
|
237
|
+
"comment": "잔액"
|
|
238
|
+
},
|
|
239
|
+
"created_at": {
|
|
240
|
+
"type": "timestamptz",
|
|
241
|
+
"notNull": true,
|
|
242
|
+
"default": {
|
|
243
|
+
"raw": "now()"
|
|
244
|
+
},
|
|
245
|
+
"comment": "생성 시간"
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
"indexes": [
|
|
249
|
+
{
|
|
250
|
+
"columns": [
|
|
251
|
+
"user_id"
|
|
252
|
+
],
|
|
253
|
+
"name": "idx_wallets_user_id"
|
|
254
|
+
}
|
|
255
|
+
]
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
]
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|