@lark-apaas/coding-template-nestjs-react-fullstack 0.1.0-alpha.1

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 (250) hide show
  1. package/LICENSE +13 -0
  2. package/README.md +41 -0
  3. package/hooks/after-install.mjs +3 -0
  4. package/hooks/after-render.mjs +3 -0
  5. package/hooks/before-render.mjs +3 -0
  6. package/package.json +36 -0
  7. package/template/.codebase/pipelines/ci.yaml +34 -0
  8. package/template/.codebase/pipelines/coco-code-review.yaml +21 -0
  9. package/template/.prettierrc +8 -0
  10. package/template/.spark_project +16 -0
  11. package/template/.stylelintrc.js +12 -0
  12. package/template/_env.local +38 -0
  13. package/template/_gitignore +64 -0
  14. package/template/_npmrc +1 -0
  15. package/template/client/index.html +23 -0
  16. package/template/client/public/favicon.svg +40 -0
  17. package/template/client/src/api/index.ts +19 -0
  18. package/template/client/src/app.tsx +22 -0
  19. package/template/client/src/components/Layout.tsx +11 -0
  20. package/template/client/src/components/business-ui/README.md +519 -0
  21. package/template/client/src/components/business-ui/api/chats/queries.ts +39 -0
  22. package/template/client/src/components/business-ui/api/chats/service.ts +29 -0
  23. package/template/client/src/components/business-ui/api/departments/queries.ts +42 -0
  24. package/template/client/src/components/business-ui/api/departments/service.ts +18 -0
  25. package/template/client/src/components/business-ui/api/files/service.ts +28 -0
  26. package/template/client/src/components/business-ui/api/user-profiles/queries.ts +42 -0
  27. package/template/client/src/components/business-ui/api/user-profiles/service.ts +23 -0
  28. package/template/client/src/components/business-ui/api/users/queries.ts +34 -0
  29. package/template/client/src/components/business-ui/api/users/service.ts +40 -0
  30. package/template/client/src/components/business-ui/chat-select/README.md +128 -0
  31. package/template/client/src/components/business-ui/chat-select/chat-item.tsx +85 -0
  32. package/template/client/src/components/business-ui/chat-select/chat-select-tag.tsx +83 -0
  33. package/template/client/src/components/business-ui/chat-select/chat-select.tsx +197 -0
  34. package/template/client/src/components/business-ui/chat-select/index.tsx +12 -0
  35. package/template/client/src/components/business-ui/chat-select/types.ts +102 -0
  36. package/template/client/src/components/business-ui/chat-select/use-chat-value.ts +180 -0
  37. package/template/client/src/components/business-ui/chat-select/utils.ts +81 -0
  38. package/template/client/src/components/business-ui/department-select/department-item.tsx +55 -0
  39. package/template/client/src/components/business-ui/department-select/department-select-field.tsx +86 -0
  40. package/template/client/src/components/business-ui/department-select/department-select-tag.tsx +56 -0
  41. package/template/client/src/components/business-ui/department-select/department-select.tsx +168 -0
  42. package/template/client/src/components/business-ui/department-select/icon-department.tsx +22 -0
  43. package/template/client/src/components/business-ui/department-select/index.tsx +7 -0
  44. package/template/client/src/components/business-ui/department-select/types.ts +15 -0
  45. package/template/client/src/components/business-ui/department-select/utils.ts +17 -0
  46. package/template/client/src/components/business-ui/entity-combobox/base-combobox-content.tsx +35 -0
  47. package/template/client/src/components/business-ui/entity-combobox/base-combobox-empty.tsx +28 -0
  48. package/template/client/src/components/business-ui/entity-combobox/base-combobox-error.tsx +35 -0
  49. package/template/client/src/components/business-ui/entity-combobox/base-combobox-item.tsx +55 -0
  50. package/template/client/src/components/business-ui/entity-combobox/base-combobox-list.tsx +174 -0
  51. package/template/client/src/components/business-ui/entity-combobox/base-combobox-loading.tsx +19 -0
  52. package/template/client/src/components/business-ui/entity-combobox/base-combobox-search.tsx +31 -0
  53. package/template/client/src/components/business-ui/entity-combobox/base-combobox-trigger.tsx +281 -0
  54. package/template/client/src/components/business-ui/entity-combobox/base-combobox.tsx +132 -0
  55. package/template/client/src/components/business-ui/entity-combobox/context.tsx +19 -0
  56. package/template/client/src/components/business-ui/entity-combobox/entity-combobox.tsx +145 -0
  57. package/template/client/src/components/business-ui/entity-combobox/highlight-text.tsx +52 -0
  58. package/template/client/src/components/business-ui/entity-combobox/hooks.tsx +21 -0
  59. package/template/client/src/components/business-ui/entity-combobox/index.tsx +31 -0
  60. package/template/client/src/components/business-ui/entity-combobox/item-pill.tsx +179 -0
  61. package/template/client/src/components/business-ui/entity-combobox/popover-wrapper.tsx +149 -0
  62. package/template/client/src/components/business-ui/entity-combobox/search-trigger.tsx +262 -0
  63. package/template/client/src/components/business-ui/entity-combobox/shared-types.ts +296 -0
  64. package/template/client/src/components/business-ui/entity-combobox/size-variants.tsx +322 -0
  65. package/template/client/src/components/business-ui/entity-combobox/types.ts +246 -0
  66. package/template/client/src/components/business-ui/entity-combobox/use-fetch-data.tsx +81 -0
  67. package/template/client/src/components/business-ui/entity-combobox/use-infinite-scroll.tsx +99 -0
  68. package/template/client/src/components/business-ui/entity-combobox/use-popover-outside-click.tsx +32 -0
  69. package/template/client/src/components/business-ui/form/checkbox-field.tsx +83 -0
  70. package/template/client/src/components/business-ui/form/context.tsx +38 -0
  71. package/template/client/src/components/business-ui/form/field-layout.tsx +91 -0
  72. package/template/client/src/components/business-ui/form/form.tsx +54 -0
  73. package/template/client/src/components/business-ui/form/hooks/form-context.tsx +4 -0
  74. package/template/client/src/components/business-ui/form/hooks/form-utils.ts +23 -0
  75. package/template/client/src/components/business-ui/form/hooks/form.tsx +40 -0
  76. package/template/client/src/components/business-ui/form/index.tsx +4 -0
  77. package/template/client/src/components/business-ui/form/input-field.tsx +74 -0
  78. package/template/client/src/components/business-ui/form/radio-group-field.tsx +138 -0
  79. package/template/client/src/components/business-ui/form/select-field.tsx +155 -0
  80. package/template/client/src/components/business-ui/form/switch-field.tsx +66 -0
  81. package/template/client/src/components/business-ui/form/textarea-field.tsx +72 -0
  82. package/template/client/src/components/business-ui/form/types.ts +32 -0
  83. package/template/client/src/components/business-ui/tiptap-editor/README.md +324 -0
  84. package/template/client/src/components/business-ui/tiptap-editor/components/attachment-toolbar-button.tsx +74 -0
  85. package/template/client/src/components/business-ui/tiptap-editor/components/blockquote-toolbar-button.tsx +41 -0
  86. package/template/client/src/components/business-ui/tiptap-editor/components/code-block-toolbar-button.tsx +41 -0
  87. package/template/client/src/components/business-ui/tiptap-editor/components/color-highlight-toolbar-button.tsx +141 -0
  88. package/template/client/src/components/business-ui/tiptap-editor/components/heading-toolbar-button.tsx +99 -0
  89. package/template/client/src/components/business-ui/tiptap-editor/components/horizontal-rule-toolbar-button.tsx +39 -0
  90. package/template/client/src/components/business-ui/tiptap-editor/components/image-upload-toolbar-button.tsx +65 -0
  91. package/template/client/src/components/business-ui/tiptap-editor/components/link-edit-form.tsx +127 -0
  92. package/template/client/src/components/business-ui/tiptap-editor/components/link-hover-toolbar.tsx +380 -0
  93. package/template/client/src/components/business-ui/tiptap-editor/components/link-toolbar-button.tsx +96 -0
  94. package/template/client/src/components/business-ui/tiptap-editor/components/list-toolbar-button.tsx +75 -0
  95. package/template/client/src/components/business-ui/tiptap-editor/components/mark-toolbar-button.tsx +118 -0
  96. package/template/client/src/components/business-ui/tiptap-editor/components/text-align-toolbar-button.tsx +84 -0
  97. package/template/client/src/components/business-ui/tiptap-editor/components/undo-redo-toolbar-button.tsx +54 -0
  98. package/template/client/src/components/business-ui/tiptap-editor/extensions/attachment.tsx +539 -0
  99. package/template/client/src/components/business-ui/tiptap-editor/extensions/code-block-shiki.tsx +236 -0
  100. package/template/client/src/components/business-ui/tiptap-editor/extensions/complete-kit.ts +260 -0
  101. package/template/client/src/components/business-ui/tiptap-editor/extensions/image.tsx +456 -0
  102. package/template/client/src/components/business-ui/tiptap-editor/hooks/use-tiptap-editor.ts +47 -0
  103. package/template/client/src/components/business-ui/tiptap-editor/index.ts +38 -0
  104. package/template/client/src/components/business-ui/tiptap-editor/tiptap-editor-complete.tsx +112 -0
  105. package/template/client/src/components/business-ui/tiptap-editor/tiptap-editor.tsx +169 -0
  106. package/template/client/src/components/business-ui/types/user.ts +74 -0
  107. package/template/client/src/components/business-ui/user-display/index.tsx +2 -0
  108. package/template/client/src/components/business-ui/user-display/overflow-tooltip-text.tsx +90 -0
  109. package/template/client/src/components/business-ui/user-display/type.ts +27 -0
  110. package/template/client/src/components/business-ui/user-display/user-display.tsx +99 -0
  111. package/template/client/src/components/business-ui/user-display/user-with-avatar.tsx +158 -0
  112. package/template/client/src/components/business-ui/user-display/utils.ts +37 -0
  113. package/template/client/src/components/business-ui/user-profile/error-image.tsx +302 -0
  114. package/template/client/src/components/business-ui/user-profile/user-external-script.ts +73 -0
  115. package/template/client/src/components/business-ui/user-profile/user-profile.tsx +370 -0
  116. package/template/client/src/components/business-ui/user-select/index.tsx +28 -0
  117. package/template/client/src/components/business-ui/user-select/types.ts +109 -0
  118. package/template/client/src/components/business-ui/user-select/use-user-value.ts +160 -0
  119. package/template/client/src/components/business-ui/user-select/user-item.tsx +98 -0
  120. package/template/client/src/components/business-ui/user-select/user-pill.tsx +140 -0
  121. package/template/client/src/components/business-ui/user-select/user-select-tag.tsx +82 -0
  122. package/template/client/src/components/business-ui/user-select/user-select.tsx +359 -0
  123. package/template/client/src/components/business-ui/user-select/utils.tsx +188 -0
  124. package/template/client/src/components/business-ui/utils/user.ts +72 -0
  125. package/template/client/src/components/ui/README.md +134 -0
  126. package/template/client/src/components/ui/accordion.tsx +66 -0
  127. package/template/client/src/components/ui/alert-dialog.tsx +157 -0
  128. package/template/client/src/components/ui/alert.tsx +71 -0
  129. package/template/client/src/components/ui/aspect-ratio.tsx +11 -0
  130. package/template/client/src/components/ui/avatar.tsx +53 -0
  131. package/template/client/src/components/ui/badge.tsx +42 -0
  132. package/template/client/src/components/ui/breadcrumb.tsx +109 -0
  133. package/template/client/src/components/ui/button-group.tsx +83 -0
  134. package/template/client/src/components/ui/button.tsx +69 -0
  135. package/template/client/src/components/ui/calendar.tsx +213 -0
  136. package/template/client/src/components/ui/card.tsx +82 -0
  137. package/template/client/src/components/ui/carousel.tsx +241 -0
  138. package/template/client/src/components/ui/chart.tsx +357 -0
  139. package/template/client/src/components/ui/checkbox.tsx +32 -0
  140. package/template/client/src/components/ui/collapsible.tsx +33 -0
  141. package/template/client/src/components/ui/command.tsx +208 -0
  142. package/template/client/src/components/ui/context-menu.tsx +324 -0
  143. package/template/client/src/components/ui/dialog.tsx +143 -0
  144. package/template/client/src/components/ui/drawer.tsx +135 -0
  145. package/template/client/src/components/ui/dropdown-menu.tsx +329 -0
  146. package/template/client/src/components/ui/empty.tsx +104 -0
  147. package/template/client/src/components/ui/field.tsx +248 -0
  148. package/template/client/src/components/ui/form.tsx +167 -0
  149. package/template/client/src/components/ui/hover-card.tsx +44 -0
  150. package/template/client/src/components/ui/icons/file-ae-colorful-icon.tsx +21 -0
  151. package/template/client/src/components/ui/icons/file-ai-colorful-icon.tsx +36 -0
  152. package/template/client/src/components/ui/icons/file-android-colorful-icon.tsx +33 -0
  153. package/template/client/src/components/ui/icons/file-audio-colorful-icon.tsx +21 -0
  154. package/template/client/src/components/ui/icons/file-code-colorful-icon.tsx +28 -0
  155. package/template/client/src/components/ui/icons/file-csv-colorful-icon.tsx +21 -0
  156. package/template/client/src/components/ui/icons/file-eml-colorful-icon.tsx +29 -0
  157. package/template/client/src/components/ui/icons/file-ios-colorful-icon.tsx +25 -0
  158. package/template/client/src/components/ui/icons/file-keynote-colorful-icon.tsx +29 -0
  159. package/template/client/src/components/ui/icons/file-pages-colorful-icon.tsx +29 -0
  160. package/template/client/src/components/ui/icons/file-ps-colorful-icon.tsx +21 -0
  161. package/template/client/src/components/ui/icons/file-sketch-colorful-icon.tsx +21 -0
  162. package/template/client/src/components/ui/icons/file-slide-colorful-icon.tsx +21 -0
  163. package/template/client/src/components/ui/icons/file-vcf-colorful-icon.tsx +29 -0
  164. package/template/client/src/components/ui/icons/file-wiki-excel-colorful-icon.tsx +23 -0
  165. package/template/client/src/components/ui/icons/file-wiki-image-colorful-icon.tsx +27 -0
  166. package/template/client/src/components/ui/icons/file-wiki-pdf-colorful-icon.tsx +20 -0
  167. package/template/client/src/components/ui/icons/file-wiki-ppt-colorful-icon.tsx +21 -0
  168. package/template/client/src/components/ui/icons/file-wiki-text-colorful-icon.tsx +12 -0
  169. package/template/client/src/components/ui/icons/file-wiki-unknown-colorful-icon.tsx +14 -0
  170. package/template/client/src/components/ui/icons/file-wiki-video-colorful-icon.tsx +23 -0
  171. package/template/client/src/components/ui/icons/file-wiki-word-colorful-icon.tsx +38 -0
  172. package/template/client/src/components/ui/icons/file-wiki-zip-colorful-icon.tsx +21 -0
  173. package/template/client/src/components/ui/image.tsx +183 -0
  174. package/template/client/src/components/ui/input-group.tsx +166 -0
  175. package/template/client/src/components/ui/input-otp.tsx +77 -0
  176. package/template/client/src/components/ui/input.tsx +21 -0
  177. package/template/client/src/components/ui/item.tsx +193 -0
  178. package/template/client/src/components/ui/kbd.tsx +28 -0
  179. package/template/client/src/components/ui/label.tsx +24 -0
  180. package/template/client/src/components/ui/menubar.tsx +348 -0
  181. package/template/client/src/components/ui/native-select.tsx +48 -0
  182. package/template/client/src/components/ui/navigation-menu.tsx +168 -0
  183. package/template/client/src/components/ui/pagination.tsx +127 -0
  184. package/template/client/src/components/ui/popover.tsx +48 -0
  185. package/template/client/src/components/ui/progress.tsx +31 -0
  186. package/template/client/src/components/ui/radio-group.tsx +45 -0
  187. package/template/client/src/components/ui/resizable.tsx +56 -0
  188. package/template/client/src/components/ui/scroll-area.tsx +58 -0
  189. package/template/client/src/components/ui/select.tsx +243 -0
  190. package/template/client/src/components/ui/separator.tsx +28 -0
  191. package/template/client/src/components/ui/sheet.tsx +139 -0
  192. package/template/client/src/components/ui/sidebar.tsx +727 -0
  193. package/template/client/src/components/ui/skeleton.tsx +13 -0
  194. package/template/client/src/components/ui/slider.tsx +87 -0
  195. package/template/client/src/components/ui/sonner.tsx +67 -0
  196. package/template/client/src/components/ui/spinner.tsx +16 -0
  197. package/template/client/src/components/ui/streamdown.tsx +186 -0
  198. package/template/client/src/components/ui/switch.tsx +31 -0
  199. package/template/client/src/components/ui/table.tsx +116 -0
  200. package/template/client/src/components/ui/tabs.tsx +66 -0
  201. package/template/client/src/components/ui/textarea.tsx +18 -0
  202. package/template/client/src/components/ui/toggle-group.tsx +83 -0
  203. package/template/client/src/components/ui/toggle.tsx +47 -0
  204. package/template/client/src/components/ui/tooltip.tsx +61 -0
  205. package/template/client/src/hooks/use-example.ts +52 -0
  206. package/template/client/src/hooks/use-mobile.ts +19 -0
  207. package/template/client/src/index.css +7 -0
  208. package/template/client/src/index.tsx +36 -0
  209. package/template/client/src/lib/shiki.ts +92 -0
  210. package/template/client/src/lib/utils.ts +6 -0
  211. package/template/client/src/pages/ExamplePage/ExamplePage.tsx +37 -0
  212. package/template/client/src/pages/NotFound/NotFound.tsx +11 -0
  213. package/template/client/src/tailwind-theme.css +257 -0
  214. package/template/client/src/types/common.ts +34 -0
  215. package/template/client/src/types/global.d.ts +53 -0
  216. package/template/client/src/types/index.ts +4 -0
  217. package/template/client/src/typography.css +41 -0
  218. package/template/client/src/utils/img-resources/avatar-placeholders.ts +12 -0
  219. package/template/client/src/utils/img-resources/banner-placeholders.ts +29 -0
  220. package/template/client/src/utils/img-resources/cover-placeholders.ts +47 -0
  221. package/template/components.json +21 -0
  222. package/template/eslint.config.js +50 -0
  223. package/template/nest-cli.json +25 -0
  224. package/template/package-lock.json +29195 -0
  225. package/template/package.json +202 -0
  226. package/template/postcss.config.js +10 -0
  227. package/template/scripts/build.sh +120 -0
  228. package/template/scripts/dev.js +295 -0
  229. package/template/scripts/dev.sh +2 -0
  230. package/template/scripts/lint.js +150 -0
  231. package/template/scripts/prune-smart.js +281 -0
  232. package/template/scripts/run.sh +5 -0
  233. package/template/server/app.module.ts +27 -0
  234. package/template/server/common/constants/api_response_code.ts +54 -0
  235. package/template/server/common/filters/exception.filter.ts +78 -0
  236. package/template/server/common/interfaces/api_response.interface.ts +21 -0
  237. package/template/server/common/interfaces/exception.interface.ts +19 -0
  238. package/template/server/database/schema.ts +90 -0
  239. package/template/server/main.ts +31 -0
  240. package/template/server/modules/hello/hello.controller.ts +16 -0
  241. package/template/server/modules/hello/hello.module.ts +10 -0
  242. package/template/server/modules/hello/hello.service.ts +28 -0
  243. package/template/server/modules/view/view.controller.ts +17 -0
  244. package/template/server/modules/view/view.module.ts +8 -0
  245. package/template/shared/api.interface.ts +1 -0
  246. package/template/tailwind.config.ts +9 -0
  247. package/template/tsconfig.app.json +23 -0
  248. package/template/tsconfig.json +8 -0
  249. package/template/tsconfig.node.json +16 -0
  250. package/template/vite.config.ts +10 -0
