@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.
Files changed (405) hide show
  1. package/README.md +267 -0
  2. package/dist/index.d.ts +25 -0
  3. package/dist/index.js +28 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/reglow/common/errors.d.ts +92 -0
  6. package/dist/reglow/common/errors.js +127 -0
  7. package/dist/reglow/common/errors.js.map +1 -0
  8. package/dist/reglow/common/exception_handler.d.ts +14 -0
  9. package/dist/reglow/common/exception_handler.js +135 -0
  10. package/dist/reglow/common/exception_handler.js.map +1 -0
  11. package/dist/reglow/common/i18n.d.ts +15 -0
  12. package/dist/reglow/common/i18n.js +61 -0
  13. package/dist/reglow/common/i18n.js.map +1 -0
  14. package/dist/reglow/common/middleware.d.ts +5 -0
  15. package/dist/reglow/common/middleware.js +131 -0
  16. package/dist/reglow/common/middleware.js.map +1 -0
  17. package/dist/reglow/common/response.d.ts +28 -0
  18. package/dist/reglow/common/response.js +42 -0
  19. package/dist/reglow/common/response.js.map +1 -0
  20. package/dist/reglow/common/serialize.d.ts +6 -0
  21. package/dist/reglow/common/serialize.js +39 -0
  22. package/dist/reglow/common/serialize.js.map +1 -0
  23. package/dist/reglow/common/utils/date_utils.d.ts +10 -0
  24. package/dist/reglow/common/utils/date_utils.js +30 -0
  25. package/dist/reglow/common/utils/date_utils.js.map +1 -0
  26. package/dist/reglow/common/utils/parse-user-agent.d.ts +11 -0
  27. package/dist/reglow/common/utils/parse-user-agent.js +80 -0
  28. package/dist/reglow/common/utils/parse-user-agent.js.map +1 -0
  29. package/dist/reglow/common/utils/string_utils.d.ts +14 -0
  30. package/dist/reglow/common/utils/string_utils.js +31 -0
  31. package/dist/reglow/common/utils/string_utils.js.map +1 -0
  32. package/dist/reglow/core/auth.d.ts +15 -0
  33. package/dist/reglow/core/auth.js +184 -0
  34. package/dist/reglow/core/auth.js.map +1 -0
  35. package/dist/reglow/core/cache.d.ts +6 -0
  36. package/dist/reglow/core/cache.js +15 -0
  37. package/dist/reglow/core/cache.js.map +1 -0
  38. package/dist/reglow/core/config.d.ts +45 -0
  39. package/dist/reglow/core/config.js +83 -0
  40. package/dist/reglow/core/config.js.map +1 -0
  41. package/dist/reglow/core/data_scope.d.ts +21 -0
  42. package/dist/reglow/core/data_scope.js +20 -0
  43. package/dist/reglow/core/data_scope.js.map +1 -0
  44. package/dist/reglow/core/database.d.ts +4 -0
  45. package/dist/reglow/core/database.js +43 -0
  46. package/dist/reglow/core/database.js.map +1 -0
  47. package/dist/reglow/core/email.d.ts +12 -0
  48. package/dist/reglow/core/email.js +277 -0
  49. package/dist/reglow/core/email.js.map +1 -0
  50. package/dist/reglow/core/entities.d.ts +462 -0
  51. package/dist/reglow/core/entities.js +6 -0
  52. package/dist/reglow/core/entities.js.map +1 -0
  53. package/dist/reglow/core/fastify.d.ts +21 -0
  54. package/dist/reglow/core/fastify.js +2 -0
  55. package/dist/reglow/core/fastify.js.map +1 -0
  56. package/dist/reglow/core/logging.d.ts +8 -0
  57. package/dist/reglow/core/logging.js +32 -0
  58. package/dist/reglow/core/logging.js.map +1 -0
  59. package/dist/reglow/core/models.d.ts +98 -0
  60. package/dist/reglow/core/models.js +57 -0
  61. package/dist/reglow/core/models.js.map +1 -0
  62. package/dist/reglow/core/observability.d.ts +17 -0
  63. package/dist/reglow/core/observability.js +92 -0
  64. package/dist/reglow/core/observability.js.map +1 -0
  65. package/dist/reglow/core/payment.d.ts +107 -0
  66. package/dist/reglow/core/payment.js +1177 -0
  67. package/dist/reglow/core/payment.js.map +1 -0
  68. package/dist/reglow/core/plugin.d.ts +19 -0
  69. package/dist/reglow/core/plugin.js +85 -0
  70. package/dist/reglow/core/plugin.js.map +1 -0
  71. package/dist/reglow/core/rate_limit.d.ts +2 -0
  72. package/dist/reglow/core/rate_limit.js +28 -0
  73. package/dist/reglow/core/rate_limit.js.map +1 -0
  74. package/dist/reglow/core/redis.d.ts +30 -0
  75. package/dist/reglow/core/redis.js +278 -0
  76. package/dist/reglow/core/redis.js.map +1 -0
  77. package/dist/reglow/core/redis_keys.d.ts +22 -0
  78. package/dist/reglow/core/redis_keys.js +59 -0
  79. package/dist/reglow/core/redis_keys.js.map +1 -0
  80. package/dist/reglow/core/security.d.ts +25 -0
  81. package/dist/reglow/core/security.js +64 -0
  82. package/dist/reglow/core/security.js.map +1 -0
  83. package/dist/reglow/core/session.d.ts +17 -0
  84. package/dist/reglow/core/session.js +194 -0
  85. package/dist/reglow/core/session.js.map +1 -0
  86. package/dist/reglow/core/sms.d.ts +19 -0
  87. package/dist/reglow/core/sms.js +33 -0
  88. package/dist/reglow/core/sms.js.map +1 -0
  89. package/dist/reglow/core/storage.d.ts +45 -0
  90. package/dist/reglow/core/storage.js +249 -0
  91. package/dist/reglow/core/storage.js.map +1 -0
  92. package/dist/reglow/modules/agreement/controller.d.ts +7 -0
  93. package/dist/reglow/modules/agreement/controller.js +242 -0
  94. package/dist/reglow/modules/agreement/controller.js.map +1 -0
  95. package/dist/reglow/modules/agreement/repository.d.ts +30 -0
  96. package/dist/reglow/modules/agreement/repository.js +160 -0
  97. package/dist/reglow/modules/agreement/repository.js.map +1 -0
  98. package/dist/reglow/modules/agreement/router.d.ts +13 -0
  99. package/dist/reglow/modules/agreement/router.js +10 -0
  100. package/dist/reglow/modules/agreement/router.js.map +1 -0
  101. package/dist/reglow/modules/agreement/schema.d.ts +30 -0
  102. package/dist/reglow/modules/agreement/schema.js +27 -0
  103. package/dist/reglow/modules/agreement/schema.js.map +1 -0
  104. package/dist/reglow/modules/agreement/service.d.ts +42 -0
  105. package/dist/reglow/modules/agreement/service.js +349 -0
  106. package/dist/reglow/modules/agreement/service.js.map +1 -0
  107. package/dist/reglow/modules/ai/controller.d.ts +25 -0
  108. package/dist/reglow/modules/ai/controller.js +1143 -0
  109. package/dist/reglow/modules/ai/controller.js.map +1 -0
  110. package/dist/reglow/modules/ai/router.d.ts +9 -0
  111. package/dist/reglow/modules/ai/router.js +7 -0
  112. package/dist/reglow/modules/ai/router.js.map +1 -0
  113. package/dist/reglow/modules/ai/schema.d.ts +48 -0
  114. package/dist/reglow/modules/ai/schema.js +40 -0
  115. package/dist/reglow/modules/ai/schema.js.map +1 -0
  116. package/dist/reglow/modules/ai/service.d.ts +8 -0
  117. package/dist/reglow/modules/ai/service.js +137 -0
  118. package/dist/reglow/modules/ai/service.js.map +1 -0
  119. package/dist/reglow/modules/article/controller.d.ts +6 -0
  120. package/dist/reglow/modules/article/controller.js +204 -0
  121. package/dist/reglow/modules/article/controller.js.map +1 -0
  122. package/dist/reglow/modules/article/repository.d.ts +37 -0
  123. package/dist/reglow/modules/article/repository.js +184 -0
  124. package/dist/reglow/modules/article/repository.js.map +1 -0
  125. package/dist/reglow/modules/article/router.d.ts +10 -0
  126. package/dist/reglow/modules/article/router.js +8 -0
  127. package/dist/reglow/modules/article/router.js.map +1 -0
  128. package/dist/reglow/modules/article/schema.d.ts +66 -0
  129. package/dist/reglow/modules/article/schema.js +66 -0
  130. package/dist/reglow/modules/article/schema.js.map +1 -0
  131. package/dist/reglow/modules/article/service.d.ts +81 -0
  132. package/dist/reglow/modules/article/service.js +254 -0
  133. package/dist/reglow/modules/article/service.js.map +1 -0
  134. package/dist/reglow/modules/auth/controller.d.ts +6 -0
  135. package/dist/reglow/modules/auth/controller.js +127 -0
  136. package/dist/reglow/modules/auth/controller.js.map +1 -0
  137. package/dist/reglow/modules/auth/router.d.ts +9 -0
  138. package/dist/reglow/modules/auth/router.js +7 -0
  139. package/dist/reglow/modules/auth/router.js.map +1 -0
  140. package/dist/reglow/modules/auth/schema.d.ts +59 -0
  141. package/dist/reglow/modules/auth/schema.js +56 -0
  142. package/dist/reglow/modules/auth/schema.js.map +1 -0
  143. package/dist/reglow/modules/auth/service.d.ts +69 -0
  144. package/dist/reglow/modules/auth/service.js +492 -0
  145. package/dist/reglow/modules/auth/service.js.map +1 -0
  146. package/dist/reglow/modules/config/controller.d.ts +7 -0
  147. package/dist/reglow/modules/config/controller.js +297 -0
  148. package/dist/reglow/modules/config/controller.js.map +1 -0
  149. package/dist/reglow/modules/config/repository.d.ts +17 -0
  150. package/dist/reglow/modules/config/repository.js +88 -0
  151. package/dist/reglow/modules/config/repository.js.map +1 -0
  152. package/dist/reglow/modules/config/router.d.ts +13 -0
  153. package/dist/reglow/modules/config/router.js +8 -0
  154. package/dist/reglow/modules/config/router.js.map +1 -0
  155. package/dist/reglow/modules/config/schema.d.ts +37 -0
  156. package/dist/reglow/modules/config/schema.js +25 -0
  157. package/dist/reglow/modules/config/schema.js.map +1 -0
  158. package/dist/reglow/modules/customer_service/controller.d.ts +3 -0
  159. package/dist/reglow/modules/customer_service/controller.js +443 -0
  160. package/dist/reglow/modules/customer_service/controller.js.map +1 -0
  161. package/dist/reglow/modules/customer_service/document_parser.d.ts +5 -0
  162. package/dist/reglow/modules/customer_service/document_parser.js +84 -0
  163. package/dist/reglow/modules/customer_service/document_parser.js.map +1 -0
  164. package/dist/reglow/modules/customer_service/repository.d.ts +72 -0
  165. package/dist/reglow/modules/customer_service/repository.js +376 -0
  166. package/dist/reglow/modules/customer_service/repository.js.map +1 -0
  167. package/dist/reglow/modules/customer_service/router.d.ts +14 -0
  168. package/dist/reglow/modules/customer_service/router.js +9 -0
  169. package/dist/reglow/modules/customer_service/router.js.map +1 -0
  170. package/dist/reglow/modules/customer_service/schema.d.ts +97 -0
  171. package/dist/reglow/modules/customer_service/schema.js +91 -0
  172. package/dist/reglow/modules/customer_service/schema.js.map +1 -0
  173. package/dist/reglow/modules/customer_service/sdk_template.html +666 -0
  174. package/dist/reglow/modules/customer_service/service.d.ts +92 -0
  175. package/dist/reglow/modules/customer_service/service.js +1642 -0
  176. package/dist/reglow/modules/customer_service/service.js.map +1 -0
  177. package/dist/reglow/modules/customer_service/ws.d.ts +29 -0
  178. package/dist/reglow/modules/customer_service/ws.js +182 -0
  179. package/dist/reglow/modules/customer_service/ws.js.map +1 -0
  180. package/dist/reglow/modules/dept/controller.d.ts +6 -0
  181. package/dist/reglow/modules/dept/controller.js +122 -0
  182. package/dist/reglow/modules/dept/controller.js.map +1 -0
  183. package/dist/reglow/modules/dept/repository.d.ts +24 -0
  184. package/dist/reglow/modules/dept/repository.js +140 -0
  185. package/dist/reglow/modules/dept/repository.js.map +1 -0
  186. package/dist/reglow/modules/dept/router.d.ts +9 -0
  187. package/dist/reglow/modules/dept/router.js +7 -0
  188. package/dist/reglow/modules/dept/router.js.map +1 -0
  189. package/dist/reglow/modules/dept/schema.d.ts +37 -0
  190. package/dist/reglow/modules/dept/schema.js +33 -0
  191. package/dist/reglow/modules/dept/schema.js.map +1 -0
  192. package/dist/reglow/modules/dept/service.d.ts +33 -0
  193. package/dist/reglow/modules/dept/service.js +88 -0
  194. package/dist/reglow/modules/dept/service.js.map +1 -0
  195. package/dist/reglow/modules/dict/controller.d.ts +5 -0
  196. package/dist/reglow/modules/dict/controller.js +87 -0
  197. package/dist/reglow/modules/dict/controller.js.map +1 -0
  198. package/dist/reglow/modules/dict/model.d.ts +7 -0
  199. package/dist/reglow/modules/dict/model.js +8 -0
  200. package/dist/reglow/modules/dict/model.js.map +1 -0
  201. package/dist/reglow/modules/dict/repository.d.ts +16 -0
  202. package/dist/reglow/modules/dict/repository.js +103 -0
  203. package/dist/reglow/modules/dict/repository.js.map +1 -0
  204. package/dist/reglow/modules/dict/router.d.ts +9 -0
  205. package/dist/reglow/modules/dict/router.js +7 -0
  206. package/dist/reglow/modules/dict/router.js.map +1 -0
  207. package/dist/reglow/modules/dict/schema.d.ts +38 -0
  208. package/dist/reglow/modules/dict/schema.js +37 -0
  209. package/dist/reglow/modules/dict/schema.js.map +1 -0
  210. package/dist/reglow/modules/dict/service.d.ts +15 -0
  211. package/dist/reglow/modules/dict/service.js +88 -0
  212. package/dist/reglow/modules/dict/service.js.map +1 -0
  213. package/dist/reglow/modules/employee/controller.d.ts +6 -0
  214. package/dist/reglow/modules/employee/controller.js +167 -0
  215. package/dist/reglow/modules/employee/controller.js.map +1 -0
  216. package/dist/reglow/modules/employee/repository.d.ts +22 -0
  217. package/dist/reglow/modules/employee/repository.js +129 -0
  218. package/dist/reglow/modules/employee/repository.js.map +1 -0
  219. package/dist/reglow/modules/employee/router.d.ts +9 -0
  220. package/dist/reglow/modules/employee/router.js +7 -0
  221. package/dist/reglow/modules/employee/router.js.map +1 -0
  222. package/dist/reglow/modules/employee/schema.d.ts +57 -0
  223. package/dist/reglow/modules/employee/schema.js +58 -0
  224. package/dist/reglow/modules/employee/schema.js.map +1 -0
  225. package/dist/reglow/modules/employee/service.d.ts +30 -0
  226. package/dist/reglow/modules/employee/service.js +193 -0
  227. package/dist/reglow/modules/employee/service.js.map +1 -0
  228. package/dist/reglow/modules/log/controller.d.ts +6 -0
  229. package/dist/reglow/modules/log/controller.js +137 -0
  230. package/dist/reglow/modules/log/controller.js.map +1 -0
  231. package/dist/reglow/modules/log/data-scope.d.ts +9 -0
  232. package/dist/reglow/modules/log/data-scope.js +108 -0
  233. package/dist/reglow/modules/log/data-scope.js.map +1 -0
  234. package/dist/reglow/modules/log/router.d.ts +9 -0
  235. package/dist/reglow/modules/log/router.js +7 -0
  236. package/dist/reglow/modules/log/router.js.map +1 -0
  237. package/dist/reglow/modules/material/controller.d.ts +3 -0
  238. package/dist/reglow/modules/material/controller.js +400 -0
  239. package/dist/reglow/modules/material/controller.js.map +1 -0
  240. package/dist/reglow/modules/material/repository.d.ts +37 -0
  241. package/dist/reglow/modules/material/repository.js +183 -0
  242. package/dist/reglow/modules/material/repository.js.map +1 -0
  243. package/dist/reglow/modules/material/router.d.ts +14 -0
  244. package/dist/reglow/modules/material/router.js +11 -0
  245. package/dist/reglow/modules/material/router.js.map +1 -0
  246. package/dist/reglow/modules/material/schema.d.ts +40 -0
  247. package/dist/reglow/modules/material/schema.js +34 -0
  248. package/dist/reglow/modules/material/schema.js.map +1 -0
  249. package/dist/reglow/modules/material/service.d.ts +85 -0
  250. package/dist/reglow/modules/material/service.js +292 -0
  251. package/dist/reglow/modules/material/service.js.map +1 -0
  252. package/dist/reglow/modules/menu/controller.d.ts +6 -0
  253. package/dist/reglow/modules/menu/controller.js +69 -0
  254. package/dist/reglow/modules/menu/controller.js.map +1 -0
  255. package/dist/reglow/modules/menu/repository.d.ts +14 -0
  256. package/dist/reglow/modules/menu/repository.js +37 -0
  257. package/dist/reglow/modules/menu/repository.js.map +1 -0
  258. package/dist/reglow/modules/menu/router.d.ts +9 -0
  259. package/dist/reglow/modules/menu/router.js +7 -0
  260. package/dist/reglow/modules/menu/router.js.map +1 -0
  261. package/dist/reglow/modules/menu/schema.d.ts +39 -0
  262. package/dist/reglow/modules/menu/schema.js +37 -0
  263. package/dist/reglow/modules/menu/schema.js.map +1 -0
  264. package/dist/reglow/modules/menu/service.d.ts +31 -0
  265. package/dist/reglow/modules/menu/service.js +89 -0
  266. package/dist/reglow/modules/menu/service.js.map +1 -0
  267. package/dist/reglow/modules/message/controller.d.ts +7 -0
  268. package/dist/reglow/modules/message/controller.js +260 -0
  269. package/dist/reglow/modules/message/controller.js.map +1 -0
  270. package/dist/reglow/modules/message/repository.d.ts +27 -0
  271. package/dist/reglow/modules/message/repository.js +145 -0
  272. package/dist/reglow/modules/message/repository.js.map +1 -0
  273. package/dist/reglow/modules/message/router.d.ts +13 -0
  274. package/dist/reglow/modules/message/router.js +8 -0
  275. package/dist/reglow/modules/message/router.js.map +1 -0
  276. package/dist/reglow/modules/message/schema.d.ts +39 -0
  277. package/dist/reglow/modules/message/schema.js +37 -0
  278. package/dist/reglow/modules/message/schema.js.map +1 -0
  279. package/dist/reglow/modules/message/service.d.ts +70 -0
  280. package/dist/reglow/modules/message/service.js +199 -0
  281. package/dist/reglow/modules/message/service.js.map +1 -0
  282. package/dist/reglow/modules/notice/controller.d.ts +6 -0
  283. package/dist/reglow/modules/notice/controller.js +123 -0
  284. package/dist/reglow/modules/notice/controller.js.map +1 -0
  285. package/dist/reglow/modules/notice/repository.d.ts +25 -0
  286. package/dist/reglow/modules/notice/repository.js +145 -0
  287. package/dist/reglow/modules/notice/repository.js.map +1 -0
  288. package/dist/reglow/modules/notice/router.d.ts +9 -0
  289. package/dist/reglow/modules/notice/router.js +7 -0
  290. package/dist/reglow/modules/notice/router.js.map +1 -0
  291. package/dist/reglow/modules/notice/schema.d.ts +23 -0
  292. package/dist/reglow/modules/notice/schema.js +22 -0
  293. package/dist/reglow/modules/notice/schema.js.map +1 -0
  294. package/dist/reglow/modules/notice/service.d.ts +45 -0
  295. package/dist/reglow/modules/notice/service.js +149 -0
  296. package/dist/reglow/modules/notice/service.js.map +1 -0
  297. package/dist/reglow/modules/payment/controller.d.ts +6 -0
  298. package/dist/reglow/modules/payment/controller.js +186 -0
  299. package/dist/reglow/modules/payment/controller.js.map +1 -0
  300. package/dist/reglow/modules/payment/router.d.ts +10 -0
  301. package/dist/reglow/modules/payment/router.js +8 -0
  302. package/dist/reglow/modules/payment/router.js.map +1 -0
  303. package/dist/reglow/modules/payment/schema.d.ts +52 -0
  304. package/dist/reglow/modules/payment/schema.js +43 -0
  305. package/dist/reglow/modules/payment/schema.js.map +1 -0
  306. package/dist/reglow/modules/payment/service.d.ts +28 -0
  307. package/dist/reglow/modules/payment/service.js +219 -0
  308. package/dist/reglow/modules/payment/service.js.map +1 -0
  309. package/dist/reglow/modules/photo/controller.d.ts +2 -0
  310. package/dist/reglow/modules/photo/controller.js +323 -0
  311. package/dist/reglow/modules/photo/controller.js.map +1 -0
  312. package/dist/reglow/modules/photo/controller_client.d.ts +2 -0
  313. package/dist/reglow/modules/photo/controller_client.js +293 -0
  314. package/dist/reglow/modules/photo/controller_client.js.map +1 -0
  315. package/dist/reglow/modules/photo/repository.d.ts +50 -0
  316. package/dist/reglow/modules/photo/repository.js +240 -0
  317. package/dist/reglow/modules/photo/repository.js.map +1 -0
  318. package/dist/reglow/modules/photo/router.d.ts +15 -0
  319. package/dist/reglow/modules/photo/router.js +10 -0
  320. package/dist/reglow/modules/photo/router.js.map +1 -0
  321. package/dist/reglow/modules/photo/schema.d.ts +69 -0
  322. package/dist/reglow/modules/photo/schema.js +66 -0
  323. package/dist/reglow/modules/photo/schema.js.map +1 -0
  324. package/dist/reglow/modules/photo/service.d.ts +98 -0
  325. package/dist/reglow/modules/photo/service.js +295 -0
  326. package/dist/reglow/modules/photo/service.js.map +1 -0
  327. package/dist/reglow/modules/post/controller.d.ts +6 -0
  328. package/dist/reglow/modules/post/controller.js +61 -0
  329. package/dist/reglow/modules/post/controller.js.map +1 -0
  330. package/dist/reglow/modules/post/repository.d.ts +12 -0
  331. package/dist/reglow/modules/post/repository.js +46 -0
  332. package/dist/reglow/modules/post/repository.js.map +1 -0
  333. package/dist/reglow/modules/post/router.d.ts +9 -0
  334. package/dist/reglow/modules/post/router.js +7 -0
  335. package/dist/reglow/modules/post/router.js.map +1 -0
  336. package/dist/reglow/modules/post/schema.d.ts +19 -0
  337. package/dist/reglow/modules/post/schema.js +18 -0
  338. package/dist/reglow/modules/post/schema.js.map +1 -0
  339. package/dist/reglow/modules/post/service.d.ts +18 -0
  340. package/dist/reglow/modules/post/service.js +44 -0
  341. package/dist/reglow/modules/post/service.js.map +1 -0
  342. package/dist/reglow/modules/role/controller.d.ts +6 -0
  343. package/dist/reglow/modules/role/controller.js +103 -0
  344. package/dist/reglow/modules/role/controller.js.map +1 -0
  345. package/dist/reglow/modules/role/repository.d.ts +22 -0
  346. package/dist/reglow/modules/role/repository.js +84 -0
  347. package/dist/reglow/modules/role/repository.js.map +1 -0
  348. package/dist/reglow/modules/role/router.d.ts +9 -0
  349. package/dist/reglow/modules/role/router.js +7 -0
  350. package/dist/reglow/modules/role/router.js.map +1 -0
  351. package/dist/reglow/modules/role/schema.d.ts +32 -0
  352. package/dist/reglow/modules/role/schema.js +29 -0
  353. package/dist/reglow/modules/role/schema.js.map +1 -0
  354. package/dist/reglow/modules/role/service.d.ts +22 -0
  355. package/dist/reglow/modules/role/service.js +72 -0
  356. package/dist/reglow/modules/role/service.js.map +1 -0
  357. package/dist/reglow/modules/user/controller.d.ts +6 -0
  358. package/dist/reglow/modules/user/controller.js +126 -0
  359. package/dist/reglow/modules/user/controller.js.map +1 -0
  360. package/dist/reglow/modules/user/controller_client.d.ts +2 -0
  361. package/dist/reglow/modules/user/controller_client.js +291 -0
  362. package/dist/reglow/modules/user/controller_client.js.map +1 -0
  363. package/dist/reglow/modules/user/repository.d.ts +12 -0
  364. package/dist/reglow/modules/user/repository.js +71 -0
  365. package/dist/reglow/modules/user/repository.js.map +1 -0
  366. package/dist/reglow/modules/user/router.d.ts +16 -0
  367. package/dist/reglow/modules/user/router.js +11 -0
  368. package/dist/reglow/modules/user/router.js.map +1 -0
  369. package/dist/reglow/modules/user/schema.d.ts +92 -0
  370. package/dist/reglow/modules/user/schema.js +82 -0
  371. package/dist/reglow/modules/user/schema.js.map +1 -0
  372. package/dist/reglow/modules/user/service.d.ts +43 -0
  373. package/dist/reglow/modules/user/service.js +311 -0
  374. package/dist/reglow/modules/user/service.js.map +1 -0
  375. package/dist/reglow/modules/video/controller.d.ts +2 -0
  376. package/dist/reglow/modules/video/controller.js +254 -0
  377. package/dist/reglow/modules/video/controller.js.map +1 -0
  378. package/dist/reglow/modules/video/repository.d.ts +38 -0
  379. package/dist/reglow/modules/video/repository.js +186 -0
  380. package/dist/reglow/modules/video/repository.js.map +1 -0
  381. package/dist/reglow/modules/video/router.d.ts +10 -0
  382. package/dist/reglow/modules/video/router.js +8 -0
  383. package/dist/reglow/modules/video/router.js.map +1 -0
  384. package/dist/reglow/modules/video/schema.d.ts +62 -0
  385. package/dist/reglow/modules/video/schema.js +61 -0
  386. package/dist/reglow/modules/video/schema.js.map +1 -0
  387. package/dist/reglow/modules/video/service.d.ts +80 -0
  388. package/dist/reglow/modules/video/service.js +251 -0
  389. package/dist/reglow/modules/video/service.js.map +1 -0
  390. package/dist/reglow/scripts/init-data.d.ts +44 -0
  391. package/dist/reglow/scripts/init-data.js +472 -0
  392. package/dist/reglow/scripts/init-data.js.map +1 -0
  393. package/dist/reglow/scripts/remove-business-menu.d.ts +1 -0
  394. package/dist/reglow/scripts/remove-business-menu.js +124 -0
  395. package/dist/reglow/scripts/remove-business-menu.js.map +1 -0
  396. package/dist/reglow/scripts/schema.d.ts +9 -0
  397. package/dist/reglow/scripts/schema.js +746 -0
  398. package/dist/reglow/scripts/schema.js.map +1 -0
  399. package/dist/reglow/scripts/sync-menu-mysql-to-sqlite.d.ts +1 -0
  400. package/dist/reglow/scripts/sync-menu-mysql-to-sqlite.js +304 -0
  401. package/dist/reglow/scripts/sync-menu-mysql-to-sqlite.js.map +1 -0
  402. package/dist/server.d.ts +1 -0
  403. package/dist/server.js +162 -0
  404. package/dist/server.js.map +1 -0
  405. package/package.json +79 -0
