@r2wa-org/eden 0.0.48

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 (271) hide show
  1. package/README.md +28 -0
  2. package/dist/src/admin/index.d.ts +4793 -0
  3. package/dist/src/auth/better-auth.d.ts +2915 -0
  4. package/dist/src/auth/better-hooks.d.ts +16 -0
  5. package/dist/src/auth/db.schemas.d.ts +2076 -0
  6. package/dist/src/auth/permissions.d.ts +155 -0
  7. package/dist/src/auth/roles.d.ts +376 -0
  8. package/dist/src/auth/router.d.ts +385 -0
  9. package/dist/src/auth/schema.d.ts +1080 -0
  10. package/dist/src/bank-account/admin.router.d.ts +880 -0
  11. package/dist/src/bank-account/db.schemas.d.ts +1032 -0
  12. package/dist/src/bank-account/dto.schemas.d.ts +572 -0
  13. package/dist/src/bank-account/index.d.ts +8 -0
  14. package/dist/src/bank-account/permissions.d.ts +10 -0
  15. package/dist/src/bank-account/router.d.ts +680 -0
  16. package/dist/src/bank-account/schema.d.ts +535 -0
  17. package/dist/src/bank-account/seed.d.ts +4 -0
  18. package/dist/src/bank-account/service.d.ts +359 -0
  19. package/dist/src/check-in/admin.router.d.ts +533 -0
  20. package/dist/src/check-in/db.schemas.d.ts +312 -0
  21. package/dist/src/check-in/dto.schemas.d.ts +544 -0
  22. package/dist/src/check-in/errors/index.d.ts +13 -0
  23. package/dist/src/check-in/errors/locales/zh.d.ts +10 -0
  24. package/dist/src/check-in/index.d.ts +7 -0
  25. package/dist/src/check-in/permissions.d.ts +6 -0
  26. package/dist/src/check-in/router.d.ts +619 -0
  27. package/dist/src/check-in/schema.d.ts +168 -0
  28. package/dist/src/check-in/service.d.ts +99 -0
  29. package/dist/src/cors/index.d.ts +30 -0
  30. package/dist/src/cron/index.d.ts +76 -0
  31. package/dist/src/db/columns.helpers.d.ts +13 -0
  32. package/dist/src/db/enums.d.ts +1 -0
  33. package/dist/src/db/index.d.ts +4 -0
  34. package/dist/src/db/schemas.d.ts +24 -0
  35. package/dist/src/db/transaction.d.ts +3 -0
  36. package/dist/src/db/typebox.d.ts +19 -0
  37. package/dist/src/deposit/admin.router.d.ts +633 -0
  38. package/dist/src/deposit/db.schemas.d.ts +550 -0
  39. package/dist/src/deposit/dto.schemas.d.ts +707 -0
  40. package/dist/src/deposit/errors/index.d.ts +33 -0
  41. package/dist/src/deposit/errors/locales/zh.d.ts +18 -0
  42. package/dist/src/deposit/index.d.ts +7 -0
  43. package/dist/src/deposit/permissions.d.ts +9 -0
  44. package/dist/src/deposit/router.d.ts +621 -0
  45. package/dist/src/deposit/schema.d.ts +287 -0
  46. package/dist/src/deposit/service.d.ts +278 -0
  47. package/dist/src/dynamic-env/admin.router.d.ts +637 -0
  48. package/dist/src/dynamic-env/cache.d.ts +35 -0
  49. package/dist/src/dynamic-env/db.schemas.d.ts +182 -0
  50. package/dist/src/dynamic-env/dto.schema.d.ts +17 -0
  51. package/dist/src/dynamic-env/index.d.ts +3 -0
  52. package/dist/src/dynamic-env/schema.d.ts +96 -0
  53. package/dist/src/dynamic-env/service.d.ts +93 -0
  54. package/dist/src/eden/index.d.ts +57 -0
  55. package/dist/src/email/index.d.ts +2 -0
  56. package/dist/src/env/client.d.ts +2 -0
  57. package/dist/src/env/index.d.ts +2 -0
  58. package/dist/src/env/server.d.ts +50 -0
  59. package/dist/src/env/typebox-env.d.ts +7 -0
  60. package/dist/src/error/errorcode.d.ts +9 -0
  61. package/dist/src/error/index.d.ts +120 -0
  62. package/dist/src/error/locales/zh.d.ts +2 -0
  63. package/dist/src/error/messages.d.ts +10 -0
  64. package/dist/src/external/dto.schemas.d.ts +173 -0
  65. package/dist/src/external/errors/index.d.ts +13 -0
  66. package/dist/src/external/errors/locales/zh.d.ts +10 -0
  67. package/dist/src/external/index.d.ts +4 -0
  68. package/dist/src/external/router.d.ts +105 -0
  69. package/dist/src/external/service.d.ts +31 -0
  70. package/dist/src/file-storage/admin.router.d.ts +601 -0
  71. package/dist/src/file-storage/db.schemas.d.ts +1026 -0
  72. package/dist/src/file-storage/dto.schemas.d.ts +1238 -0
  73. package/dist/src/file-storage/errors/index.d.ts +19 -0
  74. package/dist/src/file-storage/errors/locales/zh.d.ts +18 -0
  75. package/dist/src/file-storage/index.d.ts +6 -0
  76. package/dist/src/file-storage/permissions.d.ts +5 -0
  77. package/dist/src/file-storage/router.d.ts +588 -0
  78. package/dist/src/file-storage/s3.client.d.ts +284 -0
  79. package/dist/src/file-storage/schema.d.ts +538 -0
  80. package/dist/src/file-storage/service.d.ts +264 -0
  81. package/dist/src/file-storage/share.router.d.ts +564 -0
  82. package/dist/src/index.d.ts +8664 -0
  83. package/dist/src/ledger/admin.router.d.ts +524 -0
  84. package/dist/src/ledger/db.schemas.d.ts +486 -0
  85. package/dist/src/ledger/dto.schemas.d.ts +160 -0
  86. package/dist/src/ledger/errors/index.d.ts +22 -0
  87. package/dist/src/ledger/errors/locales/zh.d.ts +14 -0
  88. package/dist/src/ledger/index.d.ts +6 -0
  89. package/dist/src/ledger/permissions.d.ts +8 -0
  90. package/dist/src/ledger/router.d.ts +486 -0
  91. package/dist/src/ledger/schema.d.ts +259 -0
  92. package/dist/src/ledger/service.d.ts +208 -0
  93. package/dist/src/nanoid/index.d.ts +2 -0
  94. package/dist/src/news/admin.router.d.ts +824 -0
  95. package/dist/src/news/db.schemas.d.ts +1150 -0
  96. package/dist/src/news/dto.schemas.d.ts +233 -0
  97. package/dist/src/news/errors/index.d.ts +20 -0
  98. package/dist/src/news/errors/locales/zh.d.ts +13 -0
  99. package/dist/src/news/index.d.ts +6 -0
  100. package/dist/src/news/permissions.d.ts +4 -0
  101. package/dist/src/news/router.d.ts +620 -0
  102. package/dist/src/news/schema.d.ts +616 -0
  103. package/dist/src/news/service.d.ts +495 -0
  104. package/dist/src/news-category/admin.router.d.ts +207 -0
  105. package/dist/src/news-category/constants.d.ts +1 -0
  106. package/dist/src/news-category/db.schemas.d.ts +324 -0
  107. package/dist/src/news-category/dto.schemas.d.ts +57 -0
  108. package/dist/src/news-category/errors/index.d.ts +19 -0
  109. package/dist/src/news-category/errors/locales/zh.d.ts +13 -0
  110. package/dist/src/news-category/index.d.ts +7 -0
  111. package/dist/src/news-category/permissions.d.ts +4 -0
  112. package/dist/src/news-category/router.d.ts +460 -0
  113. package/dist/src/news-category/schema.d.ts +173 -0
  114. package/dist/src/news-category/seed.d.ts +12 -0
  115. package/dist/src/news-category/service.d.ts +105 -0
  116. package/dist/src/notification/admin.router.d.ts +582 -0
  117. package/dist/src/notification/db.schemas.d.ts +624 -0
  118. package/dist/src/notification/dto.schemas.d.ts +457 -0
  119. package/dist/src/notification/errors/index.d.ts +19 -0
  120. package/dist/src/notification/errors/locales/zh.d.ts +13 -0
  121. package/dist/src/notification/index.d.ts +7 -0
  122. package/dist/src/notification/permissions.d.ts +6 -0
  123. package/dist/src/notification/router.d.ts +626 -0
  124. package/dist/src/notification/schema.d.ts +347 -0
  125. package/dist/src/notification/service.d.ts +195 -0
  126. package/dist/src/receipt-method/admin.router.d.ts +579 -0
  127. package/dist/src/receipt-method/db.schemas.d.ts +380 -0
  128. package/dist/src/receipt-method/dto.schemas.d.ts +418 -0
  129. package/dist/src/receipt-method/index.d.ts +7 -0
  130. package/dist/src/receipt-method/permissions.d.ts +4 -0
  131. package/dist/src/receipt-method/router.d.ts +602 -0
  132. package/dist/src/receipt-method/schema.d.ts +205 -0
  133. package/dist/src/receipt-method/service.d.ts +152 -0
  134. package/dist/src/referral/admin.router.d.ts +562 -0
  135. package/dist/src/referral/db.schemas.d.ts +420 -0
  136. package/dist/src/referral/dto.schemas.d.ts +665 -0
  137. package/dist/src/referral/errors/index.d.ts +14 -0
  138. package/dist/src/referral/errors/locales/zh.d.ts +13 -0
  139. package/dist/src/referral/index.d.ts +6 -0
  140. package/dist/src/referral/permissions.d.ts +8 -0
  141. package/dist/src/referral/router.d.ts +579 -0
  142. package/dist/src/referral/schema.d.ts +235 -0
  143. package/dist/src/referral/service.d.ts +42 -0
  144. package/dist/src/referral-depth-config/admin.router.d.ts +646 -0
  145. package/dist/src/referral-depth-config/db.schemas.d.ts +176 -0
  146. package/dist/src/referral-depth-config/dto.schemas.d.ts +208 -0
  147. package/dist/src/referral-depth-config/errors/index.d.ts +11 -0
  148. package/dist/src/referral-depth-config/errors/locales/zh.d.ts +10 -0
  149. package/dist/src/referral-depth-config/index.d.ts +5 -0
  150. package/dist/src/referral-depth-config/permissions.d.ts +8 -0
  151. package/dist/src/referral-depth-config/schema.d.ts +99 -0
  152. package/dist/src/referral-depth-config/service.d.ts +56 -0
  153. package/dist/src/server-test/errors/index.d.ts +10 -0
  154. package/dist/src/server-test/errors/locales/zh.d.ts +9 -0
  155. package/dist/src/server-test/index.d.ts +486 -0
  156. package/dist/src/shipping-address/admin.router.d.ts +507 -0
  157. package/dist/src/shipping-address/db.schemas.d.ts +278 -0
  158. package/dist/src/shipping-address/dto.schemas.d.ts +303 -0
  159. package/dist/src/shipping-address/index.d.ts +7 -0
  160. package/dist/src/shipping-address/permissions.d.ts +4 -0
  161. package/dist/src/shipping-address/router.d.ts +621 -0
  162. package/dist/src/shipping-address/schema.d.ts +150 -0
  163. package/dist/src/shipping-address/service.d.ts +109 -0
  164. package/dist/src/sms/index.d.ts +5 -0
  165. package/dist/src/subscription/admin.router.d.ts +818 -0
  166. package/dist/src/subscription/cron.d.ts +53 -0
  167. package/dist/src/subscription/db.schemas.d.ts +896 -0
  168. package/dist/src/subscription/dto.schemas.d.ts +1942 -0
  169. package/dist/src/subscription/errors/index.d.ts +21 -0
  170. package/dist/src/subscription/errors/locales/zh.d.ts +20 -0
  171. package/dist/src/subscription/index.d.ts +7 -0
  172. package/dist/src/subscription/permissions.d.ts +5 -0
  173. package/dist/src/subscription/router.d.ts +625 -0
  174. package/dist/src/subscription/schema.d.ts +475 -0
  175. package/dist/src/subscription/service.d.ts +306 -0
  176. package/dist/src/team/admin.router.d.ts +569 -0
  177. package/dist/src/team/dto.schemas.d.ts +2110 -0
  178. package/dist/src/team/errors/index.d.ts +12 -0
  179. package/dist/src/team/errors/locales/zh.d.ts +11 -0
  180. package/dist/src/team/index.d.ts +5 -0
  181. package/dist/src/team/permissions.d.ts +7 -0
  182. package/dist/src/team/router.d.ts +737 -0
  183. package/dist/src/team/service.d.ts +40 -0
  184. package/dist/src/transfer/admin.router.d.ts +595 -0
  185. package/dist/src/transfer/db.schemas.d.ts +318 -0
  186. package/dist/src/transfer/dto.schemas.d.ts +4209 -0
  187. package/dist/src/transfer/errors/index.d.ts +32 -0
  188. package/dist/src/transfer/errors/locales/zh.d.ts +19 -0
  189. package/dist/src/transfer/index.d.ts +8 -0
  190. package/dist/src/transfer/permissions.d.ts +8 -0
  191. package/dist/src/transfer/router.d.ts +597 -0
  192. package/dist/src/transfer/schema.d.ts +169 -0
  193. package/dist/src/transfer/service.d.ts +232 -0
  194. package/dist/src/user/admin.router.d.ts +827 -0
  195. package/dist/src/user/db.schemas.d.ts +1038 -0
  196. package/dist/src/user/dto.schemas.d.ts +1446 -0
  197. package/dist/src/user/errors/index.d.ts +38 -0
  198. package/dist/src/user/errors/locales/zh.d.ts +22 -0
  199. package/dist/src/user/index.d.ts +7 -0
  200. package/dist/src/user/permissions.d.ts +7 -0
  201. package/dist/src/user/router.d.ts +560 -0
  202. package/dist/src/user/schema.d.ts +541 -0
  203. package/dist/src/user/service.d.ts +294 -0
  204. package/dist/src/user-kyc/admin.router.d.ts +669 -0
  205. package/dist/src/user-kyc/db.schemas.d.ts +896 -0
  206. package/dist/src/user-kyc/dto.schemas.d.ts +939 -0
  207. package/dist/src/user-kyc/errors/index.d.ts +21 -0
  208. package/dist/src/user-kyc/errors/locales/zh.d.ts +14 -0
  209. package/dist/src/user-kyc/index.d.ts +8 -0
  210. package/dist/src/user-kyc/permissions.d.ts +6 -0
  211. package/dist/src/user-kyc/router.d.ts +602 -0
  212. package/dist/src/user-kyc/schema.d.ts +474 -0
  213. package/dist/src/user-kyc/service.d.ts +170 -0
  214. package/dist/src/user-security/admin.router.d.ts +493 -0
  215. package/dist/src/user-security/db.schemas.d.ts +414 -0
  216. package/dist/src/user-security/dto.schemas.d.ts +36 -0
  217. package/dist/src/user-security/index.d.ts +6 -0
  218. package/dist/src/user-security/router.d.ts +547 -0
  219. package/dist/src/user-security/schema.d.ts +215 -0
  220. package/dist/src/user-security/service.d.ts +51 -0
  221. package/dist/src/utils/date.d.ts +21 -0
  222. package/dist/src/utils/index.d.ts +4 -0
  223. package/dist/src/utils/order.d.ts +6 -0
  224. package/dist/src/utils/pagination.d.ts +113 -0
  225. package/dist/src/utils/password.d.ts +8 -0
  226. package/dist/src/wallet/admin.router.d.ts +616 -0
  227. package/dist/src/wallet/db.schemas.d.ts +278 -0
  228. package/dist/src/wallet/dto.schemas.d.ts +1690 -0
  229. package/dist/src/wallet/ensure.d.ts +11 -0
  230. package/dist/src/wallet/index.d.ts +6 -0
  231. package/dist/src/wallet/router.d.ts +654 -0
  232. package/dist/src/wallet/schema.d.ts +152 -0
  233. package/dist/src/wallet/service.d.ts +225 -0
  234. package/dist/src/wallet-import/admin.router.d.ts +690 -0
  235. package/dist/src/wallet-import/db.schemas.d.ts +1070 -0
  236. package/dist/src/wallet-import/dto.schemas.d.ts +1119 -0
  237. package/dist/src/wallet-import/errors/index.d.ts +17 -0
  238. package/dist/src/wallet-import/errors/locales/zh.d.ts +16 -0
  239. package/dist/src/wallet-import/index.d.ts +8 -0
  240. package/dist/src/wallet-import/permissions.d.ts +7 -0
  241. package/dist/src/wallet-import/schema.d.ts +566 -0
  242. package/dist/src/wallet-import/service.d.ts +101 -0
  243. package/dist/src/wallet-import/worker.d.ts +1 -0
  244. package/dist/src/wallet-transfer/dto.schemas.d.ts +64 -0
  245. package/dist/src/wallet-transfer/errors/index.d.ts +25 -0
  246. package/dist/src/wallet-transfer/errors/locales/zh.d.ts +16 -0
  247. package/dist/src/wallet-transfer/index.d.ts +4 -0
  248. package/dist/src/wallet-transfer/router.d.ts +465 -0
  249. package/dist/src/wallet-transfer/service.d.ts +26 -0
  250. package/dist/src/wallet-type/admin.router.d.ts +767 -0
  251. package/dist/src/wallet-type/constants.d.ts +4 -0
  252. package/dist/src/wallet-type/db.schemas.d.ts +794 -0
  253. package/dist/src/wallet-type/dto.schemas.d.ts +160 -0
  254. package/dist/src/wallet-type/errors/index.d.ts +25 -0
  255. package/dist/src/wallet-type/errors/locales/zh.d.ts +16 -0
  256. package/dist/src/wallet-type/index.d.ts +7 -0
  257. package/dist/src/wallet-type/permissions.d.ts +5 -0
  258. package/dist/src/wallet-type/schema.d.ts +408 -0
  259. package/dist/src/wallet-type/seed.d.ts +4 -0
  260. package/dist/src/wallet-type/service.d.ts +208 -0
  261. package/dist/src/withdraw/admin.router.d.ts +654 -0
  262. package/dist/src/withdraw/db.schemas.d.ts +516 -0
  263. package/dist/src/withdraw/dto.schemas.d.ts +816 -0
  264. package/dist/src/withdraw/errors/index.d.ts +41 -0
  265. package/dist/src/withdraw/errors/locales/zh.d.ts +22 -0
  266. package/dist/src/withdraw/index.d.ts +7 -0
  267. package/dist/src/withdraw/permissions.d.ts +9 -0
  268. package/dist/src/withdraw/router.d.ts +522 -0
  269. package/dist/src/withdraw/schema.d.ts +272 -0
  270. package/dist/src/withdraw/service.d.ts +143 -0
  271. package/package.json +19 -0