@@ -0,0 +1,90 @@
1
+ /** auto generated, do not edit */
2
+ import { pgTable, pgPolicy, uuid, varchar, text, customType } from "drizzle-orm/pg-core"
3
+ import { sql } from "drizzle-orm"
4
+
5
+ export const userProfile = customType<{
6
+ data: string;
7
+ driverData: string;
8
+ }>({
9
+ dataType() {
10
+ return 'user_profile';
11
+ },
12
+ toDriver(value: string) {
13
+ return sql`ROW(${value})::user_profile`;
14
+ },
15
+ fromDriver(value: string) {
16
+ const [userId] = value.slice(1, -1).split(',');
17
+ return userId.trim();
18
+ },
19
+ });
20
+
21
+ export type FileAttachment = {
22
+ bucket_id: string;
23
+ file_path: string;
24
+ };
25
+
26
+ export const fileAttachment = customType<{
27
+ data: FileAttachment;
28
+ driverData: string;
29
+ }>({
30
+ dataType() {
31
+ return 'file_attachment';
32
+ },
33
+ toDriver(value: FileAttachment) {
34
+ return sql`ROW(${value.bucket_id},${value.file_path})::file_attachment`;
35
+ },
36
+ fromDriver(value: string): FileAttachment {
37
+ const [bucketId, filePath] = value.slice(1, -1).split(',');
38
+ return { bucket_id: bucketId.trim(), file_path: filePath.trim() };
39
+ },
40
+ });
41
+
42
+ export const customTimestamptz = customType<{
43
+ data: Date;
44
+ driverData: string;
45
+ config: { precision?: number};
46
+ }>({
47
+ dataType(config) {
48
+ const precision = typeof config?.precision !== 'undefined'
49
+ ? ` (${config.precision})`
50
+ : '';
51
+ return `timestamptz${precision}`;
52
+ },
53
+ toDriver(value: Date | string | number){
54
+ if(value == null) return value as any;
55
+ if (typeof value === 'number') {
56
+ return new Date(value).toISOString();
57
+ }
58
+ if(typeof value === 'string') {
59
+ return value;
60
+ }
61
+ if (value instanceof Date) {
62
+ return value.toISOString();
63
+ }
64
+ throw new Error('Invalid timestamp value');
65
+ },
66
+ fromDriver(value: string | Date): Date {
67
+ if(value instanceof Date) return value;
68
+ return new Date(value);
69
+ },
70
+ });
71
+
72
+ /**
73
+ * 以下是模板代码,仅作示例
74
+ */
75
+ // export const record = pgTable("record", {
76
+ // id: uuid().defaultRandom().notNull(),
77
+ // title: varchar({ length: 255 }).notNull(),
78
+ // type: varchar({ length: 255 }).notNull(),
79
+ // creator: varchar({ length: 255 }).notNull(),
80
+ // speakDate: customTimestamptz("speakDate").notNull(),
81
+ // userProfile: userProfile("user_profile").notNull(),
82
+ // // System field: Creation time (auto-filled, do not modify)
83
+ // createdAt: customTimestamptz("_created_at").default(sql`CURRENT_TIMESTAMP`).notNull(),
84
+ // // System field: Creator (auto-filled, do not modify)
85
+ // createdBy: userProfile("_created_by"),
86
+ // // System field: Update time (auto-filled, do not modify)
87
+ // updatedAt: customTimestamptz("_updated_at").default(sql`CURRENT_TIMESTAMP`).notNull(),
88
+ // // System field: Updater (auto-filled, do not modify)
89
+ // updatedBy: userProfile("_updated_by"),
90
+ // });
@@ -0,0 +1,31 @@
1
+ import { NestFactory } from '@nestjs/core';
2
+ import { Logger } from '@nestjs/common';
3
+ import { configureApp } from '@lark-apaas/fullstack-nestjs-core';
4
+ import { join } from 'path';
5
+ import { __express as hbsExpressEngine } from 'hbs';
6
+
7
+ import type { NestExpressApplication } from '@nestjs/platform-express';
8
+ import { AppModule } from './app.module';
9
+
10
+ async function bootstrap() {
11
+ const app = await NestFactory.create<NestExpressApplication>(AppModule, {
12
+ abortOnError: process.env.NODE_ENV !== 'development',
13
+ });
14
+ await configureApp(app, {
15
+ disableSwagger: true,
16
+ });
17
+ const logger = new Logger('Bootstrap');
18
+ const host = process.env.SERVER_HOST || 'localhost';
19
+ const port = Number(process.env.SERVER_PORT || '3000');
20
+
21
+ // 注册视图引擎, 渲染 client 目录下的 html 文件
22
+ app.setBaseViewsDir(join(process.cwd(), 'dist/client'));
23
+ app.setViewEngine('html');
24
+ app.engine('html', hbsExpressEngine);
25
+
26
+ await app.listen(port, host);
27
+ logger.log(`Server running on ${host}:${port}`);
28
+ logger.log(`API endpoints ready at http://${host}:${port}/api`);
29
+ }
30
+
31
+ bootstrap();
@@ -0,0 +1,16 @@
1
+ // /* 模板代码 仅作示例 */
2
+ // import { Controller, Get, Post, Put, Delete, Body, Param, Query, Req, ParseIntPipe } from '@nestjs/common';
3
+ // import type { Request } from 'express';
4
+ // import { HelloService } from './hello.service';
5
+
6
+ // @Controller('api/hello')
7
+ // export class HelloController {
8
+ // constructor(private readonly helloService: HelloService) {}
9
+
10
+ // @Get('test')
11
+ // async test(@Req() req: Request, @Query('limit') limit?: string) {
12
+ // const { userId } = req.userContext;
13
+ // const limitNum = limit ? parseInt(limit) : 5;
14
+ // return this.helloService.test(userId, limitNum);
15
+ // }
16
+ // }
@@ -0,0 +1,10 @@
1
+ /* 模板代码 仅作示例 */
2
+ // import { Module } from '@nestjs/common';
3
+ // import { HelloController } from './hello.controller';
4
+ // import { HelloService } from './hello.service';
5
+
6
+ // @Module({
7
+ // controllers: [HelloController],
8
+ // providers: [HelloService],
9
+ // })
10
+ // export class HelloModule{}
@@ -0,0 +1,28 @@
1
+ // /* 模板代码 仅作示例 */
2
+ // import { Injectable, Inject, Logger } from '@nestjs/common';
3
+ // import { DRIZZLE_DATABASE, type PostgresJsDatabase } from '@lark-apaas/fullstack-nestjs-core';
4
+ // import { record } from '@server/database/schema';
5
+ // import { eq, and, count, desc, sql, gte, lte, or } from 'drizzle-orm';
6
+
7
+ // @Injectable()
8
+ // export class HelloService {
9
+ // private readonly logger = new Logger(HelloService.name);
10
+
11
+ // constructor(@Inject(DRIZZLE_DATABASE) private readonly db: PostgresJsDatabase) {}
12
+
13
+ // async test(userId: string, limit: number = 5) {
14
+ // try {
15
+ // const results = await this.db
16
+ // .select()
17
+ // .from(record)
18
+ // .where(eq(record.userProfile, userId))
19
+ // .orderBy(desc(record.speakDate))
20
+ // .limit(limit);
21
+
22
+ // return results;
23
+ // } catch (error) {
24
+ // this.logger.error('获取最近记录失败', error);
25
+ // throw error;
26
+ // }
27
+ // }
28
+ // }
@@ -0,0 +1,17 @@
1
+ import { Controller, Get, Render, Req } from '@nestjs/common';
2
+ import type { Request } from 'express';
3
+
4
+ @Controller()
5
+ export class ViewController {
6
+
7
+ @Get(['/', '*'])
8
+ @Render('index')
9
+ async render(@Req() req: Request): Promise<{ __platform__: string }> {
10
+ // you can add custom render params here
11
+ const platformData = req.__platform_data__ ?? {};
12
+ return {
13
+ // don't delete this line, it's used by client to get platform info
14
+ __platform__: JSON.stringify(platformData),
15
+ };
16
+ }
17
+ }
@@ -0,0 +1,8 @@
1
+ import { Module } from '@nestjs/common';
2
+ import { ViewController } from './view.controller';
3
+
4
+ @Module({
5
+ controllers: [ViewController],
6
+ providers: [],
7
+ })
8
+ export class ViewModule{}
@@ -0,0 +1 @@
1
+ /* 前后端共享的类型写在这里 */
@@ -0,0 +1,9 @@
1
+ import { createTailwindPresetOfSimple } from '@lark-apaas/fullstack-presets';
2
+
3
+ export default {
4
+ presets: [createTailwindPresetOfSimple()],
5
+ content: [
6
+ './client/src/**/*.{ts,tsx,css}',
7
+ ],
8
+ plugins: [],
9
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "extends": "@lark-apaas/fullstack-presets/lib/simple/tsconfig/tsconfig.app.json",
3
+ "compilerOptions": {
4
+ "baseUrl": "./",
5
+ "paths": {
6
+ "@client/*": ["client/*"],
7
+ "@shared/*": ["shared/*"],
8
+ "@/*": ["./client/src/*"],
9
+ "@lark-apaas/client-toolkit/tools/*": ["node_modules/@lark-apaas/client-toolkit/lib/apis/tools/*"]
10
+ },
11
+ "incremental": true,
12
+ },
13
+ "include": [
14
+ "client/**/*",
15
+ "shared/**/*"
16
+ ],
17
+ "exclude": [
18
+ "node_modules",
19
+ "dist",
20
+ "public",
21
+ "client/src/api/gen"
22
+ ]
23
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "./tsconfig.app.json",
3
+ "references": [
4
+ {
5
+ "path": "./tsconfig.node.json"
6
+ }
7
+ ]
8
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "extends": "@lark-apaas/fullstack-presets/lib/simple/tsconfig/tsconfig.node.json",
3
+ "compilerOptions": {
4
+ "baseUrl": "./",
5
+ "outDir": "./dist",
6
+ "paths": {
7
+ "@server/*": ["server/*"],
8
+ "@shared/*": ["shared/*"],
9
+ }
10
+ },
11
+ "watchOptions": {
12
+ "excludeDirectories": ["node_modules/**"]
13
+ },
14
+ "include": ["server/**/*", "shared/**/*.ts"],
15
+ "exclude": ["node_modules", "dist", "client", "**/*.spec.ts", "**/*.e2e-spec.ts"],
16
+ }
@@ -0,0 +1,10 @@
1
+ import path from 'path';
2
+ import { defineConfig } from '@lark-apaas/fullstack-vite-preset';
3
+
4
+ export default defineConfig({
5
+ resolve: {
6
+ alias: {
7
+ '@': path.resolve(__dirname, 'client/src'),
8
+ },
9
+ },
10
+ });