@@ -0,0 +1,183 @@
1
+ /**
2
+ * 素材模块 Repository - 数据访问层
3
+ * 对应 backend-python 的 reglow/modules/material/controller.py 中的 SQLAlchemy 查询
4
+ */
5
+ import { knex } from "../../core/database.js";
6
+ import { ModelRegistry } from "../../core/models.js";
7
+ const M = ModelRegistry.get("Material");
8
+ const MG = ModelRegistry.get("MaterialGroup");
9
+ const MGR = ModelRegistry.get("MaterialGroupRelation");
10
+ export class MaterialRepository {
11
+ async listMaterials(page, size, q) {
12
+ let query = knex(M).whereNull("deleted_at");
13
+ let countQuery = knex(M).whereNull("deleted_at");
14
+ if (q.ungrouped) {
15
+ const sub = knex(MGR).select("material_id").distinct();
16
+ query = query.whereNotIn("id", sub);
17
+ countQuery = countQuery.whereNotIn("id", sub);
18
+ }
19
+ else if (q.groupIds && q.groupIds.length) {
20
+ const groupedIds = q.groupIds;
21
+ const sub = knex(MGR)
22
+ .select("material_id")
23
+ .whereIn("group_id", groupedIds)
24
+ .distinct();
25
+ query = query.whereIn("id", sub);
26
+ countQuery = countQuery.whereIn("id", sub);
27
+ }
28
+ if (q.type) {
29
+ query = query.where("type", q.type);
30
+ countQuery = countQuery.where("type", q.type);
31
+ }
32
+ if (q.source) {
33
+ query = query.where("source", q.source);
34
+ countQuery = countQuery.where("source", q.source);
35
+ }
36
+ if (q.keyword) {
37
+ const like = `%${q.keyword}%`;
38
+ query = query.where("name", "like", like);
39
+ countQuery = countQuery.where("name", "like", like);
40
+ }
41
+ const items = (await query
42
+ .orderBy("id", "desc")
43
+ .offset((page - 1) * size)
44
+ .limit(size));
45
+ const totalRow = await countQuery.count({ c: "*" }).first();
46
+ return {
47
+ items,
48
+ total: Number(totalRow.c) || 0,
49
+ };
50
+ }
51
+ async listSources() {
52
+ const rows = (await knex(M)
53
+ .whereNull("deleted_at")
54
+ .whereNotNull("source")
55
+ .distinct("source"));
56
+ return rows.map((r) => r.source).filter((s) => Boolean(s));
57
+ }
58
+ async createMaterial(payload) {
59
+ const [id] = await knex(M).insert(payload);
60
+ return (await knex(M).where("id", id).first());
61
+ }
62
+ async batchGetGroupIds(materialIds) {
63
+ const map = new Map();
64
+ materialIds.forEach((id) => map.set(id, []));
65
+ if (!materialIds.length)
66
+ return map;
67
+ const rows = (await knex(MGR).whereIn("material_id", materialIds));
68
+ for (const row of rows) {
69
+ map.get(row.material_id)?.push(row.group_id);
70
+ }
71
+ return map;
72
+ }
73
+ async replaceRelations(materialIds, groupIds) {
74
+ await knex(MGR).whereIn("material_id", materialIds).del();
75
+ if (!groupIds.length)
76
+ return;
77
+ const payloads = [];
78
+ for (const mid of materialIds) {
79
+ for (const gid of groupIds) {
80
+ payloads.push({ material_id: mid, group_id: gid });
81
+ }
82
+ }
83
+ await knex(MGR).insert(payloads);
84
+ }
85
+ async countActiveByIds(ids) {
86
+ const row = await knex(M)
87
+ .whereIn("id", ids)
88
+ .whereNull("deleted_at")
89
+ .count({ c: "*" })
90
+ .first();
91
+ return Number(row.c) || 0;
92
+ }
93
+ async listRecycleBin(page, size) {
94
+ const base = knex(M).whereNotNull("deleted_at");
95
+ const items = (await base
96
+ .clone()
97
+ .orderBy("deleted_at", "desc")
98
+ .offset((page - 1) * size)
99
+ .limit(size));
100
+ const totalRow = await base.count({ c: "*" }).first();
101
+ return {
102
+ items,
103
+ total: Number(totalRow.c) || 0,
104
+ };
105
+ }
106
+ async findDeletedByIds(ids) {
107
+ if (!ids.length)
108
+ return [];
109
+ return (await knex(M)
110
+ .whereIn("id", ids)
111
+ .whereNotNull("deleted_at"));
112
+ }
113
+ async updateMaterial(id, payload) {
114
+ await knex(M).where("id", id).update(payload);
115
+ }
116
+ async updateMaterialBatch(ids, payload) {
117
+ if (!ids.length)
118
+ return;
119
+ await knex(M).whereIn("id", ids).update(payload);
120
+ }
121
+ async deleteRelationsByMaterialIds(ids) {
122
+ if (!ids.length)
123
+ return;
124
+ await knex(MGR).whereIn("material_id", ids).del();
125
+ }
126
+ async permanentDelete(ids) {
127
+ if (!ids.length)
128
+ return;
129
+ await knex(M).whereIn("id", ids).del();
130
+ }
131
+ // ── 分组 ──
132
+ async listGroups() {
133
+ return (await knex(MG).orderBy("sort", "asc"));
134
+ }
135
+ async getGroupCounts() {
136
+ const map = new Map();
137
+ const rows = (await knex(MGR)
138
+ .join(M, `${M}.id`, `${MGR}.material_id`)
139
+ .whereNull(`${M}.deleted_at`)
140
+ .groupBy(`${MGR}.group_id`)
141
+ .count({ c: "*" }));
142
+ for (const row of rows) {
143
+ map.set(row.group_id, Number(row.c) || 0);
144
+ }
145
+ return map;
146
+ }
147
+ async getUngroupedCount() {
148
+ const sub = knex(MGR).select("material_id").distinct();
149
+ const row = await knex(M)
150
+ .whereNull("deleted_at")
151
+ .whereNotIn("id", sub)
152
+ .count({ c: "*" })
153
+ .first();
154
+ return Number(row.c) || 0;
155
+ }
156
+ async createGroup(payload) {
157
+ const [id] = await knex(MG).insert(payload);
158
+ return (await knex(MG).where("id", id).first());
159
+ }
160
+ async findGroupById(id) {
161
+ return (await knex(MG).where("id", id).first());
162
+ }
163
+ async updateGroup(id, payload) {
164
+ await knex(MG).where("id", id).update(payload);
165
+ return (await knex(MG).where("id", id).first());
166
+ }
167
+ async countMaterialsInGroup(groupId) {
168
+ const row = await knex(MGR)
169
+ .join(M, `${M}.id`, `${MGR}.material_id`)
170
+ .where(`${MGR}.group_id`, groupId)
171
+ .whereNull(`${M}.deleted_at`)
172
+ .count({ c: "*" })
173
+ .first();
174
+ return Number(row.c) || 0;
175
+ }
176
+ async deleteGroupRelations(groupId) {
177
+ await knex(MGR).where("group_id", groupId).del();
178
+ }
179
+ async deleteGroup(groupId) {
180
+ await knex(MG).where("id", groupId).del();
181
+ }
182
+ }
183
+ //# sourceMappingURL=repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repository.js","sourceRoot":"","sources":["../../../../reglow/modules/material/repository.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAOrD,MAAM,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AACxC,MAAM,EAAE,GAAG,aAAa,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAC9C,MAAM,GAAG,GAAG,aAAa,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;AAUvD,MAAM,OAAO,kBAAkB;IAC7B,KAAK,CAAC,aAAa,CACjB,IAAY,EACZ,IAAY,EACZ,CAAoB;QAEpB,IAAI,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QAC5C,IAAI,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QAEjD,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;YAChB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,QAAQ,EAAE,CAAC;YACvD,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;YACpC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACh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W,EAAE,OAAO,CAAC;aACjC,SAAS,CAAC,GAAG,CAAC,aAAa,CAAC;aAC5B,KAAK,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC;aACjB,KAAK,EAAE,CAAC;QACX,OAAO,MAAM,CAAE,GAA8B,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACxD,CAAC;IAED,KAAK,CAAC,oBAAoB,CAAC,OAAe;QACxC,MAAM,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC;IACnD,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAAe;QAC/B,MAAM,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC;IAC5C,CAAC;CACF"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * 素材模块路由注册定义 - 供 core/plugin.ts 自动发现
3
+ * 对应 backend-python 的 reglow/modules/material/router.py
4
+ */
5
+ import { materialRoutes, groupRoutes } from "./controller.js";
6
+ export declare const routerTags: string[];
7
+ export declare const router: {
8
+ prefix: string;
9
+ register: typeof materialRoutes;
10
+ };
11
+ export declare const adminRouters: {
12
+ prefix: string;
13
+ register: typeof groupRoutes;
14
+ }[];
@@ -0,0 +1,11 @@
1
+ /**
2
+ * 素材模块路由注册定义 - 供 core/plugin.ts 自动发现
3
+ * 对应 backend-python 的 reglow/modules/material/router.py
4
+ */
5
+ import { materialRoutes, groupRoutes } from "./controller.js";
6
+ export const routerTags = ["素材管理", "素材分组"];
7
+ export const router = { prefix: "/materials", register: materialRoutes };
8
+ export const adminRouters = [
9
+ { prefix: "/material-groups", register: groupRoutes },
10
+ ];
11
+ //# sourceMappingURL=router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.js","sourceRoot":"","sources":["../../../../reglow/modules/material/router.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9D,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC3C,MAAM,CAAC,MAAM,MAAM,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;AACzE,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,EAAE,MAAM,EAAE,kBAAkB,EAAE,QAAQ,EAAE,WAAW,EAAE;CACtD,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * 素材模块 Schema - TypeBox 运行时校验 + 编译期类型
3
+ * 对应 backend-python 的 reglow/modules/material/schema.py
4
+ */
5
+ import { type Static } from "@sinclair/typebox";
6
+ export declare const CreateGroupSchema: import("@sinclair/typebox").TObject<{
7
+ parent_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
8
+ name: import("@sinclair/typebox").TString;
9
+ sort: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
10
+ }>;
11
+ export type CreateGroupBody = Static<typeof CreateGroupSchema>;
12
+ export declare const UpdateGroupSchema: import("@sinclair/typebox").TObject<{
13
+ name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
14
+ sort: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
15
+ }>;
16
+ export type UpdateGroupBody = Static<typeof UpdateGroupSchema>;
17
+ export declare const AssignGroupsSchema: import("@sinclair/typebox").TObject<{
18
+ material_ids: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TInteger>;
19
+ group_ids: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TInteger>;
20
+ }>;
21
+ export type AssignGroupsBody = Static<typeof AssignGroupsSchema>;
22
+ export declare const BatchRestoreSchema: import("@sinclair/typebox").TObject<{
23
+ ids: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TInteger>;
24
+ }>;
25
+ export type BatchRestoreBody = Static<typeof BatchRestoreSchema>;
26
+ export declare const SortGroupsSchema: import("@sinclair/typebox").TObject<{
27
+ items: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
28
+ id: import("@sinclair/typebox").TInteger;
29
+ sort: import("@sinclair/typebox").TInteger;
30
+ }>>;
31
+ }>;
32
+ export type SortGroupsBody = Static<typeof SortGroupsSchema>;
33
+ export declare const FetchImagesSchema: import("@sinclair/typebox").TObject<{
34
+ url: import("@sinclair/typebox").TString;
35
+ }>;
36
+ export type FetchImagesBody = Static<typeof FetchImagesSchema>;
37
+ export declare const FetchVideosSchema: import("@sinclair/typebox").TObject<{
38
+ url: import("@sinclair/typebox").TString;
39
+ }>;
40
+ export type FetchVideosBody = Static<typeof FetchVideosSchema>;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * 素材模块 Schema - TypeBox 运行时校验 + 编译期类型
3
+ * 对应 backend-python 的 reglow/modules/material/schema.py
4
+ */
5
+ import { Type } from "@sinclair/typebox";
6
+ export const CreateGroupSchema = Type.Object({
7
+ parent_id: Type.Optional(Type.Integer({ minimum: 0 })),
8
+ name: Type.String({ minLength: 1, maxLength: 50 }),
9
+ sort: Type.Optional(Type.Integer({ minimum: 0 })),
10
+ });
11
+ export const UpdateGroupSchema = Type.Object({
12
+ name: Type.Optional(Type.String({ minLength: 1, maxLength: 50 })),
13
+ sort: Type.Optional(Type.Integer({ minimum: 0 })),
14
+ });
15
+ export const AssignGroupsSchema = Type.Object({
16
+ material_ids: Type.Array(Type.Integer({ minimum: 1 }), { minItems: 1 }),
17
+ group_ids: Type.Array(Type.Integer({ minimum: 1 })),
18
+ });
19
+ export const BatchRestoreSchema = Type.Object({
20
+ ids: Type.Array(Type.Integer({ minimum: 1 }), { minItems: 1 }),
21
+ });
22
+ export const SortGroupsSchema = Type.Object({
23
+ items: Type.Array(Type.Object({
24
+ id: Type.Integer({ minimum: 1 }),
25
+ sort: Type.Integer({ minimum: 0 }),
26
+ }), { minItems: 1 }),
27
+ });
28
+ export const FetchImagesSchema = Type.Object({
29
+ url: Type.String({ minLength: 1 }),
30
+ });
31
+ export const FetchVideosSchema = Type.Object({
32
+ url: Type.String({ minLength: 1 }),
33
+ });
34
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../reglow/modules/material/schema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,IAAI,EAAe,MAAM,mBAAmB,CAAC;AAEtD,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3C,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;IACtD,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;IAClD,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;CAClD,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3C,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC;IACjE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;CAClD,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC,MAAM,CAAC;IAC5C,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;IACvE,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;CACpD,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC,MAAM,CAAC;IAC5C,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;CAC/D,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC;IAC1C,KAAK,EAAE,IAAI,CAAC,KAAK,CACf,IAAI,CAAC,MAAM,CAAC;QACV,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;QAChC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;KACnC,CAAC,EACF,EAAE,QAAQ,EAAE,CAAC,EAAE,CAChB;CACF,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3C,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;CACnC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3C,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;CACnC,CAAC,CAAC"}
@@ -0,0 +1,85 @@
1
+ import { MaterialRepository } from "./repository.js";
2
+ import type { Material } from "../../core/entities.js";
3
+ import type { UpdateGroupBody } from "./schema.js";
4
+ export declare const AI_SOURCE = "\u6A21\u578B\u4E0A\u4E0B\u6587";
5
+ export interface MaterialResponseDto {
6
+ id: number;
7
+ user_id: number | null;
8
+ uploader_name: string | null;
9
+ name: string;
10
+ type: string | null;
11
+ url: string;
12
+ thumbnail_url: string | null;
13
+ size: number | null;
14
+ mime_type: string | null;
15
+ width: number | null;
16
+ height: number | null;
17
+ storage: string | null;
18
+ source: string | null;
19
+ expire_at: unknown;
20
+ is_expired: boolean;
21
+ group_ids: number[];
22
+ created_at: unknown;
23
+ }
24
+ export interface RecycleBinItemDto {
25
+ id: number;
26
+ user_id: number | null;
27
+ uploader_name: string | null;
28
+ name: string;
29
+ type: string | null;
30
+ url: string;
31
+ thumbnail_url: string | null;
32
+ size: number | null;
33
+ source: string | null;
34
+ expire_at: unknown;
35
+ is_expired: boolean;
36
+ group_ids: number[];
37
+ deleted_at: unknown;
38
+ created_at: unknown;
39
+ }
40
+ export interface MaterialGroupDto {
41
+ id: number;
42
+ parent_id: number;
43
+ name: string;
44
+ sort: number;
45
+ count: number;
46
+ created_at: unknown;
47
+ }
48
+ export declare class MaterialService {
49
+ repo: MaterialRepository;
50
+ buildResponse(item: Material, groupMap: Map<number, number[]>, nameMap: Map<number, string>): Promise<MaterialResponseDto>;
51
+ buildRecycleItem(item: Material, groupMap: Map<number, number[]>, nameMap: Map<number, string>): RecycleBinItemDto;
52
+ private enrich;
53
+ private enrichRecycle;
54
+ list(page: number, size: number, groupIds: number[] | null, ungrouped: boolean, type: string | null, source: string | null, keyword: string | null): Promise<{
55
+ items: MaterialResponseDto[];
56
+ total: number;
57
+ }>;
58
+ listSources(): Promise<string[]>;
59
+ createMaterial(payload: Record<string, unknown>, groupIds: number[]): Promise<MaterialResponseDto>;
60
+ assignGroups(materialIds: number[], groupIds: number[]): Promise<number>;
61
+ listRecycleBin(page: number, size: number): Promise<{
62
+ items: RecycleBinItemDto[];
63
+ total: number;
64
+ }>;
65
+ restore(ids: number[]): Promise<number>;
66
+ permanentDelete(ids: number[], isSuperAdmin: boolean): Promise<number>;
67
+ listGroups(): Promise<{
68
+ groups: MaterialGroupDto[];
69
+ ungrouped_count: number;
70
+ }>;
71
+ createGroup(data: {
72
+ parent_id?: number;
73
+ name: string;
74
+ sort?: number;
75
+ }): Promise<MaterialGroupDto>;
76
+ updateGroup(groupId: number, data: UpdateGroupBody): Promise<MaterialGroupDto>;
77
+ deleteGroup(groupId: number): Promise<void>;
78
+ sortGroups(items: Array<{
79
+ id: number;
80
+ sort: number;
81
+ }>): Promise<void>;
82
+ moveExpiredToRecycleBin(): Promise<number>;
83
+ cleanupAiRecycleBin(): Promise<number>;
84
+ cleanupGarbageMaterials(): Promise<number>;
85
+ }