@reglow/reglow 0.4.0
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/README.md +267 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/reglow/common/errors.d.ts +92 -0
- package/dist/reglow/common/errors.js +127 -0
- package/dist/reglow/common/errors.js.map +1 -0
- package/dist/reglow/common/exception_handler.d.ts +14 -0
- package/dist/reglow/common/exception_handler.js +135 -0
- package/dist/reglow/common/exception_handler.js.map +1 -0
- package/dist/reglow/common/i18n.d.ts +15 -0
- package/dist/reglow/common/i18n.js +61 -0
- package/dist/reglow/common/i18n.js.map +1 -0
- package/dist/reglow/common/middleware.d.ts +5 -0
- package/dist/reglow/common/middleware.js +131 -0
- package/dist/reglow/common/middleware.js.map +1 -0
- package/dist/reglow/common/response.d.ts +28 -0
- package/dist/reglow/common/response.js +42 -0
- package/dist/reglow/common/response.js.map +1 -0
- package/dist/reglow/common/serialize.d.ts +6 -0
- package/dist/reglow/common/serialize.js +39 -0
- package/dist/reglow/common/serialize.js.map +1 -0
- package/dist/reglow/common/utils/date_utils.d.ts +10 -0
- package/dist/reglow/common/utils/date_utils.js +30 -0
- package/dist/reglow/common/utils/date_utils.js.map +1 -0
- package/dist/reglow/common/utils/parse-user-agent.d.ts +11 -0
- package/dist/reglow/common/utils/parse-user-agent.js +80 -0
- package/dist/reglow/common/utils/parse-user-agent.js.map +1 -0
- package/dist/reglow/common/utils/string_utils.d.ts +14 -0
- package/dist/reglow/common/utils/string_utils.js +31 -0
- package/dist/reglow/common/utils/string_utils.js.map +1 -0
- package/dist/reglow/core/auth.d.ts +15 -0
- package/dist/reglow/core/auth.js +184 -0
- package/dist/reglow/core/auth.js.map +1 -0
- package/dist/reglow/core/cache.d.ts +6 -0
- package/dist/reglow/core/cache.js +15 -0
- package/dist/reglow/core/cache.js.map +1 -0
- package/dist/reglow/core/config.d.ts +45 -0
- package/dist/reglow/core/config.js +83 -0
- package/dist/reglow/core/config.js.map +1 -0
- package/dist/reglow/core/data_scope.d.ts +21 -0
- package/dist/reglow/core/data_scope.js +20 -0
- package/dist/reglow/core/data_scope.js.map +1 -0
- package/dist/reglow/core/database.d.ts +4 -0
- package/dist/reglow/core/database.js +43 -0
- package/dist/reglow/core/database.js.map +1 -0
- package/dist/reglow/core/email.d.ts +12 -0
- package/dist/reglow/core/email.js +277 -0
- package/dist/reglow/core/email.js.map +1 -0
- package/dist/reglow/core/entities.d.ts +462 -0
- package/dist/reglow/core/entities.js +6 -0
- package/dist/reglow/core/entities.js.map +1 -0
- package/dist/reglow/core/fastify.d.ts +21 -0
- package/dist/reglow/core/fastify.js +2 -0
- package/dist/reglow/core/fastify.js.map +1 -0
- package/dist/reglow/core/logging.d.ts +8 -0
- package/dist/reglow/core/logging.js +32 -0
- package/dist/reglow/core/logging.js.map +1 -0
- package/dist/reglow/core/models.d.ts +98 -0
- package/dist/reglow/core/models.js +57 -0
- package/dist/reglow/core/models.js.map +1 -0
- package/dist/reglow/core/observability.d.ts +17 -0
- package/dist/reglow/core/observability.js +92 -0
- package/dist/reglow/core/observability.js.map +1 -0
- package/dist/reglow/core/payment.d.ts +107 -0
- package/dist/reglow/core/payment.js +1177 -0
- package/dist/reglow/core/payment.js.map +1 -0
- package/dist/reglow/core/plugin.d.ts +19 -0
- package/dist/reglow/core/plugin.js +85 -0
- package/dist/reglow/core/plugin.js.map +1 -0
- package/dist/reglow/core/rate_limit.d.ts +2 -0
- package/dist/reglow/core/rate_limit.js +28 -0
- package/dist/reglow/core/rate_limit.js.map +1 -0
- package/dist/reglow/core/redis.d.ts +30 -0
- package/dist/reglow/core/redis.js +278 -0
- package/dist/reglow/core/redis.js.map +1 -0
- package/dist/reglow/core/redis_keys.d.ts +22 -0
- package/dist/reglow/core/redis_keys.js +59 -0
- package/dist/reglow/core/redis_keys.js.map +1 -0
- package/dist/reglow/core/security.d.ts +25 -0
- package/dist/reglow/core/security.js +64 -0
- package/dist/reglow/core/security.js.map +1 -0
- package/dist/reglow/core/session.d.ts +17 -0
- package/dist/reglow/core/session.js +194 -0
- package/dist/reglow/core/session.js.map +1 -0
- package/dist/reglow/core/sms.d.ts +19 -0
- package/dist/reglow/core/sms.js +33 -0
- package/dist/reglow/core/sms.js.map +1 -0
- package/dist/reglow/core/storage.d.ts +45 -0
- package/dist/reglow/core/storage.js +249 -0
- package/dist/reglow/core/storage.js.map +1 -0
- package/dist/reglow/modules/agreement/controller.d.ts +7 -0
- package/dist/reglow/modules/agreement/controller.js +242 -0
- package/dist/reglow/modules/agreement/controller.js.map +1 -0
- package/dist/reglow/modules/agreement/repository.d.ts +30 -0
- package/dist/reglow/modules/agreement/repository.js +160 -0
- package/dist/reglow/modules/agreement/repository.js.map +1 -0
- package/dist/reglow/modules/agreement/router.d.ts +13 -0
- package/dist/reglow/modules/agreement/router.js +10 -0
- package/dist/reglow/modules/agreement/router.js.map +1 -0
- package/dist/reglow/modules/agreement/schema.d.ts +30 -0
- package/dist/reglow/modules/agreement/schema.js +27 -0
- package/dist/reglow/modules/agreement/schema.js.map +1 -0
- package/dist/reglow/modules/agreement/service.d.ts +42 -0
- package/dist/reglow/modules/agreement/service.js +349 -0
- package/dist/reglow/modules/agreement/service.js.map +1 -0
- package/dist/reglow/modules/ai/controller.d.ts +25 -0
- package/dist/reglow/modules/ai/controller.js +1143 -0
- package/dist/reglow/modules/ai/controller.js.map +1 -0
- package/dist/reglow/modules/ai/router.d.ts +9 -0
- package/dist/reglow/modules/ai/router.js +7 -0
- package/dist/reglow/modules/ai/router.js.map +1 -0
- package/dist/reglow/modules/ai/schema.d.ts +48 -0
- package/dist/reglow/modules/ai/schema.js +40 -0
- package/dist/reglow/modules/ai/schema.js.map +1 -0
- package/dist/reglow/modules/ai/service.d.ts +8 -0
- package/dist/reglow/modules/ai/service.js +137 -0
- package/dist/reglow/modules/ai/service.js.map +1 -0
- package/dist/reglow/modules/article/controller.d.ts +6 -0
- package/dist/reglow/modules/article/controller.js +204 -0
- package/dist/reglow/modules/article/controller.js.map +1 -0
- package/dist/reglow/modules/article/repository.d.ts +37 -0
- package/dist/reglow/modules/article/repository.js +184 -0
- package/dist/reglow/modules/article/repository.js.map +1 -0
- package/dist/reglow/modules/article/router.d.ts +10 -0
- package/dist/reglow/modules/article/router.js +8 -0
- package/dist/reglow/modules/article/router.js.map +1 -0
- package/dist/reglow/modules/article/schema.d.ts +66 -0
- package/dist/reglow/modules/article/schema.js +66 -0
- package/dist/reglow/modules/article/schema.js.map +1 -0
- package/dist/reglow/modules/article/service.d.ts +81 -0
- package/dist/reglow/modules/article/service.js +254 -0
- package/dist/reglow/modules/article/service.js.map +1 -0
- package/dist/reglow/modules/auth/controller.d.ts +6 -0
- package/dist/reglow/modules/auth/controller.js +127 -0
- package/dist/reglow/modules/auth/controller.js.map +1 -0
- package/dist/reglow/modules/auth/router.d.ts +9 -0
- package/dist/reglow/modules/auth/router.js +7 -0
- package/dist/reglow/modules/auth/router.js.map +1 -0
- package/dist/reglow/modules/auth/schema.d.ts +59 -0
- package/dist/reglow/modules/auth/schema.js +56 -0
- package/dist/reglow/modules/auth/schema.js.map +1 -0
- package/dist/reglow/modules/auth/service.d.ts +69 -0
- package/dist/reglow/modules/auth/service.js +492 -0
- package/dist/reglow/modules/auth/service.js.map +1 -0
- package/dist/reglow/modules/config/controller.d.ts +7 -0
- package/dist/reglow/modules/config/controller.js +297 -0
- package/dist/reglow/modules/config/controller.js.map +1 -0
- package/dist/reglow/modules/config/repository.d.ts +17 -0
- package/dist/reglow/modules/config/repository.js +88 -0
- package/dist/reglow/modules/config/repository.js.map +1 -0
- package/dist/reglow/modules/config/router.d.ts +13 -0
- package/dist/reglow/modules/config/router.js +8 -0
- package/dist/reglow/modules/config/router.js.map +1 -0
- package/dist/reglow/modules/config/schema.d.ts +37 -0
- package/dist/reglow/modules/config/schema.js +25 -0
- package/dist/reglow/modules/config/schema.js.map +1 -0
- package/dist/reglow/modules/customer_service/controller.d.ts +3 -0
- package/dist/reglow/modules/customer_service/controller.js +443 -0
- package/dist/reglow/modules/customer_service/controller.js.map +1 -0
- package/dist/reglow/modules/customer_service/document_parser.d.ts +5 -0
- package/dist/reglow/modules/customer_service/document_parser.js +84 -0
- package/dist/reglow/modules/customer_service/document_parser.js.map +1 -0
- package/dist/reglow/modules/customer_service/repository.d.ts +72 -0
- package/dist/reglow/modules/customer_service/repository.js +376 -0
- package/dist/reglow/modules/customer_service/repository.js.map +1 -0
- package/dist/reglow/modules/customer_service/router.d.ts +14 -0
- package/dist/reglow/modules/customer_service/router.js +9 -0
- package/dist/reglow/modules/customer_service/router.js.map +1 -0
- package/dist/reglow/modules/customer_service/schema.d.ts +97 -0
- package/dist/reglow/modules/customer_service/schema.js +91 -0
- package/dist/reglow/modules/customer_service/schema.js.map +1 -0
- package/dist/reglow/modules/customer_service/sdk_template.html +666 -0
- package/dist/reglow/modules/customer_service/service.d.ts +92 -0
- package/dist/reglow/modules/customer_service/service.js +1642 -0
- package/dist/reglow/modules/customer_service/service.js.map +1 -0
- package/dist/reglow/modules/customer_service/ws.d.ts +29 -0
- package/dist/reglow/modules/customer_service/ws.js +182 -0
- package/dist/reglow/modules/customer_service/ws.js.map +1 -0
- package/dist/reglow/modules/dept/controller.d.ts +6 -0
- package/dist/reglow/modules/dept/controller.js +122 -0
- package/dist/reglow/modules/dept/controller.js.map +1 -0
- package/dist/reglow/modules/dept/repository.d.ts +24 -0
- package/dist/reglow/modules/dept/repository.js +140 -0
- package/dist/reglow/modules/dept/repository.js.map +1 -0
- package/dist/reglow/modules/dept/router.d.ts +9 -0
- package/dist/reglow/modules/dept/router.js +7 -0
- package/dist/reglow/modules/dept/router.js.map +1 -0
- package/dist/reglow/modules/dept/schema.d.ts +37 -0
- package/dist/reglow/modules/dept/schema.js +33 -0
- package/dist/reglow/modules/dept/schema.js.map +1 -0
- package/dist/reglow/modules/dept/service.d.ts +33 -0
- package/dist/reglow/modules/dept/service.js +88 -0
- package/dist/reglow/modules/dept/service.js.map +1 -0
- package/dist/reglow/modules/dict/controller.d.ts +5 -0
- package/dist/reglow/modules/dict/controller.js +87 -0
- package/dist/reglow/modules/dict/controller.js.map +1 -0
- package/dist/reglow/modules/dict/model.d.ts +7 -0
- package/dist/reglow/modules/dict/model.js +8 -0
- package/dist/reglow/modules/dict/model.js.map +1 -0
- package/dist/reglow/modules/dict/repository.d.ts +16 -0
- package/dist/reglow/modules/dict/repository.js +103 -0
- package/dist/reglow/modules/dict/repository.js.map +1 -0
- package/dist/reglow/modules/dict/router.d.ts +9 -0
- package/dist/reglow/modules/dict/router.js +7 -0
- package/dist/reglow/modules/dict/router.js.map +1 -0
- package/dist/reglow/modules/dict/schema.d.ts +38 -0
- package/dist/reglow/modules/dict/schema.js +37 -0
- package/dist/reglow/modules/dict/schema.js.map +1 -0
- package/dist/reglow/modules/dict/service.d.ts +15 -0
- package/dist/reglow/modules/dict/service.js +88 -0
- package/dist/reglow/modules/dict/service.js.map +1 -0
- package/dist/reglow/modules/employee/controller.d.ts +6 -0
- package/dist/reglow/modules/employee/controller.js +167 -0
- package/dist/reglow/modules/employee/controller.js.map +1 -0
- package/dist/reglow/modules/employee/repository.d.ts +22 -0
- package/dist/reglow/modules/employee/repository.js +129 -0
- package/dist/reglow/modules/employee/repository.js.map +1 -0
- package/dist/reglow/modules/employee/router.d.ts +9 -0
- package/dist/reglow/modules/employee/router.js +7 -0
- package/dist/reglow/modules/employee/router.js.map +1 -0
- package/dist/reglow/modules/employee/schema.d.ts +57 -0
- package/dist/reglow/modules/employee/schema.js +58 -0
- package/dist/reglow/modules/employee/schema.js.map +1 -0
- package/dist/reglow/modules/employee/service.d.ts +30 -0
- package/dist/reglow/modules/employee/service.js +193 -0
- package/dist/reglow/modules/employee/service.js.map +1 -0
- package/dist/reglow/modules/log/controller.d.ts +6 -0
- package/dist/reglow/modules/log/controller.js +137 -0
- package/dist/reglow/modules/log/controller.js.map +1 -0
- package/dist/reglow/modules/log/data-scope.d.ts +9 -0
- package/dist/reglow/modules/log/data-scope.js +108 -0
- package/dist/reglow/modules/log/data-scope.js.map +1 -0
- package/dist/reglow/modules/log/router.d.ts +9 -0
- package/dist/reglow/modules/log/router.js +7 -0
- package/dist/reglow/modules/log/router.js.map +1 -0
- package/dist/reglow/modules/material/controller.d.ts +3 -0
- package/dist/reglow/modules/material/controller.js +400 -0
- package/dist/reglow/modules/material/controller.js.map +1 -0
- package/dist/reglow/modules/material/repository.d.ts +37 -0
- package/dist/reglow/modules/material/repository.js +183 -0
- package/dist/reglow/modules/material/repository.js.map +1 -0
- package/dist/reglow/modules/material/router.d.ts +14 -0
- package/dist/reglow/modules/material/router.js +11 -0
- package/dist/reglow/modules/material/router.js.map +1 -0
- package/dist/reglow/modules/material/schema.d.ts +40 -0
- package/dist/reglow/modules/material/schema.js +34 -0
- package/dist/reglow/modules/material/schema.js.map +1 -0
- package/dist/reglow/modules/material/service.d.ts +85 -0
- package/dist/reglow/modules/material/service.js +292 -0
- package/dist/reglow/modules/material/service.js.map +1 -0
- package/dist/reglow/modules/menu/controller.d.ts +6 -0
- package/dist/reglow/modules/menu/controller.js +69 -0
- package/dist/reglow/modules/menu/controller.js.map +1 -0
- package/dist/reglow/modules/menu/repository.d.ts +14 -0
- package/dist/reglow/modules/menu/repository.js +37 -0
- package/dist/reglow/modules/menu/repository.js.map +1 -0
- package/dist/reglow/modules/menu/router.d.ts +9 -0
- package/dist/reglow/modules/menu/router.js +7 -0
- package/dist/reglow/modules/menu/router.js.map +1 -0
- package/dist/reglow/modules/menu/schema.d.ts +39 -0
- package/dist/reglow/modules/menu/schema.js +37 -0
- package/dist/reglow/modules/menu/schema.js.map +1 -0
- package/dist/reglow/modules/menu/service.d.ts +31 -0
- package/dist/reglow/modules/menu/service.js +89 -0
- package/dist/reglow/modules/menu/service.js.map +1 -0
- package/dist/reglow/modules/message/controller.d.ts +7 -0
- package/dist/reglow/modules/message/controller.js +260 -0
- package/dist/reglow/modules/message/controller.js.map +1 -0
- package/dist/reglow/modules/message/repository.d.ts +27 -0
- package/dist/reglow/modules/message/repository.js +145 -0
- package/dist/reglow/modules/message/repository.js.map +1 -0
- package/dist/reglow/modules/message/router.d.ts +13 -0
- package/dist/reglow/modules/message/router.js +8 -0
- package/dist/reglow/modules/message/router.js.map +1 -0
- package/dist/reglow/modules/message/schema.d.ts +39 -0
- package/dist/reglow/modules/message/schema.js +37 -0
- package/dist/reglow/modules/message/schema.js.map +1 -0
- package/dist/reglow/modules/message/service.d.ts +70 -0
- package/dist/reglow/modules/message/service.js +199 -0
- package/dist/reglow/modules/message/service.js.map +1 -0
- package/dist/reglow/modules/notice/controller.d.ts +6 -0
- package/dist/reglow/modules/notice/controller.js +123 -0
- package/dist/reglow/modules/notice/controller.js.map +1 -0
- package/dist/reglow/modules/notice/repository.d.ts +25 -0
- package/dist/reglow/modules/notice/repository.js +145 -0
- package/dist/reglow/modules/notice/repository.js.map +1 -0
- package/dist/reglow/modules/notice/router.d.ts +9 -0
- package/dist/reglow/modules/notice/router.js +7 -0
- package/dist/reglow/modules/notice/router.js.map +1 -0
- package/dist/reglow/modules/notice/schema.d.ts +23 -0
- package/dist/reglow/modules/notice/schema.js +22 -0
- package/dist/reglow/modules/notice/schema.js.map +1 -0
- package/dist/reglow/modules/notice/service.d.ts +45 -0
- package/dist/reglow/modules/notice/service.js +149 -0
- package/dist/reglow/modules/notice/service.js.map +1 -0
- package/dist/reglow/modules/payment/controller.d.ts +6 -0
- package/dist/reglow/modules/payment/controller.js +186 -0
- package/dist/reglow/modules/payment/controller.js.map +1 -0
- package/dist/reglow/modules/payment/router.d.ts +10 -0
- package/dist/reglow/modules/payment/router.js +8 -0
- package/dist/reglow/modules/payment/router.js.map +1 -0
- package/dist/reglow/modules/payment/schema.d.ts +52 -0
- package/dist/reglow/modules/payment/schema.js +43 -0
- package/dist/reglow/modules/payment/schema.js.map +1 -0
- package/dist/reglow/modules/payment/service.d.ts +28 -0
- package/dist/reglow/modules/payment/service.js +219 -0
- package/dist/reglow/modules/payment/service.js.map +1 -0
- package/dist/reglow/modules/photo/controller.d.ts +2 -0
- package/dist/reglow/modules/photo/controller.js +323 -0
- package/dist/reglow/modules/photo/controller.js.map +1 -0
- package/dist/reglow/modules/photo/controller_client.d.ts +2 -0
- package/dist/reglow/modules/photo/controller_client.js +293 -0
- package/dist/reglow/modules/photo/controller_client.js.map +1 -0
- package/dist/reglow/modules/photo/repository.d.ts +50 -0
- package/dist/reglow/modules/photo/repository.js +240 -0
- package/dist/reglow/modules/photo/repository.js.map +1 -0
- package/dist/reglow/modules/photo/router.d.ts +15 -0
- package/dist/reglow/modules/photo/router.js +10 -0
- package/dist/reglow/modules/photo/router.js.map +1 -0
- package/dist/reglow/modules/photo/schema.d.ts +69 -0
- package/dist/reglow/modules/photo/schema.js +66 -0
- package/dist/reglow/modules/photo/schema.js.map +1 -0
- package/dist/reglow/modules/photo/service.d.ts +98 -0
- package/dist/reglow/modules/photo/service.js +295 -0
- package/dist/reglow/modules/photo/service.js.map +1 -0
- package/dist/reglow/modules/post/controller.d.ts +6 -0
- package/dist/reglow/modules/post/controller.js +61 -0
- package/dist/reglow/modules/post/controller.js.map +1 -0
- package/dist/reglow/modules/post/repository.d.ts +12 -0
- package/dist/reglow/modules/post/repository.js +46 -0
- package/dist/reglow/modules/post/repository.js.map +1 -0
- package/dist/reglow/modules/post/router.d.ts +9 -0
- package/dist/reglow/modules/post/router.js +7 -0
- package/dist/reglow/modules/post/router.js.map +1 -0
- package/dist/reglow/modules/post/schema.d.ts +19 -0
- package/dist/reglow/modules/post/schema.js +18 -0
- package/dist/reglow/modules/post/schema.js.map +1 -0
- package/dist/reglow/modules/post/service.d.ts +18 -0
- package/dist/reglow/modules/post/service.js +44 -0
- package/dist/reglow/modules/post/service.js.map +1 -0
- package/dist/reglow/modules/role/controller.d.ts +6 -0
- package/dist/reglow/modules/role/controller.js +103 -0
- package/dist/reglow/modules/role/controller.js.map +1 -0
- package/dist/reglow/modules/role/repository.d.ts +22 -0
- package/dist/reglow/modules/role/repository.js +84 -0
- package/dist/reglow/modules/role/repository.js.map +1 -0
- package/dist/reglow/modules/role/router.d.ts +9 -0
- package/dist/reglow/modules/role/router.js +7 -0
- package/dist/reglow/modules/role/router.js.map +1 -0
- package/dist/reglow/modules/role/schema.d.ts +32 -0
- package/dist/reglow/modules/role/schema.js +29 -0
- package/dist/reglow/modules/role/schema.js.map +1 -0
- package/dist/reglow/modules/role/service.d.ts +22 -0
- package/dist/reglow/modules/role/service.js +72 -0
- package/dist/reglow/modules/role/service.js.map +1 -0
- package/dist/reglow/modules/user/controller.d.ts +6 -0
- package/dist/reglow/modules/user/controller.js +126 -0
- package/dist/reglow/modules/user/controller.js.map +1 -0
- package/dist/reglow/modules/user/controller_client.d.ts +2 -0
- package/dist/reglow/modules/user/controller_client.js +291 -0
- package/dist/reglow/modules/user/controller_client.js.map +1 -0
- package/dist/reglow/modules/user/repository.d.ts +12 -0
- package/dist/reglow/modules/user/repository.js +71 -0
- package/dist/reglow/modules/user/repository.js.map +1 -0
- package/dist/reglow/modules/user/router.d.ts +16 -0
- package/dist/reglow/modules/user/router.js +11 -0
- package/dist/reglow/modules/user/router.js.map +1 -0
- package/dist/reglow/modules/user/schema.d.ts +92 -0
- package/dist/reglow/modules/user/schema.js +82 -0
- package/dist/reglow/modules/user/schema.js.map +1 -0
- package/dist/reglow/modules/user/service.d.ts +43 -0
- package/dist/reglow/modules/user/service.js +311 -0
- package/dist/reglow/modules/user/service.js.map +1 -0
- package/dist/reglow/modules/video/controller.d.ts +2 -0
- package/dist/reglow/modules/video/controller.js +254 -0
- package/dist/reglow/modules/video/controller.js.map +1 -0
- package/dist/reglow/modules/video/repository.d.ts +38 -0
- package/dist/reglow/modules/video/repository.js +186 -0
- package/dist/reglow/modules/video/repository.js.map +1 -0
- package/dist/reglow/modules/video/router.d.ts +10 -0
- package/dist/reglow/modules/video/router.js +8 -0
- package/dist/reglow/modules/video/router.js.map +1 -0
- package/dist/reglow/modules/video/schema.d.ts +62 -0
- package/dist/reglow/modules/video/schema.js +61 -0
- package/dist/reglow/modules/video/schema.js.map +1 -0
- package/dist/reglow/modules/video/service.d.ts +80 -0
- package/dist/reglow/modules/video/service.js +251 -0
- package/dist/reglow/modules/video/service.js.map +1 -0
- package/dist/reglow/scripts/init-data.d.ts +44 -0
- package/dist/reglow/scripts/init-data.js +472 -0
- package/dist/reglow/scripts/init-data.js.map +1 -0
- package/dist/reglow/scripts/remove-business-menu.d.ts +1 -0
- package/dist/reglow/scripts/remove-business-menu.js +124 -0
- package/dist/reglow/scripts/remove-business-menu.js.map +1 -0
- package/dist/reglow/scripts/schema.d.ts +9 -0
- package/dist/reglow/scripts/schema.js +746 -0
- package/dist/reglow/scripts/schema.js.map +1 -0
- package/dist/reglow/scripts/sync-menu-mysql-to-sqlite.d.ts +1 -0
- package/dist/reglow/scripts/sync-menu-mysql-to-sqlite.js +304 -0
- package/dist/reglow/scripts/sync-menu-mysql-to-sqlite.js.map +1 -0
- package/dist/server.d.ts +1 -0
- package/dist/server.js +162 -0
- package/dist/server.js.map +1 -0
- package/package.json +79 -0
|
@@ -0,0 +1,746 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 数据库建表(Knex schema builder)
|
|
3
|
+
* 对应 backend-python 的 scripts/init_db.py(Base.metadata.create_all)
|
|
4
|
+
*
|
|
5
|
+
* 说明:
|
|
6
|
+
* - 幂等:全部使用 hasTable 判断后再建表
|
|
7
|
+
* - 主键:SQLite 用 increments(INTEGER PRIMARY KEY AUTOINCREMENT),MySQL 用 bigIncrements(BIGINT)
|
|
8
|
+
* - JSON 字段统一用 text 存储,跨 MySQL/SQLite 兼容
|
|
9
|
+
*/
|
|
10
|
+
import { knex } from "../core/database.js";
|
|
11
|
+
import { logger } from "../core/logging.js";
|
|
12
|
+
import settings from "../core/config.js";
|
|
13
|
+
const IS_SQLITE = settings.DB_DRIVER === "sqlite";
|
|
14
|
+
function pk(t) {
|
|
15
|
+
return IS_SQLITE ? t.increments("id") : t.bigIncrements("id");
|
|
16
|
+
}
|
|
17
|
+
function bigint(t, name) {
|
|
18
|
+
return IS_SQLITE ? t.integer(name) : t.bigInteger(name);
|
|
19
|
+
}
|
|
20
|
+
function jsonCol(t, name) {
|
|
21
|
+
// SQLite 无原生 JSON 类型,统一 text
|
|
22
|
+
return t.text(name);
|
|
23
|
+
}
|
|
24
|
+
function addTimestamp(t) {
|
|
25
|
+
t.dateTime("created_at").notNullable().defaultTo(knex.fn.now());
|
|
26
|
+
t.dateTime("updated_at");
|
|
27
|
+
}
|
|
28
|
+
function addSoftDelete(t) {
|
|
29
|
+
t.dateTime("deleted_at");
|
|
30
|
+
}
|
|
31
|
+
const TABLES = [
|
|
32
|
+
// ─────────────────────────── sys_* 系统表 ───────────────────────────
|
|
33
|
+
{
|
|
34
|
+
name: "sys_agreement",
|
|
35
|
+
build(t) {
|
|
36
|
+
pk(t);
|
|
37
|
+
t.string("title", 200).notNullable();
|
|
38
|
+
t.string("code", 100).notNullable().index();
|
|
39
|
+
t.string("type", 50).notNullable().defaultTo("general");
|
|
40
|
+
t.text("content");
|
|
41
|
+
t.string("version", 20);
|
|
42
|
+
t.integer("status");
|
|
43
|
+
t.integer("sort");
|
|
44
|
+
t.boolean("is_published").defaultTo(false);
|
|
45
|
+
t.dateTime("published_at");
|
|
46
|
+
t.string("published_version", 20);
|
|
47
|
+
addTimestamp(t);
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "sys_agreement_history",
|
|
52
|
+
build(t) {
|
|
53
|
+
pk(t);
|
|
54
|
+
t.integer("agreement_id").notNullable();
|
|
55
|
+
t.string("code", 100).notNullable().index();
|
|
56
|
+
t.string("title", 200).notNullable();
|
|
57
|
+
t.string("type", 50).notNullable();
|
|
58
|
+
t.text("content");
|
|
59
|
+
t.string("version", 20).notNullable();
|
|
60
|
+
t.integer("status");
|
|
61
|
+
t.boolean("is_latest").index();
|
|
62
|
+
addTimestamp(t);
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: "sys_config",
|
|
67
|
+
build(t) {
|
|
68
|
+
pk(t);
|
|
69
|
+
t.string("name", 100).notNullable();
|
|
70
|
+
t.string("key", 100).notNullable().unique();
|
|
71
|
+
t.text("value");
|
|
72
|
+
t.integer("type");
|
|
73
|
+
t.string("remark", 255);
|
|
74
|
+
addTimestamp(t);
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: "sys_dept",
|
|
79
|
+
build(t) {
|
|
80
|
+
pk(t);
|
|
81
|
+
bigint(t, "parent_id");
|
|
82
|
+
t.string("name", 50).notNullable();
|
|
83
|
+
t.string("leader", 50);
|
|
84
|
+
t.integer("sort");
|
|
85
|
+
t.integer("status");
|
|
86
|
+
addTimestamp(t);
|
|
87
|
+
addSoftDelete(t);
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: "sys_dict_data",
|
|
92
|
+
build(t) {
|
|
93
|
+
pk(t);
|
|
94
|
+
bigint(t, "type_id").notNullable();
|
|
95
|
+
t.string("label", 100).notNullable();
|
|
96
|
+
t.string("value", 100).notNullable();
|
|
97
|
+
t.integer("sort");
|
|
98
|
+
t.integer("status");
|
|
99
|
+
t.string("remark", 255);
|
|
100
|
+
addTimestamp(t);
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: "sys_dict_type",
|
|
105
|
+
build(t) {
|
|
106
|
+
pk(t);
|
|
107
|
+
t.string("name", 50).notNullable();
|
|
108
|
+
t.string("code", 50).notNullable().unique();
|
|
109
|
+
t.integer("source");
|
|
110
|
+
t.integer("status");
|
|
111
|
+
t.string("remark", 255);
|
|
112
|
+
addTimestamp(t);
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: "sys_employee",
|
|
117
|
+
build(t) {
|
|
118
|
+
pk(t);
|
|
119
|
+
t.string("username", 32).notNullable().unique();
|
|
120
|
+
t.string("password_hash", 255).notNullable();
|
|
121
|
+
t.string("nickname", 50);
|
|
122
|
+
t.string("real_name", 50);
|
|
123
|
+
t.string("avatar", 512);
|
|
124
|
+
t.integer("gender").defaultTo(0);
|
|
125
|
+
t.string("email", 100);
|
|
126
|
+
t.string("phone", 20);
|
|
127
|
+
t.string("employee_no", 32);
|
|
128
|
+
bigint(t, "dept_id");
|
|
129
|
+
t.string("post_ids", 500);
|
|
130
|
+
bigint(t, "superior_id");
|
|
131
|
+
t.string("entry_date", 10);
|
|
132
|
+
t.integer("work_status").defaultTo(1);
|
|
133
|
+
t.integer("employment_type").defaultTo(1);
|
|
134
|
+
t.string("job_level", 20);
|
|
135
|
+
t.string("job_position", 50);
|
|
136
|
+
t.string("job_title", 50);
|
|
137
|
+
t.integer("status").defaultTo(1);
|
|
138
|
+
t.boolean("is_agent").defaultTo(false);
|
|
139
|
+
t.boolean("is_super_admin").defaultTo(false);
|
|
140
|
+
t.integer("login_fail_count").defaultTo(0);
|
|
141
|
+
t.dateTime("lock_until");
|
|
142
|
+
t.dateTime("last_login_at");
|
|
143
|
+
t.string("last_login_ip", 45);
|
|
144
|
+
t.string("remark", 500);
|
|
145
|
+
addTimestamp(t);
|
|
146
|
+
addSoftDelete(t);
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
name: "sys_employee_role",
|
|
151
|
+
build(t) {
|
|
152
|
+
pk(t);
|
|
153
|
+
bigint(t, "employee_id").notNullable();
|
|
154
|
+
bigint(t, "role_id").notNullable();
|
|
155
|
+
t.unique(["employee_id", "role_id"]);
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
name: "sys_employee_dept",
|
|
160
|
+
build(t) {
|
|
161
|
+
pk(t);
|
|
162
|
+
bigint(t, "employee_id").notNullable();
|
|
163
|
+
bigint(t, "dept_id").notNullable();
|
|
164
|
+
t.unique(["employee_id", "dept_id"]);
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: "sys_login_log",
|
|
169
|
+
build(t) {
|
|
170
|
+
pk(t);
|
|
171
|
+
bigint(t, "admin_id");
|
|
172
|
+
t.string("username", 32);
|
|
173
|
+
t.integer("status");
|
|
174
|
+
t.string("ip", 45);
|
|
175
|
+
t.string("location", 100);
|
|
176
|
+
t.string("browser", 100);
|
|
177
|
+
t.string("os", 100);
|
|
178
|
+
t.string("device_type", 20);
|
|
179
|
+
t.string("session_id", 64);
|
|
180
|
+
t.string("message", 255);
|
|
181
|
+
t.dateTime("created_at").defaultTo(knex.fn.now());
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
name: "sys_material",
|
|
186
|
+
build(t) {
|
|
187
|
+
pk(t);
|
|
188
|
+
bigint(t, "user_id");
|
|
189
|
+
t.string("name", 200).notNullable();
|
|
190
|
+
t.string("type", 20);
|
|
191
|
+
t.string("url", 512).notNullable();
|
|
192
|
+
t.string("thumbnail_url", 512);
|
|
193
|
+
bigint(t, "size");
|
|
194
|
+
t.string("mime_type", 100);
|
|
195
|
+
t.integer("width");
|
|
196
|
+
t.integer("height");
|
|
197
|
+
t.string("storage", 20);
|
|
198
|
+
t.string("source", 50);
|
|
199
|
+
t.dateTime("expire_at");
|
|
200
|
+
addTimestamp(t);
|
|
201
|
+
addSoftDelete(t);
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
name: "sys_material_group",
|
|
206
|
+
build(t) {
|
|
207
|
+
pk(t);
|
|
208
|
+
bigint(t, "parent_id");
|
|
209
|
+
t.string("name", 50).notNullable();
|
|
210
|
+
t.integer("sort");
|
|
211
|
+
addTimestamp(t);
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
name: "sys_material_group_relation",
|
|
216
|
+
build(t) {
|
|
217
|
+
pk(t);
|
|
218
|
+
bigint(t, "material_id").notNullable().index();
|
|
219
|
+
bigint(t, "group_id").notNullable().index();
|
|
220
|
+
t.unique(["material_id", "group_id"]);
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
name: "sys_menu",
|
|
225
|
+
build(t) {
|
|
226
|
+
pk(t);
|
|
227
|
+
bigint(t, "parent_id");
|
|
228
|
+
t.string("name", 50).notNullable();
|
|
229
|
+
t.string("type", 1).notNullable();
|
|
230
|
+
t.string("icon", 100);
|
|
231
|
+
t.string("path", 200);
|
|
232
|
+
t.string("permission", 100);
|
|
233
|
+
t.integer("sort");
|
|
234
|
+
t.integer("visible");
|
|
235
|
+
t.integer("cache");
|
|
236
|
+
t.integer("status");
|
|
237
|
+
addTimestamp(t);
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
name: "sys_message",
|
|
242
|
+
build(t) {
|
|
243
|
+
pk(t);
|
|
244
|
+
bigint(t, "receiver_id").notNullable().index();
|
|
245
|
+
t.string("category", 32).notNullable().index();
|
|
246
|
+
t.string("template_code", 64);
|
|
247
|
+
t.string("title", 200).notNullable();
|
|
248
|
+
t.text("content");
|
|
249
|
+
t.integer("level");
|
|
250
|
+
t.string("biz_type", 32);
|
|
251
|
+
bigint(t, "biz_id");
|
|
252
|
+
t.string("link_url", 255);
|
|
253
|
+
t.boolean("is_read").index();
|
|
254
|
+
t.dateTime("read_at");
|
|
255
|
+
addTimestamp(t);
|
|
256
|
+
addSoftDelete(t);
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
name: "sys_message_template",
|
|
261
|
+
build(t) {
|
|
262
|
+
pk(t);
|
|
263
|
+
t.string("code", 64).notNullable().unique();
|
|
264
|
+
t.string("name", 100).notNullable();
|
|
265
|
+
t.string("category", 32).notNullable();
|
|
266
|
+
t.string("title_tpl", 200).notNullable();
|
|
267
|
+
t.text("content_tpl").notNullable();
|
|
268
|
+
t.integer("level");
|
|
269
|
+
t.integer("status");
|
|
270
|
+
t.string("remark", 255);
|
|
271
|
+
addTimestamp(t);
|
|
272
|
+
addSoftDelete(t);
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
name: "sys_notice",
|
|
277
|
+
build(t) {
|
|
278
|
+
pk(t);
|
|
279
|
+
t.string("title", 200).notNullable();
|
|
280
|
+
t.text("content");
|
|
281
|
+
t.integer("type");
|
|
282
|
+
t.integer("level");
|
|
283
|
+
t.integer("scope");
|
|
284
|
+
t.text("scope_depts");
|
|
285
|
+
t.integer("status");
|
|
286
|
+
bigint(t, "publisher_id");
|
|
287
|
+
t.dateTime("published_at");
|
|
288
|
+
addTimestamp(t);
|
|
289
|
+
addSoftDelete(t);
|
|
290
|
+
},
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
name: "sys_notice_read",
|
|
294
|
+
build(t) {
|
|
295
|
+
pk(t);
|
|
296
|
+
bigint(t, "notice_id").notNullable().index();
|
|
297
|
+
bigint(t, "admin_id").notNullable().index();
|
|
298
|
+
t.dateTime("read_at");
|
|
299
|
+
addTimestamp(t);
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
name: "sys_operation_log",
|
|
304
|
+
build(t) {
|
|
305
|
+
pk(t);
|
|
306
|
+
bigint(t, "admin_id");
|
|
307
|
+
t.string("admin_name", 50);
|
|
308
|
+
t.string("module", 50);
|
|
309
|
+
t.string("action", 50);
|
|
310
|
+
t.string("method", 10);
|
|
311
|
+
t.string("url", 255);
|
|
312
|
+
t.text("params");
|
|
313
|
+
t.text("result");
|
|
314
|
+
t.string("ip", 45);
|
|
315
|
+
t.string("user_agent", 500);
|
|
316
|
+
jsonCol(t, "detail");
|
|
317
|
+
t.dateTime("created_at").defaultTo(knex.fn.now());
|
|
318
|
+
},
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
name: "sys_post",
|
|
322
|
+
build(t) {
|
|
323
|
+
pk(t);
|
|
324
|
+
t.string("code", 50).notNullable().unique();
|
|
325
|
+
t.string("name", 50).notNullable();
|
|
326
|
+
t.integer("sort");
|
|
327
|
+
t.integer("status");
|
|
328
|
+
addTimestamp(t);
|
|
329
|
+
addSoftDelete(t);
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
name: "sys_role",
|
|
334
|
+
build(t) {
|
|
335
|
+
pk(t);
|
|
336
|
+
t.string("name", 50).notNullable().unique();
|
|
337
|
+
t.string("code", 50).notNullable().unique();
|
|
338
|
+
t.string("description", 255);
|
|
339
|
+
t.integer("data_scope");
|
|
340
|
+
t.integer("sort");
|
|
341
|
+
t.integer("status");
|
|
342
|
+
addTimestamp(t);
|
|
343
|
+
addSoftDelete(t);
|
|
344
|
+
},
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
name: "sys_role_dept",
|
|
348
|
+
build(t) {
|
|
349
|
+
pk(t);
|
|
350
|
+
bigint(t, "role_id").notNullable();
|
|
351
|
+
bigint(t, "dept_id").notNullable();
|
|
352
|
+
},
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
name: "sys_role_menu",
|
|
356
|
+
build(t) {
|
|
357
|
+
pk(t);
|
|
358
|
+
bigint(t, "role_id").notNullable();
|
|
359
|
+
bigint(t, "menu_id").notNullable();
|
|
360
|
+
},
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
name: "sys_setting",
|
|
364
|
+
build(t) {
|
|
365
|
+
pk(t);
|
|
366
|
+
t.string("group_key", 50).notNullable();
|
|
367
|
+
t.string("key", 100).notNullable();
|
|
368
|
+
t.text("value");
|
|
369
|
+
addTimestamp(t);
|
|
370
|
+
},
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
name: "sys_user",
|
|
374
|
+
build(t) {
|
|
375
|
+
pk(t);
|
|
376
|
+
t.string("username", 32).unique();
|
|
377
|
+
t.string("password_hash", 255).notNullable();
|
|
378
|
+
t.string("nickname", 50);
|
|
379
|
+
t.string("real_name", 50);
|
|
380
|
+
t.string("avatar", 512);
|
|
381
|
+
t.integer("gender").defaultTo(0);
|
|
382
|
+
t.string("birthday", 10);
|
|
383
|
+
t.string("phone", 20).unique();
|
|
384
|
+
t.string("email", 100).unique();
|
|
385
|
+
t.string("region", 200);
|
|
386
|
+
t.string("bio", 500);
|
|
387
|
+
t.string("source", 20);
|
|
388
|
+
t.integer("status").defaultTo(1);
|
|
389
|
+
t.boolean("is_verified").defaultTo(false);
|
|
390
|
+
t.integer("vip_level").defaultTo(0);
|
|
391
|
+
t.integer("login_fail_count").defaultTo(0);
|
|
392
|
+
t.dateTime("lock_until");
|
|
393
|
+
t.dateTime("last_login_at");
|
|
394
|
+
t.string("last_login_ip", 45);
|
|
395
|
+
t.dateTime("registered_at");
|
|
396
|
+
t.string("remark", 500);
|
|
397
|
+
addTimestamp(t);
|
|
398
|
+
addSoftDelete(t);
|
|
399
|
+
},
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
name: "sys_user_agreement",
|
|
403
|
+
build(t) {
|
|
404
|
+
pk(t);
|
|
405
|
+
t.integer("user_id").notNullable().index();
|
|
406
|
+
t.string("agreement_code", 100).notNullable().index();
|
|
407
|
+
t.string("agreed_version", 20).notNullable();
|
|
408
|
+
t.text("content_snapshot");
|
|
409
|
+
addTimestamp(t);
|
|
410
|
+
},
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
name: "sys_user_oauth",
|
|
414
|
+
build(t) {
|
|
415
|
+
pk(t);
|
|
416
|
+
bigint(t, "user_id").notNullable();
|
|
417
|
+
t.string("provider", 20).notNullable();
|
|
418
|
+
t.string("openid", 128).notNullable();
|
|
419
|
+
t.string("union_id", 128);
|
|
420
|
+
t.string("nickname", 100);
|
|
421
|
+
t.string("avatar", 512);
|
|
422
|
+
t.boolean("is_bound").defaultTo(true);
|
|
423
|
+
addTimestamp(t);
|
|
424
|
+
},
|
|
425
|
+
},
|
|
426
|
+
// ─────────────────────────── cms_* 内容表 ───────────────────────────
|
|
427
|
+
{
|
|
428
|
+
name: "cms_article",
|
|
429
|
+
build(t) {
|
|
430
|
+
pk(t);
|
|
431
|
+
bigint(t, "category_id");
|
|
432
|
+
bigint(t, "collection_id");
|
|
433
|
+
t.string("title", 200).notNullable();
|
|
434
|
+
t.text("summary");
|
|
435
|
+
t.text("content");
|
|
436
|
+
t.string("cover_image", 500);
|
|
437
|
+
t.string("author", 50);
|
|
438
|
+
t.string("source", 100);
|
|
439
|
+
t.integer("status").defaultTo(0);
|
|
440
|
+
t.integer("is_top").defaultTo(0);
|
|
441
|
+
t.integer("view_count").defaultTo(0);
|
|
442
|
+
t.dateTime("published_at");
|
|
443
|
+
bigint(t, "creator_id");
|
|
444
|
+
addTimestamp(t);
|
|
445
|
+
addSoftDelete(t);
|
|
446
|
+
},
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
name: "cms_article_category",
|
|
450
|
+
build(t) {
|
|
451
|
+
pk(t);
|
|
452
|
+
t.string("name", 50).notNullable();
|
|
453
|
+
t.string("code", 50).notNullable().unique();
|
|
454
|
+
t.string("description", 255);
|
|
455
|
+
t.integer("sort").defaultTo(0);
|
|
456
|
+
t.integer("status").defaultTo(1);
|
|
457
|
+
addTimestamp(t);
|
|
458
|
+
addSoftDelete(t);
|
|
459
|
+
},
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
name: "cms_article_collection",
|
|
463
|
+
build(t) {
|
|
464
|
+
pk(t);
|
|
465
|
+
t.string("name", 100).notNullable();
|
|
466
|
+
t.string("code", 64);
|
|
467
|
+
t.string("description", 500);
|
|
468
|
+
t.string("cover", 500);
|
|
469
|
+
t.integer("sort").defaultTo(0);
|
|
470
|
+
addTimestamp(t);
|
|
471
|
+
},
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
name: "cms_photo",
|
|
475
|
+
build(t) {
|
|
476
|
+
pk(t);
|
|
477
|
+
bigint(t, "album_id").notNullable().index();
|
|
478
|
+
bigint(t, "category_id");
|
|
479
|
+
bigint(t, "material_id");
|
|
480
|
+
t.string("title", 200);
|
|
481
|
+
t.string("alias", 200);
|
|
482
|
+
t.text("description");
|
|
483
|
+
t.string("url", 512).notNullable();
|
|
484
|
+
t.string("thumbnail_url", 512);
|
|
485
|
+
t.boolean("is_cover").defaultTo(false);
|
|
486
|
+
t.integer("status").defaultTo(1);
|
|
487
|
+
t.integer("sort").defaultTo(0);
|
|
488
|
+
t.integer("width");
|
|
489
|
+
t.integer("height");
|
|
490
|
+
bigint(t, "size").defaultTo(0);
|
|
491
|
+
t.string("mime_type", 100);
|
|
492
|
+
bigint(t, "user_id").index();
|
|
493
|
+
bigint(t, "creator_id").index();
|
|
494
|
+
t.integer("dpi");
|
|
495
|
+
t.string("source", 50);
|
|
496
|
+
t.dateTime("expire_at");
|
|
497
|
+
addTimestamp(t);
|
|
498
|
+
addSoftDelete(t);
|
|
499
|
+
},
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
name: "cms_photo_album",
|
|
503
|
+
build(t) {
|
|
504
|
+
pk(t);
|
|
505
|
+
t.string("name", 100).notNullable();
|
|
506
|
+
t.string("code", 64);
|
|
507
|
+
t.string("description", 500);
|
|
508
|
+
t.string("cover", 500);
|
|
509
|
+
bigint(t, "cover_photo_id");
|
|
510
|
+
bigint(t, "category_id");
|
|
511
|
+
t.integer("sort").defaultTo(0);
|
|
512
|
+
bigint(t, "material_group_id");
|
|
513
|
+
t.boolean("is_user_album").defaultTo(false);
|
|
514
|
+
addTimestamp(t);
|
|
515
|
+
},
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
name: "cms_photo_category",
|
|
519
|
+
build(t) {
|
|
520
|
+
pk(t);
|
|
521
|
+
t.string("name", 50).notNullable();
|
|
522
|
+
t.string("code", 50).notNullable().unique();
|
|
523
|
+
t.string("description", 255);
|
|
524
|
+
t.integer("sort").defaultTo(0);
|
|
525
|
+
t.integer("status").defaultTo(1);
|
|
526
|
+
addTimestamp(t);
|
|
527
|
+
addSoftDelete(t);
|
|
528
|
+
},
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
name: "cms_video",
|
|
532
|
+
build(t) {
|
|
533
|
+
pk(t);
|
|
534
|
+
bigint(t, "category_id");
|
|
535
|
+
bigint(t, "collection_id");
|
|
536
|
+
t.string("title", 200).notNullable();
|
|
537
|
+
t.text("description");
|
|
538
|
+
t.string("cover_image", 500);
|
|
539
|
+
t.string("video_url", 500);
|
|
540
|
+
t.integer("duration").defaultTo(0);
|
|
541
|
+
t.integer("status").defaultTo(0);
|
|
542
|
+
t.integer("view_count").defaultTo(0);
|
|
543
|
+
t.integer("sort").defaultTo(0);
|
|
544
|
+
t.dateTime("published_at");
|
|
545
|
+
bigint(t, "creator_id");
|
|
546
|
+
addTimestamp(t);
|
|
547
|
+
addSoftDelete(t);
|
|
548
|
+
},
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
name: "cms_video_category",
|
|
552
|
+
build(t) {
|
|
553
|
+
pk(t);
|
|
554
|
+
t.string("name", 50).notNullable();
|
|
555
|
+
t.string("code", 50).notNullable().unique();
|
|
556
|
+
t.string("description", 255);
|
|
557
|
+
t.integer("sort").defaultTo(0);
|
|
558
|
+
t.integer("status").defaultTo(1);
|
|
559
|
+
addTimestamp(t);
|
|
560
|
+
addSoftDelete(t);
|
|
561
|
+
},
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
name: "cms_video_collection",
|
|
565
|
+
build(t) {
|
|
566
|
+
pk(t);
|
|
567
|
+
t.string("name", 100).notNullable();
|
|
568
|
+
t.string("code", 64);
|
|
569
|
+
t.string("description", 500);
|
|
570
|
+
t.string("cover", 500);
|
|
571
|
+
t.integer("sort").defaultTo(0);
|
|
572
|
+
addTimestamp(t);
|
|
573
|
+
},
|
|
574
|
+
},
|
|
575
|
+
// ─────────────────────────── cs_* 智能客服表 ───────────────────────────
|
|
576
|
+
{
|
|
577
|
+
name: "cs_config",
|
|
578
|
+
build(t) {
|
|
579
|
+
pk(t);
|
|
580
|
+
t.string("app_id", 64).notNullable().unique().index();
|
|
581
|
+
t.string("app_name", 100).notNullable();
|
|
582
|
+
t.text("welcome_message");
|
|
583
|
+
t.text("system_prompt");
|
|
584
|
+
t.string("provider", 32).defaultTo("deepseek");
|
|
585
|
+
t.string("model", 64).defaultTo("deepseek-v4-flash");
|
|
586
|
+
t.string("vision_model", 64);
|
|
587
|
+
t.string("embedding_provider", 32).defaultTo("aliyun");
|
|
588
|
+
t.string("embedding_model", 64).defaultTo("text-embedding-v3");
|
|
589
|
+
jsonCol(t, "business_hours");
|
|
590
|
+
t.string("agent_mode", 20).defaultTo("pool");
|
|
591
|
+
jsonCol(t, "agent_ids");
|
|
592
|
+
t.integer("is_active").defaultTo(1);
|
|
593
|
+
bigint(t, "creator_id");
|
|
594
|
+
addTimestamp(t);
|
|
595
|
+
addSoftDelete(t);
|
|
596
|
+
},
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
name: "cs_knowledge_base",
|
|
600
|
+
build(t) {
|
|
601
|
+
pk(t);
|
|
602
|
+
t.string("name", 100).notNullable();
|
|
603
|
+
t.string("description", 255);
|
|
604
|
+
t.integer("status").defaultTo(1);
|
|
605
|
+
t.integer("chunk_count").defaultTo(0);
|
|
606
|
+
bigint(t, "creator_id");
|
|
607
|
+
addTimestamp(t);
|
|
608
|
+
addSoftDelete(t);
|
|
609
|
+
},
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
name: "cs_knowledge_chunk",
|
|
613
|
+
build(t) {
|
|
614
|
+
pk(t);
|
|
615
|
+
bigint(t, "kb_id").notNullable().index();
|
|
616
|
+
t.string("title", 200);
|
|
617
|
+
t.text("content").notNullable();
|
|
618
|
+
t.string("source_type", 20).defaultTo("manual");
|
|
619
|
+
t.string("source_file", 255);
|
|
620
|
+
t.integer("chunk_index").defaultTo(0);
|
|
621
|
+
t.string("embedding_model", 64);
|
|
622
|
+
t.integer("embedding_status").defaultTo(0);
|
|
623
|
+
addTimestamp(t);
|
|
624
|
+
addSoftDelete(t);
|
|
625
|
+
},
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
name: "cs_config_kb",
|
|
629
|
+
build(t) {
|
|
630
|
+
pk(t);
|
|
631
|
+
bigint(t, "config_id").notNullable().index();
|
|
632
|
+
bigint(t, "kb_id").notNullable().index();
|
|
633
|
+
t.unique(["config_id", "kb_id"]);
|
|
634
|
+
t.dateTime("created_at").defaultTo(knex.fn.now());
|
|
635
|
+
},
|
|
636
|
+
},
|
|
637
|
+
{
|
|
638
|
+
name: "cs_session",
|
|
639
|
+
build(t) {
|
|
640
|
+
pk(t);
|
|
641
|
+
t.string("session_id", 64).notNullable().unique().index();
|
|
642
|
+
t.string("app_id", 64).index();
|
|
643
|
+
t.string("visitor_id", 64).index();
|
|
644
|
+
t.string("visitor_name", 50);
|
|
645
|
+
t.string("visitor_avatar", 500);
|
|
646
|
+
t.string("source", 20).defaultTo("h5");
|
|
647
|
+
t.integer("status").defaultTo(0);
|
|
648
|
+
bigint(t, "agent_id");
|
|
649
|
+
t.dateTime("last_agent_active_at");
|
|
650
|
+
t.integer("message_count").defaultTo(0);
|
|
651
|
+
t.text("summary");
|
|
652
|
+
t.string("emotion", 20);
|
|
653
|
+
t.integer("rating");
|
|
654
|
+
addTimestamp(t);
|
|
655
|
+
addSoftDelete(t);
|
|
656
|
+
},
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
name: "cs_agent",
|
|
660
|
+
build(t) {
|
|
661
|
+
pk(t);
|
|
662
|
+
bigint(t, "employee_id").notNullable().unique().index();
|
|
663
|
+
t.string("display_name", 50);
|
|
664
|
+
t.string("avatar", 500);
|
|
665
|
+
t.string("agent_key", 64).unique().index();
|
|
666
|
+
t.integer("enabled").defaultTo(1);
|
|
667
|
+
t.string("status", 20).defaultTo("offline");
|
|
668
|
+
t.dateTime("last_active_at");
|
|
669
|
+
addTimestamp(t);
|
|
670
|
+
addSoftDelete(t);
|
|
671
|
+
},
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
name: "cs_message",
|
|
675
|
+
build(t) {
|
|
676
|
+
pk(t);
|
|
677
|
+
bigint(t, "session_id").notNullable().index();
|
|
678
|
+
t.string("role", 20).notNullable();
|
|
679
|
+
t.text("content").notNullable();
|
|
680
|
+
t.string("content_type", 20).defaultTo("text");
|
|
681
|
+
jsonCol(t, "knowledge_refs");
|
|
682
|
+
t.string("model", 64);
|
|
683
|
+
t.integer("tokens").defaultTo(0);
|
|
684
|
+
t.integer("response_time").defaultTo(0);
|
|
685
|
+
addTimestamp(t);
|
|
686
|
+
},
|
|
687
|
+
},
|
|
688
|
+
// ─────────────────────────── payment 支付表 ───────────────────────────
|
|
689
|
+
{
|
|
690
|
+
name: "payment_order",
|
|
691
|
+
build(t) {
|
|
692
|
+
pk(t);
|
|
693
|
+
t.string("out_trade_no", 64).notNullable().unique();
|
|
694
|
+
t.integer("user_id").index();
|
|
695
|
+
t.string("subject", 256).notNullable();
|
|
696
|
+
t.integer("amount_cents").notNullable();
|
|
697
|
+
t.string("status", 20).notNullable().defaultTo("pending");
|
|
698
|
+
t.string("provider", 20).notNullable();
|
|
699
|
+
t.string("trade_no", 64);
|
|
700
|
+
t.string("qr_code", 512);
|
|
701
|
+
t.dateTime("paid_at");
|
|
702
|
+
t.string("biz_type", 50);
|
|
703
|
+
t.string("biz_id", 100);
|
|
704
|
+
t.string("remark", 255);
|
|
705
|
+
addTimestamp(t);
|
|
706
|
+
},
|
|
707
|
+
},
|
|
708
|
+
// ─────────────────────────── biz_* 业务扩展表 ───────────────────────────
|
|
709
|
+
{
|
|
710
|
+
name: "biz_feedback",
|
|
711
|
+
build(t) {
|
|
712
|
+
pk(t);
|
|
713
|
+
t.string("name", 100).notNullable();
|
|
714
|
+
t.string("contact", 100);
|
|
715
|
+
t.text("content").notNullable();
|
|
716
|
+
t.text("reply");
|
|
717
|
+
t.integer("status").defaultTo(0).notNullable();
|
|
718
|
+
addTimestamp(t);
|
|
719
|
+
addSoftDelete(t);
|
|
720
|
+
},
|
|
721
|
+
},
|
|
722
|
+
];
|
|
723
|
+
export async function createTables() {
|
|
724
|
+
for (const spec of TABLES) {
|
|
725
|
+
const exists = await knex.schema.hasTable(spec.name);
|
|
726
|
+
if (exists)
|
|
727
|
+
continue;
|
|
728
|
+
await knex.schema.createTable(spec.name, spec.build);
|
|
729
|
+
logger.info(`[schema] 建表 ${spec.name}`);
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
export async function autoInitDatabase() {
|
|
733
|
+
try {
|
|
734
|
+
await createTables();
|
|
735
|
+
logger.info(`[schema] 数据库表初始化完成(${settings.DB_DRIVER})`);
|
|
736
|
+
// 建表后写入种子数据(幂等)
|
|
737
|
+
const { seedData } = await import("./init-data.js");
|
|
738
|
+
await seedData();
|
|
739
|
+
}
|
|
740
|
+
catch (e) {
|
|
741
|
+
logger.error("[schema] 数据库初始化失败:", e.message);
|
|
742
|
+
throw e;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
export { TABLES };
|
|
746
|
+
//# sourceMappingURL=schema.js.map
|