@@ -0,0 +1,347 @@
1
+ /**
2
+ * 通知类型枚举
3
+ */
4
+ export declare const notificationTypeEnum: import("drizzle-orm/pg-core").PgEnum<["system", "transaction", "activity", "security"]>;
5
+ /**
6
+ * 通知优先级枚举
7
+ */
8
+ export declare const notificationPriorityEnum: import("drizzle-orm/pg-core").PgEnum<["low", "normal", "high", "urgent"]>;
9
+ /**
10
+ * 收件箱状态枚举
11
+ */
12
+ export declare const notificationInboxStatusEnum: import("drizzle-orm/pg-core").PgEnum<["unread", "read", "archived", "deleted"]>;
13
+ /**
14
+ * 通知内容表
15
+ * 存储通知的实际内容,一条通知可以发送给多个用户
16
+ */
17
+ export declare const notification: import("drizzle-orm/pg-core").PgTableWithColumns<{
18
+ name: "notification";
19
+ schema: undefined;
20
+ columns: {
21
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
22
+ name: "created_at";
23
+ tableName: "notification";
24
+ dataType: "date";
25
+ columnType: "PgTimestamp";
26
+ data: Date;
27
+ driverParam: string;
28
+ notNull: true;
29
+ hasDefault: true;
30
+ isPrimaryKey: false;
31
+ isAutoincrement: false;
32
+ hasRuntimeDefault: false;
33
+ enumValues: undefined;
34
+ baseColumn: never;
35
+ identity: undefined;
36
+ generated: undefined;
37
+ }, {}, {}>;
38
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
39
+ name: "updated_at";
40
+ tableName: "notification";
41
+ dataType: "date";
42
+ columnType: "PgTimestamp";
43
+ data: Date;
44
+ driverParam: string;
45
+ notNull: true;
46
+ hasDefault: true;
47
+ isPrimaryKey: false;
48
+ isAutoincrement: false;
49
+ hasRuntimeDefault: false;
50
+ enumValues: undefined;
51
+ baseColumn: never;
52
+ identity: undefined;
53
+ generated: undefined;
54
+ }, {}, {}>;
55
+ id: import("drizzle-orm/pg-core").PgColumn<{
56
+ name: "id";
57
+ tableName: "notification";
58
+ dataType: "string";
59
+ columnType: "PgUUID";
60
+ data: string;
61
+ driverParam: string;
62
+ notNull: true;
63
+ hasDefault: true;
64
+ isPrimaryKey: true;
65
+ isAutoincrement: false;
66
+ hasRuntimeDefault: false;
67
+ enumValues: undefined;
68
+ baseColumn: never;
69
+ identity: undefined;
70
+ generated: undefined;
71
+ }, {}, {}>;
72
+ type: import("drizzle-orm/pg-core").PgColumn<{
73
+ name: "type";
74
+ tableName: "notification";
75
+ dataType: "string";
76
+ columnType: "PgEnumColumn";
77
+ data: "system" | "transaction" | "activity" | "security";
78
+ driverParam: string;
79
+ notNull: true;
80
+ hasDefault: false;
81
+ isPrimaryKey: false;
82
+ isAutoincrement: false;
83
+ hasRuntimeDefault: false;
84
+ enumValues: ["system", "transaction", "activity", "security"];
85
+ baseColumn: never;
86
+ identity: undefined;
87
+ generated: undefined;
88
+ }, {}, {}>;
89
+ category: import("drizzle-orm/pg-core").PgColumn<{
90
+ name: "category";
91
+ tableName: "notification";
92
+ dataType: "string";
93
+ columnType: "PgText";
94
+ data: string;
95
+ driverParam: string;
96
+ notNull: true;
97
+ hasDefault: false;
98
+ isPrimaryKey: false;
99
+ isAutoincrement: false;
100
+ hasRuntimeDefault: false;
101
+ enumValues: [string, ...string[]];
102
+ baseColumn: never;
103
+ identity: undefined;
104
+ generated: undefined;
105
+ }, {}, {}>;
106
+ title: import("drizzle-orm/pg-core").PgColumn<{
107
+ name: "title";
108
+ tableName: "notification";
109
+ dataType: "string";
110
+ columnType: "PgText";
111
+ data: string;
112
+ driverParam: string;
113
+ notNull: true;
114
+ hasDefault: false;
115
+ isPrimaryKey: false;
116
+ isAutoincrement: false;
117
+ hasRuntimeDefault: false;
118
+ enumValues: [string, ...string[]];
119
+ baseColumn: never;
120
+ identity: undefined;
121
+ generated: undefined;
122
+ }, {}, {}>;
123
+ content: import("drizzle-orm/pg-core").PgColumn<{
124
+ name: "content";
125
+ tableName: "notification";
126
+ dataType: "string";
127
+ columnType: "PgText";
128
+ data: string;
129
+ driverParam: string;
130
+ notNull: true;
131
+ hasDefault: false;
132
+ isPrimaryKey: false;
133
+ isAutoincrement: false;
134
+ hasRuntimeDefault: false;
135
+ enumValues: [string, ...string[]];
136
+ baseColumn: never;
137
+ identity: undefined;
138
+ generated: undefined;
139
+ }, {}, {}>;
140
+ priority: import("drizzle-orm/pg-core").PgColumn<{
141
+ name: "priority";
142
+ tableName: "notification";
143
+ dataType: "string";
144
+ columnType: "PgEnumColumn";
145
+ data: "normal" | "low" | "high" | "urgent";
146
+ driverParam: string;
147
+ notNull: true;
148
+ hasDefault: true;
149
+ isPrimaryKey: false;
150
+ isAutoincrement: false;
151
+ hasRuntimeDefault: false;
152
+ enumValues: ["low", "normal", "high", "urgent"];
153
+ baseColumn: never;
154
+ identity: undefined;
155
+ generated: undefined;
156
+ }, {}, {}>;
157
+ isBroadcast: import("drizzle-orm/pg-core").PgColumn<{
158
+ name: "is_broadcast";
159
+ tableName: "notification";
160
+ dataType: "boolean";
161
+ columnType: "PgBoolean";
162
+ data: boolean;
163
+ driverParam: boolean;
164
+ notNull: true;
165
+ hasDefault: true;
166
+ isPrimaryKey: false;
167
+ isAutoincrement: false;
168
+ hasRuntimeDefault: false;
169
+ enumValues: undefined;
170
+ baseColumn: never;
171
+ identity: undefined;
172
+ generated: undefined;
173
+ }, {}, {}>;
174
+ expiresAt: import("drizzle-orm/pg-core").PgColumn<{
175
+ name: "expires_at";
176
+ tableName: "notification";
177
+ dataType: "date";
178
+ columnType: "PgTimestamp";
179
+ data: Date;
180
+ driverParam: string;
181
+ notNull: false;
182
+ hasDefault: false;
183
+ isPrimaryKey: false;
184
+ isAutoincrement: false;
185
+ hasRuntimeDefault: false;
186
+ enumValues: undefined;
187
+ baseColumn: never;
188
+ identity: undefined;
189
+ generated: undefined;
190
+ }, {}, {}>;
191
+ };
192
+ dialect: "pg";
193
+ }>;
194
+ /**
195
+ * 用户收件箱表
196
+ * 存储每个用户与通知的关系及状态
197
+ */
198
+ export declare const notificationInbox: import("drizzle-orm/pg-core").PgTableWithColumns<{
199
+ name: "notification_inbox";
200
+ schema: undefined;
201
+ columns: {
202
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
203
+ name: "created_at";
204
+ tableName: "notification_inbox";
205
+ dataType: "date";
206
+ columnType: "PgTimestamp";
207
+ data: Date;
208
+ driverParam: string;
209
+ notNull: true;
210
+ hasDefault: true;
211
+ isPrimaryKey: false;
212
+ isAutoincrement: false;
213
+ hasRuntimeDefault: false;
214
+ enumValues: undefined;
215
+ baseColumn: never;
216
+ identity: undefined;
217
+ generated: undefined;
218
+ }, {}, {}>;
219
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
220
+ name: "updated_at";
221
+ tableName: "notification_inbox";
222
+ dataType: "date";
223
+ columnType: "PgTimestamp";
224
+ data: Date;
225
+ driverParam: string;
226
+ notNull: true;
227
+ hasDefault: true;
228
+ isPrimaryKey: false;
229
+ isAutoincrement: false;
230
+ hasRuntimeDefault: false;
231
+ enumValues: undefined;
232
+ baseColumn: never;
233
+ identity: undefined;
234
+ generated: undefined;
235
+ }, {}, {}>;
236
+ id: import("drizzle-orm/pg-core").PgColumn<{
237
+ name: "id";
238
+ tableName: "notification_inbox";
239
+ dataType: "string";
240
+ columnType: "PgUUID";
241
+ data: string;
242
+ driverParam: string;
243
+ notNull: true;
244
+ hasDefault: true;
245
+ isPrimaryKey: true;
246
+ isAutoincrement: false;
247
+ hasRuntimeDefault: false;
248
+ enumValues: undefined;
249
+ baseColumn: never;
250
+ identity: undefined;
251
+ generated: undefined;
252
+ }, {}, {}>;
253
+ notificationId: import("drizzle-orm/pg-core").PgColumn<{
254
+ name: "notification_id";
255
+ tableName: "notification_inbox";
256
+ dataType: "string";
257
+ columnType: "PgUUID";
258
+ data: string;
259
+ driverParam: string;
260
+ notNull: true;
261
+ hasDefault: false;
262
+ isPrimaryKey: false;
263
+ isAutoincrement: false;
264
+ hasRuntimeDefault: false;
265
+ enumValues: undefined;
266
+ baseColumn: never;
267
+ identity: undefined;
268
+ generated: undefined;
269
+ }, {}, {}>;
270
+ userId: import("drizzle-orm/pg-core").PgColumn<{
271
+ name: "user_id";
272
+ tableName: "notification_inbox";
273
+ dataType: "string";
274
+ columnType: "PgText";
275
+ data: string;
276
+ driverParam: string;
277
+ notNull: true;
278
+ hasDefault: false;
279
+ isPrimaryKey: false;
280
+ isAutoincrement: false;
281
+ hasRuntimeDefault: false;
282
+ enumValues: [string, ...string[]];
283
+ baseColumn: never;
284
+ identity: undefined;
285
+ generated: undefined;
286
+ }, {}, {}>;
287
+ status: import("drizzle-orm/pg-core").PgColumn<{
288
+ name: "status";
289
+ tableName: "notification_inbox";
290
+ dataType: "string";
291
+ columnType: "PgEnumColumn";
292
+ data: "archived" | "unread" | "read" | "deleted";
293
+ driverParam: string;
294
+ notNull: true;
295
+ hasDefault: true;
296
+ isPrimaryKey: false;
297
+ isAutoincrement: false;
298
+ hasRuntimeDefault: false;
299
+ enumValues: ["unread", "read", "archived", "deleted"];
300
+ baseColumn: never;
301
+ identity: undefined;
302
+ generated: undefined;
303
+ }, {}, {}>;
304
+ readAt: import("drizzle-orm/pg-core").PgColumn<{
305
+ name: "read_at";
306
+ tableName: "notification_inbox";
307
+ dataType: "date";
308
+ columnType: "PgTimestamp";
309
+ data: Date;
310
+ driverParam: string;
311
+ notNull: false;
312
+ hasDefault: false;
313
+ isPrimaryKey: false;
314
+ isAutoincrement: false;
315
+ hasRuntimeDefault: false;
316
+ enumValues: undefined;
317
+ baseColumn: never;
318
+ identity: undefined;
319
+ generated: undefined;
320
+ }, {}, {}>;
321
+ archivedAt: import("drizzle-orm/pg-core").PgColumn<{
322
+ name: "archived_at";
323
+ tableName: "notification_inbox";
324
+ dataType: "date";
325
+ columnType: "PgTimestamp";
326
+ data: Date;
327
+ driverParam: string;
328
+ notNull: false;
329
+ hasDefault: false;
330
+ isPrimaryKey: false;
331
+ isAutoincrement: false;
332
+ hasRuntimeDefault: false;
333
+ enumValues: undefined;
334
+ baseColumn: never;
335
+ identity: undefined;
336
+ generated: undefined;
337
+ }, {}, {}>;
338
+ };
339
+ dialect: "pg";
340
+ }>;
341
+ export declare const notificationRelations: import("drizzle-orm").Relations<"notification", {
342
+ inboxes: import("drizzle-orm").Many<"notification_inbox">;
343
+ }>;
344
+ export declare const notificationInboxRelations: import("drizzle-orm").Relations<"notification_inbox", {
345
+ notification: import("drizzle-orm").One<"notification", true>;
346
+ user: import("drizzle-orm").One<"user", true>;
347
+ }>;
@@ -0,0 +1,195 @@
1
+ import type { PgTransaction } from "drizzle-orm/pg-core";
2
+ import type { NotificationBatchReadInputType, NotificationCreateInputType, NotificationListQueryType, NotificationStatsResponseType } from "./dto.schemas";
3
+ import { notification } from "./schema";
4
+ /**
5
+ * 通知基础服务(抽象类)
6
+ * 提供共享的验证方法
7
+ */
8
+ declare abstract class BaseNotificationService {
9
+ protected static validateUserId(userId: string): void;
10
+ protected static validateNotificationId(notificationId: string): void;
11
+ }
12
+ /**
13
+ * 用户侧通知服务
14
+ * 用户可以查看自己的通知、标记已读
15
+ */
16
+ export declare abstract class UserNotificationService extends BaseNotificationService {
17
+ /**
18
+ * 查询用户的通知列表(包含系统广播)
19
+ */
20
+ static listNotifications(userId: string, filters?: NotificationListQueryType): Promise<{
21
+ data: {
22
+ id: string;
23
+ createdAt: Date;
24
+ updatedAt: Date;
25
+ userId: string;
26
+ status: "archived" | "unread" | "read" | "deleted";
27
+ archivedAt: Date | null;
28
+ notificationId: string;
29
+ readAt: Date | null;
30
+ notification: {
31
+ type: "system" | "transaction" | "activity" | "security";
32
+ id: string;
33
+ createdAt: Date;
34
+ updatedAt: Date;
35
+ expiresAt: Date | null;
36
+ category: string;
37
+ title: string;
38
+ content: string;
39
+ priority: "normal" | "low" | "high" | "urgent";
40
+ isBroadcast: boolean;
41
+ };
42
+ }[];
43
+ pagination: {
44
+ pageSize: number;
45
+ pageIndex: number;
46
+ total: number;
47
+ totalPages: number;
48
+ hasNextPage: boolean;
49
+ };
50
+ }>;
51
+ /**
52
+ * 获取通知详情
53
+ */
54
+ static getNotification(inboxId: string, userId: string): Promise<{
55
+ id: string;
56
+ createdAt: Date;
57
+ updatedAt: Date;
58
+ userId: string;
59
+ status: "archived" | "unread" | "read" | "deleted";
60
+ archivedAt: Date | null;
61
+ notificationId: string;
62
+ readAt: Date | null;
63
+ notification: {
64
+ type: "system" | "transaction" | "activity" | "security";
65
+ id: string;
66
+ createdAt: Date;
67
+ updatedAt: Date;
68
+ expiresAt: Date | null;
69
+ category: string;
70
+ title: string;
71
+ content: string;
72
+ priority: "normal" | "low" | "high" | "urgent";
73
+ isBroadcast: boolean;
74
+ };
75
+ }>;
76
+ /**
77
+ * 标记通知为已读
78
+ */
79
+ static markAsRead(notificationInboxId: string, userId: string): Promise<{
80
+ id: string;
81
+ createdAt: Date;
82
+ updatedAt: Date;
83
+ userId: string;
84
+ status: "archived" | "unread" | "read" | "deleted";
85
+ archivedAt: Date | null;
86
+ notificationId: string;
87
+ readAt: Date | null;
88
+ } | {
89
+ createdAt: Date;
90
+ updatedAt: Date;
91
+ id: string;
92
+ notificationId: string;
93
+ userId: string;
94
+ status: "archived" | "unread" | "read" | "deleted";
95
+ readAt: Date | null;
96
+ archivedAt: Date | null;
97
+ }[]>;
98
+ /**
99
+ * 批量标记已读
100
+ */
101
+ static batchMarkAsRead(userId: string, input: NotificationBatchReadInputType): Promise<{
102
+ count: number;
103
+ }>;
104
+ /**
105
+ * 获取未读通知数量
106
+ */
107
+ static getUnreadCount(userId: string): Promise<number>;
108
+ }
109
+ /**
110
+ * 管理员通知服务
111
+ * 管理员可以创建通知、查看所有通知、查看统计
112
+ */
113
+ export declare abstract class AdminNotificationService extends BaseNotificationService {
114
+ /**
115
+ * 创建通知并发送给指定用户
116
+ */
117
+ static createNotification(data: NotificationCreateInputType): Promise<{
118
+ type: "system" | "transaction" | "activity" | "security";
119
+ id: string;
120
+ createdAt: Date;
121
+ updatedAt: Date;
122
+ expiresAt: Date | null;
123
+ category: string;
124
+ title: string;
125
+ content: string;
126
+ priority: "normal" | "low" | "high" | "urgent";
127
+ isBroadcast: boolean;
128
+ }>;
129
+ /**
130
+ * 为广播通知创建所有用户的 inbox 记录(异步)
131
+ */
132
+ private static createBroadcastInboxAsync;
133
+ /**
134
+ * 查询通知列表(管理员视角,查看所有通知内容)
135
+ */
136
+ static listNotifications(filters?: NotificationListQueryType): Promise<{
137
+ data: {
138
+ sentCount: number;
139
+ readCount: number;
140
+ status: "unread";
141
+ readAt: null;
142
+ createdAt: Date;
143
+ updatedAt: Date;
144
+ id: string;
145
+ type: "system" | "transaction" | "activity" | "security";
146
+ category: string;
147
+ title: string;
148
+ content: string;
149
+ priority: "normal" | "low" | "high" | "urgent";
150
+ isBroadcast: boolean;
151
+ expiresAt: Date | null;
152
+ }[];
153
+ pagination: {
154
+ pageSize: number;
155
+ pageIndex: number;
156
+ total: number;
157
+ totalPages: number;
158
+ hasNextPage: boolean;
159
+ };
160
+ }>;
161
+ /**
162
+ * 获取统计数据
163
+ */
164
+ static getStats(): Promise<NotificationStatsResponseType>;
165
+ }
166
+ /**
167
+ * 内部通知服务
168
+ * 供其他模块内部调用的业务逻辑,无权限控制
169
+ */
170
+ export declare abstract class InternalNotificationService extends BaseNotificationService {
171
+ /**
172
+ * 创建单用户通知并写入收件箱
173
+ */
174
+ static createUserNotification(tx: PgTransaction<any, any, any>, data: {
175
+ userId: string;
176
+ type: (typeof notification.$inferInsert)["type"];
177
+ category: string;
178
+ title: string;
179
+ content: string;
180
+ priority?: (typeof notification.$inferInsert)["priority"];
181
+ expiresAt?: Date | null | undefined;
182
+ }): Promise<{
183
+ type: "system" | "transaction" | "activity" | "security";
184
+ id: string;
185
+ createdAt: Date;
186
+ updatedAt: Date;
187
+ expiresAt: Date | null;
188
+ category: string;
189
+ title: string;
190
+ content: string;
191
+ priority: "normal" | "low" | "high" | "urgent";
192
+ isBroadcast: boolean;
193
+ }>;
194
+ }
195
+ export {};