@nextsparkjs/core 0.1.0-beta.81 → 0.1.0-beta.83

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 (376) hide show
  1. package/dist/components/entities/wrappers/EntityDetailWrapper.d.ts.map +1 -1
  2. package/dist/components/entities/wrappers/EntityDetailWrapper.js +11 -39
  3. package/dist/hooks/useEntityQuery.d.ts.map +1 -1
  4. package/dist/hooks/useEntityQuery.js +21 -3
  5. package/dist/lib/theme/get-default-theme-mode.d.ts +11 -0
  6. package/dist/lib/theme/get-default-theme-mode.d.ts.map +1 -1
  7. package/dist/lib/theme/get-default-theme-mode.js +42 -25
  8. package/dist/styles/classes.json +1 -1
  9. package/dist/templates/next.config.mjs +5 -2
  10. package/dist/types/theme.d.ts +2 -0
  11. package/dist/types/theme.d.ts.map +1 -1
  12. package/package.json +16 -16
  13. package/scripts/build/docs-registry.mjs +0 -0
  14. package/scripts/create-theme.mjs +0 -0
  15. package/scripts/deploy/release-version.mjs +0 -0
  16. package/scripts/deploy/vercel-deploy.mjs +0 -0
  17. package/scripts/dev/watch-plugins.mjs +0 -0
  18. package/scripts/maintenance/update-core.mjs +0 -0
  19. package/scripts/setup/npm-postinstall.mjs +0 -0
  20. package/scripts/setup/setup-claude.mjs +0 -0
  21. package/scripts/validation/check-imports.sh +0 -0
  22. package/templates/next.config.mjs +5 -2
  23. package/dist/templates/app/(auth)/forgot-password/page.tsx +0 -216
  24. package/dist/templates/app/(auth)/layout.tsx +0 -51
  25. package/dist/templates/app/(auth)/login/page.tsx +0 -21
  26. package/dist/templates/app/(auth)/reset-password/page.tsx +0 -212
  27. package/dist/templates/app/(auth)/signup/page.tsx +0 -21
  28. package/dist/templates/app/(auth)/verify-email/page.tsx +0 -190
  29. package/dist/templates/app/(public)/[...slug]/page.tsx +0 -378
  30. package/dist/templates/app/(public)/docs/[section]/[page]/page.tsx +0 -90
  31. package/dist/templates/app/(public)/docs/layout.tsx +0 -25
  32. package/dist/templates/app/(public)/docs/page.tsx +0 -81
  33. package/dist/templates/app/(public)/layout.tsx +0 -41
  34. package/dist/templates/app/(public)/page.tsx +0 -19
  35. package/dist/templates/app/403/page.tsx +0 -89
  36. package/dist/templates/app/api/auth/[...all]/route.ts +0 -78
  37. package/dist/templates/app/api/cron/billing/lifecycle/route.ts +0 -98
  38. package/dist/templates/app/api/csp-report/route.ts +0 -175
  39. package/dist/templates/app/api/devtools/config/entities/route.ts +0 -108
  40. package/dist/templates/app/api/devtools/config/theme/route.ts +0 -66
  41. package/dist/templates/app/api/devtools/tests/[...path]/route.ts +0 -130
  42. package/dist/templates/app/api/devtools/tests/route.ts +0 -134
  43. package/dist/templates/app/api/health/route.ts +0 -29
  44. package/dist/templates/app/api/internal/user-metadata/route.ts +0 -36
  45. package/dist/templates/app/api/superadmin/subscriptions/route.ts +0 -310
  46. package/dist/templates/app/api/superadmin/teams/[teamId]/route.ts +0 -286
  47. package/dist/templates/app/api/superadmin/teams/route.ts +0 -188
  48. package/dist/templates/app/api/superadmin/users/[userId]/route.ts +0 -540
  49. package/dist/templates/app/api/superadmin/users/route.ts +0 -323
  50. package/dist/templates/app/api/user/delete-account/route.ts +0 -55
  51. package/dist/templates/app/api/user/plan-flags/route.ts +0 -283
  52. package/dist/templates/app/api/user/profile/route.ts +0 -133
  53. package/dist/templates/app/api/v1/[entity]/[id]/child/[childType]/[childId]/route.ts +0 -210
  54. package/dist/templates/app/api/v1/[entity]/[id]/child/[childType]/route.ts +0 -331
  55. package/dist/templates/app/api/v1/[entity]/[id]/route.ts +0 -35
  56. package/dist/templates/app/api/v1/[entity]/docs.md +0 -369
  57. package/dist/templates/app/api/v1/[entity]/presets.ts +0 -194
  58. package/dist/templates/app/api/v1/[entity]/route.ts +0 -31
  59. package/dist/templates/app/api/v1/api-keys/[id]/route.ts +0 -303
  60. package/dist/templates/app/api/v1/api-keys/docs.md +0 -101
  61. package/dist/templates/app/api/v1/api-keys/presets.ts +0 -31
  62. package/dist/templates/app/api/v1/api-keys/route.ts +0 -250
  63. package/dist/templates/app/api/v1/auth/docs.md +0 -184
  64. package/dist/templates/app/api/v1/auth/presets.ts +0 -44
  65. package/dist/templates/app/api/v1/auth/signup-with-invite/route.ts +0 -227
  66. package/dist/templates/app/api/v1/billing/cancel/route.ts +0 -206
  67. package/dist/templates/app/api/v1/billing/change-plan/route.ts +0 -97
  68. package/dist/templates/app/api/v1/billing/check-action/route.ts +0 -81
  69. package/dist/templates/app/api/v1/billing/checkout/route.ts +0 -124
  70. package/dist/templates/app/api/v1/billing/docs.md +0 -209
  71. package/dist/templates/app/api/v1/billing/plans/route.ts +0 -85
  72. package/dist/templates/app/api/v1/billing/portal/route.ts +0 -90
  73. package/dist/templates/app/api/v1/billing/presets.ts +0 -121
  74. package/dist/templates/app/api/v1/billing/webhooks/stripe/route.ts +0 -428
  75. package/dist/templates/app/api/v1/blocks/[slug]/route.ts +0 -29
  76. package/dist/templates/app/api/v1/blocks/docs.md +0 -173
  77. package/dist/templates/app/api/v1/blocks/presets.ts +0 -121
  78. package/dist/templates/app/api/v1/blocks/route.ts +0 -45
  79. package/dist/templates/app/api/v1/blocks/validate/route.ts +0 -45
  80. package/dist/templates/app/api/v1/cron/docs.md +0 -116
  81. package/dist/templates/app/api/v1/cron/presets.ts +0 -26
  82. package/dist/templates/app/api/v1/cron/process/route.ts +0 -108
  83. package/dist/templates/app/api/v1/devtools/blocks/route.ts +0 -82
  84. package/dist/templates/app/api/v1/devtools/docs/route.ts +0 -150
  85. package/dist/templates/app/api/v1/devtools/docs.md +0 -204
  86. package/dist/templates/app/api/v1/devtools/features/route.ts +0 -61
  87. package/dist/templates/app/api/v1/devtools/flows/route.ts +0 -61
  88. package/dist/templates/app/api/v1/devtools/presets.ts +0 -113
  89. package/dist/templates/app/api/v1/devtools/scheduled-actions/route.ts +0 -120
  90. package/dist/templates/app/api/v1/devtools/testing/route.ts +0 -82
  91. package/dist/templates/app/api/v1/media/docs.md +0 -117
  92. package/dist/templates/app/api/v1/media/presets.ts +0 -24
  93. package/dist/templates/app/api/v1/media/upload/route.ts +0 -150
  94. package/dist/templates/app/api/v1/patterns/[id]/usages/route.ts +0 -116
  95. package/dist/templates/app/api/v1/plugin/[...path]/route.ts +0 -373
  96. package/dist/templates/app/api/v1/plugin/docs.md +0 -79
  97. package/dist/templates/app/api/v1/plugin/presets.ts +0 -21
  98. package/dist/templates/app/api/v1/plugin/route.ts +0 -96
  99. package/dist/templates/app/api/v1/post-categories/[id]/route.ts +0 -255
  100. package/dist/templates/app/api/v1/post-categories/docs.md +0 -134
  101. package/dist/templates/app/api/v1/post-categories/presets.ts +0 -78
  102. package/dist/templates/app/api/v1/post-categories/route.ts +0 -119
  103. package/dist/templates/app/api/v1/team-invitations/[token]/accept/route.ts +0 -179
  104. package/dist/templates/app/api/v1/team-invitations/[token]/decline/route.ts +0 -120
  105. package/dist/templates/app/api/v1/team-invitations/[token]/route.ts +0 -89
  106. package/dist/templates/app/api/v1/team-invitations/docs.md +0 -88
  107. package/dist/templates/app/api/v1/team-invitations/presets.ts +0 -43
  108. package/dist/templates/app/api/v1/team-invitations/route.ts +0 -114
  109. package/dist/templates/app/api/v1/teams/[teamId]/invitations/route.ts +0 -171
  110. package/dist/templates/app/api/v1/teams/[teamId]/invoices/[invoiceNumber]/route.ts +0 -105
  111. package/dist/templates/app/api/v1/teams/[teamId]/invoices/route.ts +0 -125
  112. package/dist/templates/app/api/v1/teams/[teamId]/members/[memberId]/route.ts +0 -263
  113. package/dist/templates/app/api/v1/teams/[teamId]/members/route.ts +0 -358
  114. package/dist/templates/app/api/v1/teams/[teamId]/route.ts +0 -322
  115. package/dist/templates/app/api/v1/teams/[teamId]/subscription/route.ts +0 -50
  116. package/dist/templates/app/api/v1/teams/[teamId]/usage/[limitSlug]/route.ts +0 -91
  117. package/dist/templates/app/api/v1/teams/docs.md +0 -320
  118. package/dist/templates/app/api/v1/teams/presets.ts +0 -178
  119. package/dist/templates/app/api/v1/teams/route.ts +0 -293
  120. package/dist/templates/app/api/v1/teams/switch/route.ts +0 -88
  121. package/dist/templates/app/api/v1/theme/[...path]/route.ts +0 -361
  122. package/dist/templates/app/api/v1/theme/docs.md +0 -74
  123. package/dist/templates/app/api/v1/theme/presets.ts +0 -21
  124. package/dist/templates/app/api/v1/theme/route.ts +0 -96
  125. package/dist/templates/app/api/v1/users/[id]/meta/[key]/route.ts +0 -363
  126. package/dist/templates/app/api/v1/users/[id]/route.ts +0 -302
  127. package/dist/templates/app/api/v1/users/docs.md +0 -93
  128. package/dist/templates/app/api/v1/users/presets.ts +0 -59
  129. package/dist/templates/app/api/v1/users/route.ts +0 -197
  130. package/dist/templates/app/dashboard/(main)/[entity]/[id]/edit/page.tsx +0 -117
  131. package/dist/templates/app/dashboard/(main)/[entity]/[id]/page.tsx +0 -103
  132. package/dist/templates/app/dashboard/(main)/[entity]/create/page.tsx +0 -95
  133. package/dist/templates/app/dashboard/(main)/[entity]/error.tsx +0 -51
  134. package/dist/templates/app/dashboard/(main)/[entity]/layout.tsx +0 -113
  135. package/dist/templates/app/dashboard/(main)/[entity]/loading.tsx +0 -61
  136. package/dist/templates/app/dashboard/(main)/[entity]/page.tsx +0 -90
  137. package/dist/templates/app/dashboard/(main)/layout.tsx +0 -98
  138. package/dist/templates/app/dashboard/(main)/loading.tsx +0 -5
  139. package/dist/templates/app/dashboard/(main)/page.tsx +0 -201
  140. package/dist/templates/app/dashboard/(main)/patterns/[id]/edit/page.tsx +0 -114
  141. package/dist/templates/app/dashboard/(main)/patterns/[id]/page.tsx +0 -20
  142. package/dist/templates/app/dashboard/(main)/patterns/[id]/reports/page.tsx +0 -171
  143. package/dist/templates/app/dashboard/(main)/patterns/create/page.tsx +0 -86
  144. package/dist/templates/app/dashboard/(main)/patterns/page.tsx +0 -444
  145. package/dist/templates/app/dashboard/features/analytics/page.tsx +0 -35
  146. package/dist/templates/app/dashboard/features/automation/page.tsx +0 -35
  147. package/dist/templates/app/dashboard/features/layout.tsx +0 -13
  148. package/dist/templates/app/dashboard/features/loading.tsx +0 -5
  149. package/dist/templates/app/dashboard/features/webhooks/page.tsx +0 -35
  150. package/dist/templates/app/dashboard/layout.tsx +0 -86
  151. package/dist/templates/app/dashboard/permission-denied/page.tsx +0 -29
  152. package/dist/templates/app/dashboard/settings/api-keys/loading.tsx +0 -5
  153. package/dist/templates/app/dashboard/settings/api-keys/page.tsx +0 -513
  154. package/dist/templates/app/dashboard/settings/billing/loading.tsx +0 -5
  155. package/dist/templates/app/dashboard/settings/billing/page.tsx +0 -284
  156. package/dist/templates/app/dashboard/settings/invoices/[invoiceNumber]/page.tsx +0 -222
  157. package/dist/templates/app/dashboard/settings/invoices/loading.tsx +0 -5
  158. package/dist/templates/app/dashboard/settings/invoices/page.tsx +0 -82
  159. package/dist/templates/app/dashboard/settings/layout.tsx +0 -151
  160. package/dist/templates/app/dashboard/settings/loading.tsx +0 -5
  161. package/dist/templates/app/dashboard/settings/notifications/loading.tsx +0 -5
  162. package/dist/templates/app/dashboard/settings/notifications/page.tsx +0 -462
  163. package/dist/templates/app/dashboard/settings/page.tsx +0 -92
  164. package/dist/templates/app/dashboard/settings/password/loading.tsx +0 -5
  165. package/dist/templates/app/dashboard/settings/password/page.tsx +0 -306
  166. package/dist/templates/app/dashboard/settings/plans/loading.tsx +0 -5
  167. package/dist/templates/app/dashboard/settings/plans/page.tsx +0 -40
  168. package/dist/templates/app/dashboard/settings/profile/loading.tsx +0 -5
  169. package/dist/templates/app/dashboard/settings/profile/page.tsx +0 -686
  170. package/dist/templates/app/dashboard/settings/security/loading.tsx +0 -5
  171. package/dist/templates/app/dashboard/settings/security/page.tsx +0 -505
  172. package/dist/templates/app/dashboard/settings/teams/loading.tsx +0 -5
  173. package/dist/templates/app/dashboard/settings/teams/page.tsx +0 -272
  174. package/dist/templates/app/dashboard/settings/teams/permissions/page.tsx +0 -92
  175. package/dist/templates/app/devtools/blocks/[slug]/page.tsx +0 -39
  176. package/dist/templates/app/devtools/blocks/page.tsx +0 -31
  177. package/dist/templates/app/devtools/config/page.tsx +0 -31
  178. package/dist/templates/app/devtools/features/page.tsx +0 -31
  179. package/dist/templates/app/devtools/flows/page.tsx +0 -31
  180. package/dist/templates/app/devtools/layout.tsx +0 -58
  181. package/dist/templates/app/devtools/page.tsx +0 -121
  182. package/dist/templates/app/devtools/scheduled-actions/page.tsx +0 -157
  183. package/dist/templates/app/devtools/style/page.tsx +0 -330
  184. package/dist/templates/app/devtools/tags/page.tsx +0 -31
  185. package/dist/templates/app/devtools/tests/[[...path]]/page.tsx +0 -47
  186. package/dist/templates/app/favicon.ico +0 -0
  187. package/dist/templates/app/globals.css +0 -12
  188. package/dist/templates/app/layout.tsx +0 -96
  189. package/dist/templates/app/public/page.tsx +0 -30
  190. package/dist/templates/app/superadmin/docs/[section]/[page]/page.tsx +0 -92
  191. package/dist/templates/app/superadmin/docs/page.tsx +0 -75
  192. package/dist/templates/app/superadmin/layout.tsx +0 -67
  193. package/dist/templates/app/superadmin/page.tsx +0 -149
  194. package/dist/templates/app/superadmin/subscriptions/page.tsx +0 -655
  195. package/dist/templates/app/superadmin/team-roles/page.tsx +0 -493
  196. package/dist/templates/app/superadmin/teams/[teamId]/page.tsx +0 -687
  197. package/dist/templates/app/superadmin/teams/page.tsx +0 -302
  198. package/dist/templates/app/superadmin/users/[userId]/page.tsx +0 -548
  199. package/dist/templates/app/superadmin/users/page.tsx +0 -528
  200. package/templates/app/(auth)/forgot-password/page.tsx +0 -216
  201. package/templates/app/(auth)/layout.tsx +0 -51
  202. package/templates/app/(auth)/login/page.tsx +0 -21
  203. package/templates/app/(auth)/reset-password/page.tsx +0 -212
  204. package/templates/app/(auth)/signup/page.tsx +0 -21
  205. package/templates/app/(auth)/verify-email/page.tsx +0 -190
  206. package/templates/app/(public)/[...slug]/page.tsx +0 -378
  207. package/templates/app/(public)/docs/[section]/[page]/page.tsx +0 -90
  208. package/templates/app/(public)/docs/layout.tsx +0 -25
  209. package/templates/app/(public)/docs/page.tsx +0 -81
  210. package/templates/app/(public)/layout.tsx +0 -41
  211. package/templates/app/(public)/page.tsx +0 -19
  212. package/templates/app/403/page.tsx +0 -89
  213. package/templates/app/api/auth/[...all]/route.ts +0 -78
  214. package/templates/app/api/cron/billing/lifecycle/route.ts +0 -98
  215. package/templates/app/api/csp-report/route.ts +0 -175
  216. package/templates/app/api/devtools/config/entities/route.ts +0 -108
  217. package/templates/app/api/devtools/config/theme/route.ts +0 -66
  218. package/templates/app/api/devtools/tests/[...path]/route.ts +0 -130
  219. package/templates/app/api/devtools/tests/route.ts +0 -134
  220. package/templates/app/api/health/route.ts +0 -29
  221. package/templates/app/api/internal/user-metadata/route.ts +0 -36
  222. package/templates/app/api/superadmin/subscriptions/route.ts +0 -310
  223. package/templates/app/api/superadmin/teams/[teamId]/route.ts +0 -286
  224. package/templates/app/api/superadmin/teams/route.ts +0 -188
  225. package/templates/app/api/superadmin/users/[userId]/route.ts +0 -540
  226. package/templates/app/api/superadmin/users/route.ts +0 -323
  227. package/templates/app/api/user/delete-account/route.ts +0 -55
  228. package/templates/app/api/user/plan-flags/route.ts +0 -283
  229. package/templates/app/api/user/profile/route.ts +0 -133
  230. package/templates/app/api/v1/[entity]/[id]/child/[childType]/[childId]/route.ts +0 -210
  231. package/templates/app/api/v1/[entity]/[id]/child/[childType]/route.ts +0 -331
  232. package/templates/app/api/v1/[entity]/[id]/route.ts +0 -35
  233. package/templates/app/api/v1/[entity]/docs.md +0 -369
  234. package/templates/app/api/v1/[entity]/presets.ts +0 -194
  235. package/templates/app/api/v1/[entity]/route.ts +0 -31
  236. package/templates/app/api/v1/api-keys/[id]/route.ts +0 -303
  237. package/templates/app/api/v1/api-keys/docs.md +0 -101
  238. package/templates/app/api/v1/api-keys/presets.ts +0 -31
  239. package/templates/app/api/v1/api-keys/route.ts +0 -250
  240. package/templates/app/api/v1/auth/docs.md +0 -184
  241. package/templates/app/api/v1/auth/presets.ts +0 -44
  242. package/templates/app/api/v1/auth/signup-with-invite/route.ts +0 -227
  243. package/templates/app/api/v1/billing/cancel/route.ts +0 -206
  244. package/templates/app/api/v1/billing/change-plan/route.ts +0 -97
  245. package/templates/app/api/v1/billing/check-action/route.ts +0 -81
  246. package/templates/app/api/v1/billing/checkout/route.ts +0 -124
  247. package/templates/app/api/v1/billing/docs.md +0 -209
  248. package/templates/app/api/v1/billing/plans/route.ts +0 -85
  249. package/templates/app/api/v1/billing/portal/route.ts +0 -90
  250. package/templates/app/api/v1/billing/presets.ts +0 -121
  251. package/templates/app/api/v1/billing/webhooks/stripe/route.ts +0 -428
  252. package/templates/app/api/v1/blocks/[slug]/route.ts +0 -29
  253. package/templates/app/api/v1/blocks/docs.md +0 -173
  254. package/templates/app/api/v1/blocks/presets.ts +0 -121
  255. package/templates/app/api/v1/blocks/route.ts +0 -45
  256. package/templates/app/api/v1/blocks/validate/route.ts +0 -45
  257. package/templates/app/api/v1/cron/docs.md +0 -116
  258. package/templates/app/api/v1/cron/presets.ts +0 -26
  259. package/templates/app/api/v1/cron/process/route.ts +0 -108
  260. package/templates/app/api/v1/devtools/blocks/route.ts +0 -82
  261. package/templates/app/api/v1/devtools/docs/route.ts +0 -150
  262. package/templates/app/api/v1/devtools/docs.md +0 -204
  263. package/templates/app/api/v1/devtools/features/route.ts +0 -61
  264. package/templates/app/api/v1/devtools/flows/route.ts +0 -61
  265. package/templates/app/api/v1/devtools/presets.ts +0 -113
  266. package/templates/app/api/v1/devtools/scheduled-actions/route.ts +0 -120
  267. package/templates/app/api/v1/devtools/testing/route.ts +0 -82
  268. package/templates/app/api/v1/media/docs.md +0 -117
  269. package/templates/app/api/v1/media/presets.ts +0 -24
  270. package/templates/app/api/v1/media/upload/route.ts +0 -150
  271. package/templates/app/api/v1/patterns/[id]/usages/route.ts +0 -116
  272. package/templates/app/api/v1/plugin/[...path]/route.ts +0 -373
  273. package/templates/app/api/v1/plugin/docs.md +0 -79
  274. package/templates/app/api/v1/plugin/presets.ts +0 -21
  275. package/templates/app/api/v1/plugin/route.ts +0 -96
  276. package/templates/app/api/v1/post-categories/[id]/route.ts +0 -255
  277. package/templates/app/api/v1/post-categories/docs.md +0 -134
  278. package/templates/app/api/v1/post-categories/presets.ts +0 -78
  279. package/templates/app/api/v1/post-categories/route.ts +0 -119
  280. package/templates/app/api/v1/team-invitations/[token]/accept/route.ts +0 -179
  281. package/templates/app/api/v1/team-invitations/[token]/decline/route.ts +0 -120
  282. package/templates/app/api/v1/team-invitations/[token]/route.ts +0 -89
  283. package/templates/app/api/v1/team-invitations/docs.md +0 -88
  284. package/templates/app/api/v1/team-invitations/presets.ts +0 -43
  285. package/templates/app/api/v1/team-invitations/route.ts +0 -114
  286. package/templates/app/api/v1/teams/[teamId]/invitations/route.ts +0 -171
  287. package/templates/app/api/v1/teams/[teamId]/invoices/[invoiceNumber]/route.ts +0 -105
  288. package/templates/app/api/v1/teams/[teamId]/invoices/route.ts +0 -125
  289. package/templates/app/api/v1/teams/[teamId]/members/[memberId]/route.ts +0 -263
  290. package/templates/app/api/v1/teams/[teamId]/members/route.ts +0 -358
  291. package/templates/app/api/v1/teams/[teamId]/route.ts +0 -322
  292. package/templates/app/api/v1/teams/[teamId]/subscription/route.ts +0 -50
  293. package/templates/app/api/v1/teams/[teamId]/usage/[limitSlug]/route.ts +0 -91
  294. package/templates/app/api/v1/teams/docs.md +0 -320
  295. package/templates/app/api/v1/teams/presets.ts +0 -178
  296. package/templates/app/api/v1/teams/route.ts +0 -293
  297. package/templates/app/api/v1/teams/switch/route.ts +0 -88
  298. package/templates/app/api/v1/theme/[...path]/route.ts +0 -361
  299. package/templates/app/api/v1/theme/docs.md +0 -74
  300. package/templates/app/api/v1/theme/presets.ts +0 -21
  301. package/templates/app/api/v1/theme/route.ts +0 -96
  302. package/templates/app/api/v1/users/[id]/meta/[key]/route.ts +0 -363
  303. package/templates/app/api/v1/users/[id]/route.ts +0 -302
  304. package/templates/app/api/v1/users/docs.md +0 -93
  305. package/templates/app/api/v1/users/presets.ts +0 -59
  306. package/templates/app/api/v1/users/route.ts +0 -197
  307. package/templates/app/dashboard/(main)/[entity]/[id]/edit/page.tsx +0 -117
  308. package/templates/app/dashboard/(main)/[entity]/[id]/page.tsx +0 -103
  309. package/templates/app/dashboard/(main)/[entity]/create/page.tsx +0 -95
  310. package/templates/app/dashboard/(main)/[entity]/error.tsx +0 -51
  311. package/templates/app/dashboard/(main)/[entity]/layout.tsx +0 -113
  312. package/templates/app/dashboard/(main)/[entity]/loading.tsx +0 -61
  313. package/templates/app/dashboard/(main)/[entity]/page.tsx +0 -90
  314. package/templates/app/dashboard/(main)/layout.tsx +0 -98
  315. package/templates/app/dashboard/(main)/loading.tsx +0 -5
  316. package/templates/app/dashboard/(main)/page.tsx +0 -201
  317. package/templates/app/dashboard/(main)/patterns/[id]/edit/page.tsx +0 -114
  318. package/templates/app/dashboard/(main)/patterns/[id]/page.tsx +0 -20
  319. package/templates/app/dashboard/(main)/patterns/[id]/reports/page.tsx +0 -171
  320. package/templates/app/dashboard/(main)/patterns/create/page.tsx +0 -86
  321. package/templates/app/dashboard/(main)/patterns/page.tsx +0 -444
  322. package/templates/app/dashboard/features/analytics/page.tsx +0 -35
  323. package/templates/app/dashboard/features/automation/page.tsx +0 -35
  324. package/templates/app/dashboard/features/layout.tsx +0 -13
  325. package/templates/app/dashboard/features/loading.tsx +0 -5
  326. package/templates/app/dashboard/features/webhooks/page.tsx +0 -35
  327. package/templates/app/dashboard/layout.tsx +0 -86
  328. package/templates/app/dashboard/permission-denied/page.tsx +0 -29
  329. package/templates/app/dashboard/settings/api-keys/loading.tsx +0 -5
  330. package/templates/app/dashboard/settings/api-keys/page.tsx +0 -513
  331. package/templates/app/dashboard/settings/billing/loading.tsx +0 -5
  332. package/templates/app/dashboard/settings/billing/page.tsx +0 -284
  333. package/templates/app/dashboard/settings/invoices/[invoiceNumber]/page.tsx +0 -222
  334. package/templates/app/dashboard/settings/invoices/loading.tsx +0 -5
  335. package/templates/app/dashboard/settings/invoices/page.tsx +0 -82
  336. package/templates/app/dashboard/settings/layout.tsx +0 -151
  337. package/templates/app/dashboard/settings/loading.tsx +0 -5
  338. package/templates/app/dashboard/settings/notifications/loading.tsx +0 -5
  339. package/templates/app/dashboard/settings/notifications/page.tsx +0 -462
  340. package/templates/app/dashboard/settings/page.tsx +0 -92
  341. package/templates/app/dashboard/settings/password/loading.tsx +0 -5
  342. package/templates/app/dashboard/settings/password/page.tsx +0 -306
  343. package/templates/app/dashboard/settings/plans/loading.tsx +0 -5
  344. package/templates/app/dashboard/settings/plans/page.tsx +0 -40
  345. package/templates/app/dashboard/settings/profile/loading.tsx +0 -5
  346. package/templates/app/dashboard/settings/profile/page.tsx +0 -686
  347. package/templates/app/dashboard/settings/security/loading.tsx +0 -5
  348. package/templates/app/dashboard/settings/security/page.tsx +0 -505
  349. package/templates/app/dashboard/settings/teams/loading.tsx +0 -5
  350. package/templates/app/dashboard/settings/teams/page.tsx +0 -272
  351. package/templates/app/dashboard/settings/teams/permissions/page.tsx +0 -92
  352. package/templates/app/devtools/blocks/[slug]/page.tsx +0 -39
  353. package/templates/app/devtools/blocks/page.tsx +0 -31
  354. package/templates/app/devtools/config/page.tsx +0 -31
  355. package/templates/app/devtools/features/page.tsx +0 -31
  356. package/templates/app/devtools/flows/page.tsx +0 -31
  357. package/templates/app/devtools/layout.tsx +0 -58
  358. package/templates/app/devtools/page.tsx +0 -121
  359. package/templates/app/devtools/scheduled-actions/page.tsx +0 -157
  360. package/templates/app/devtools/style/page.tsx +0 -330
  361. package/templates/app/devtools/tags/page.tsx +0 -31
  362. package/templates/app/devtools/tests/[[...path]]/page.tsx +0 -47
  363. package/templates/app/favicon.ico +0 -0
  364. package/templates/app/globals.css +0 -12
  365. package/templates/app/layout.tsx +0 -96
  366. package/templates/app/public/page.tsx +0 -30
  367. package/templates/app/superadmin/docs/[section]/[page]/page.tsx +0 -92
  368. package/templates/app/superadmin/docs/page.tsx +0 -75
  369. package/templates/app/superadmin/layout.tsx +0 -67
  370. package/templates/app/superadmin/page.tsx +0 -149
  371. package/templates/app/superadmin/subscriptions/page.tsx +0 -655
  372. package/templates/app/superadmin/team-roles/page.tsx +0 -493
  373. package/templates/app/superadmin/teams/[teamId]/page.tsx +0 -687
  374. package/templates/app/superadmin/teams/page.tsx +0 -302
  375. package/templates/app/superadmin/users/[userId]/page.tsx +0 -548
  376. package/templates/app/superadmin/users/page.tsx +0 -528
@@ -1,255 +0,0 @@
1
- import { NextRequest, NextResponse } from 'next/server'
2
- import { authenticateRequest } from '@nextsparkjs/core/lib/api/auth/dual-auth'
3
- import { query as dbQuery } from '@nextsparkjs/core/lib/db'
4
- import { z } from 'zod'
5
-
6
- const updateCategorySchema = z.object({
7
- name: z.string().min(1).max(255).optional(),
8
- slug: z.string().min(2).max(100).regex(/^[a-z0-9-]+$/, 'Slug must be lowercase alphanumeric with dashes').optional(),
9
- description: z.string().optional(),
10
- icon: z.string().optional(),
11
- color: z.string().optional(),
12
- parentId: z.string().optional(),
13
- order: z.number().int().optional(),
14
- isDefault: z.boolean().optional(),
15
- isActive: z.boolean().optional()
16
- })
17
-
18
- // GET /api/v1/post-categories/:id - Get category by ID
19
- export async function GET(
20
- request: NextRequest,
21
- { params }: { params: Promise<{ id: string }> }
22
- ): Promise<NextResponse> {
23
- try {
24
- const { id } = await params
25
-
26
- const result = await dbQuery(
27
- `SELECT id, name, slug, description, icon, color, "parentId", "order", "isDefault", "isActive",
28
- "createdAt", "updatedAt"
29
- FROM taxonomies
30
- WHERE id = $1 AND type = 'post_category' AND "deletedAt" IS NULL`,
31
- [id]
32
- )
33
-
34
- if (result.rows.length === 0) {
35
- return NextResponse.json({ success: false, error: 'Category not found' }, { status: 404 })
36
- }
37
-
38
- return NextResponse.json({
39
- success: true,
40
- data: result.rows[0]
41
- })
42
- } catch (err) {
43
- console.error('Error in post-categories API:', err)
44
- return NextResponse.json({ success: false, error: 'Internal server error' }, { status: 500 })
45
- }
46
- }
47
-
48
- // PUT /api/v1/post-categories/:id - Update category
49
- export async function PUT(
50
- request: NextRequest,
51
- { params }: { params: Promise<{ id: string }> }
52
- ): Promise<NextResponse> {
53
- try {
54
- // Dual authentication: API key or session
55
- const authResult = await authenticateRequest(request)
56
- if (!authResult.success || !authResult.user) {
57
- return NextResponse.json({ success: false, error: 'Unauthorized' }, { status: 401 })
58
- }
59
-
60
- const body = await request.json()
61
- const data = updateCategorySchema.parse(body)
62
- const { id } = await params
63
-
64
- // Verify this is a post_category taxonomy
65
- const typeCheck = await dbQuery(
66
- 'SELECT id FROM taxonomies WHERE id = $1 AND type = \'post_category\'',
67
- [id]
68
- )
69
-
70
- if (typeCheck.rows.length === 0) {
71
- return NextResponse.json({ success: false, error: 'Category not found' }, { status: 404 })
72
- }
73
-
74
- // Check slug uniqueness if slug is being updated
75
- if (data.slug) {
76
- const slugCheck = await dbQuery(
77
- 'SELECT id FROM taxonomies WHERE type = \'post_category\' AND slug = $1 AND id != $2',
78
- [data.slug, id]
79
- )
80
- if (slugCheck.rows.length > 0) {
81
- return NextResponse.json(
82
- { success: false, error: 'A category with this slug already exists' },
83
- { status: 409 }
84
- )
85
- }
86
- }
87
-
88
- // Verify parentId exists if provided
89
- if (data.parentId) {
90
- const parentCheck = await dbQuery(
91
- 'SELECT id FROM taxonomies WHERE id = $1 AND type = \'post_category\'',
92
- [data.parentId]
93
- )
94
- if (parentCheck.rows.length === 0) {
95
- return NextResponse.json({
96
- success: false,
97
- error: 'Parent category not found'
98
- }, { status: 400 })
99
- }
100
-
101
- // Prevent circular reference
102
- if (data.parentId === id) {
103
- return NextResponse.json({
104
- success: false,
105
- error: 'A category cannot be its own parent'
106
- }, { status: 400 })
107
- }
108
- }
109
-
110
- // Build the update query dynamically based on provided fields
111
- const updates: string[] = []
112
- const values: unknown[] = []
113
- let paramIndex = 1
114
-
115
- if (data.name !== undefined) {
116
- updates.push(`name = $${paramIndex++}`)
117
- values.push(data.name)
118
- }
119
- if (data.slug !== undefined) {
120
- updates.push(`slug = $${paramIndex++}`)
121
- values.push(data.slug)
122
- }
123
- if (data.description !== undefined) {
124
- updates.push(`description = $${paramIndex++}`)
125
- values.push(data.description || null)
126
- }
127
- if (data.icon !== undefined) {
128
- updates.push(`icon = $${paramIndex++}`)
129
- values.push(data.icon || null)
130
- }
131
- if (data.color !== undefined) {
132
- updates.push(`color = $${paramIndex++}`)
133
- values.push(data.color || null)
134
- }
135
- if (data.parentId !== undefined) {
136
- updates.push(`"parentId" = $${paramIndex++}`)
137
- values.push(data.parentId || null)
138
- }
139
- if (data.order !== undefined) {
140
- updates.push(`"order" = $${paramIndex++}`)
141
- values.push(data.order)
142
- }
143
- if (data.isDefault !== undefined) {
144
- updates.push(`"isDefault" = $${paramIndex++}`)
145
- values.push(data.isDefault)
146
- }
147
- if (data.isActive !== undefined) {
148
- updates.push(`"isActive" = $${paramIndex++}`)
149
- values.push(data.isActive)
150
- }
151
-
152
- // Only update if there are fields to update
153
- if (updates.length === 0) {
154
- // No fields to update, just return current data
155
- const current = await dbQuery(
156
- `SELECT id, name, slug, description, icon, color, "parentId", "order", "isDefault", "isActive",
157
- "createdAt", "updatedAt"
158
- FROM taxonomies WHERE id = $1`,
159
- [id]
160
- )
161
- return NextResponse.json({ success: true, data: current.rows[0] })
162
- }
163
-
164
- // Add the id as the last parameter
165
- values.push(id)
166
-
167
- const query = `UPDATE taxonomies SET ${updates.join(', ')} WHERE id = $${paramIndex} RETURNING *`
168
- const result = await dbQuery(query, values)
169
-
170
- if (result.rows.length === 0) {
171
- return NextResponse.json({ success: false, error: 'Category not found' }, { status: 404 })
172
- }
173
-
174
- return NextResponse.json({
175
- success: true,
176
- data: result.rows[0]
177
- })
178
- } catch (err) {
179
- console.error('Error in post-categories API PUT:', err)
180
- if (err instanceof z.ZodError) {
181
- return NextResponse.json({ success: false, error: 'Validation error', details: err.issues }, { status: 400 })
182
- }
183
- const errorMessage = err instanceof Error ? err.message : 'Internal server error'
184
- return NextResponse.json({ success: false, error: errorMessage }, { status: 500 })
185
- }
186
- }
187
-
188
- // DELETE /api/v1/post-categories/:id - Delete category
189
- export async function DELETE(
190
- request: NextRequest,
191
- { params }: { params: Promise<{ id: string }> }
192
- ): Promise<NextResponse> {
193
- try {
194
- // Dual authentication: API key or session
195
- const authResult = await authenticateRequest(request)
196
- if (!authResult.success || !authResult.user) {
197
- return NextResponse.json({ success: false, error: 'Unauthorized' }, { status: 401 })
198
- }
199
-
200
- const { id } = await params
201
-
202
- // Verify this is a post_category taxonomy
203
- const typeCheck = await dbQuery(
204
- 'SELECT id FROM taxonomies WHERE id = $1 AND type = \'post_category\'',
205
- [id]
206
- )
207
-
208
- if (typeCheck.rows.length === 0) {
209
- return NextResponse.json({ success: false, error: 'Category not found' }, { status: 404 })
210
- }
211
-
212
- // Check if category is used by any posts (using entity_taxonomy_relations)
213
- let usageCount = 0
214
- try {
215
- const usageCheck = await dbQuery<{ count: string }>(
216
- `SELECT COUNT(*) as count FROM entity_taxonomy_relations
217
- WHERE "taxonomyId" = $1 AND "entityType" = 'posts'`,
218
- [id]
219
- )
220
- usageCount = parseInt(usageCheck.rows[0].count)
221
- } catch {
222
- // Table might not exist yet, assume no usage
223
- usageCount = 0
224
- }
225
-
226
- // Soft delete if used, hard delete if not used
227
- if (usageCount > 0) {
228
- // Soft delete: SET deletedAt = now()
229
- await dbQuery(
230
- 'UPDATE taxonomies SET "deletedAt" = now() WHERE id = $1',
231
- [id]
232
- )
233
- return NextResponse.json({
234
- success: true,
235
- data: { id, deleted: 'soft', message: 'Category soft-deleted (still referenced by posts)' }
236
- })
237
- } else {
238
- // Hard delete: No posts use it
239
- const result = await dbQuery<{ id: string }>(
240
- 'DELETE FROM taxonomies WHERE id = $1 RETURNING id',
241
- [id]
242
- )
243
- if (result.rows.length === 0) {
244
- return NextResponse.json({ success: false, error: 'Category not found' }, { status: 404 })
245
- }
246
- return NextResponse.json({
247
- success: true,
248
- data: { id: result.rows[0].id, deleted: 'hard' }
249
- })
250
- }
251
- } catch (err) {
252
- console.error('Error in post-categories API DELETE:', err)
253
- return NextResponse.json({ success: false, error: 'Internal server error' }, { status: 500 })
254
- }
255
- }
@@ -1,134 +0,0 @@
1
- # Post Categories API
2
-
3
- Manage blog post categories (taxonomies).
4
-
5
- ## Overview
6
-
7
- The Post Categories API provides endpoints for managing blog post categories. Categories are stored in the `taxonomies` table with type `post_category`. Supports hierarchical categories with parent-child relationships.
8
-
9
- ## Authentication
10
-
11
- - **GET** endpoints are public (no authentication required)
12
- - **POST/PATCH/DELETE** endpoints require authentication via session cookie or API key
13
-
14
- ## Endpoints
15
-
16
- ### List Categories
17
- `GET /api/v1/post-categories`
18
-
19
- Returns all active post categories ordered by sort order and name.
20
-
21
- **Example Response:**
22
- ```json
23
- {
24
- "success": true,
25
- "data": [
26
- {
27
- "id": "cat_123",
28
- "name": "Technology",
29
- "slug": "technology",
30
- "description": "Tech news and tutorials",
31
- "icon": "Cpu",
32
- "color": "#3b82f6",
33
- "parentId": null,
34
- "order": 1,
35
- "isDefault": false,
36
- "isActive": true,
37
- "createdAt": "2024-01-15T10:00:00Z",
38
- "updatedAt": "2024-01-15T10:00:00Z"
39
- }
40
- ]
41
- }
42
- ```
43
-
44
- ### Create Category
45
- `POST /api/v1/post-categories`
46
-
47
- Create a new post category.
48
-
49
- **Request Body:**
50
- ```json
51
- {
52
- "name": "Technology",
53
- "slug": "technology",
54
- "description": "Tech news and tutorials",
55
- "icon": "Cpu",
56
- "color": "#3b82f6",
57
- "parentId": null,
58
- "order": 1,
59
- "isDefault": false
60
- }
61
- ```
62
-
63
- **Parameters:**
64
- - `name` (string, required): Category display name (1-255 chars)
65
- - `slug` (string, optional): URL-friendly identifier (auto-generated if not provided)
66
- - `description` (string, optional): Category description
67
- - `icon` (string, optional): Lucide icon name
68
- - `color` (string, optional): Hex color code
69
- - `parentId` (string, optional): Parent category ID for hierarchical categories
70
- - `order` (number, optional): Sort order (default: 0)
71
- - `isDefault` (boolean, optional): Mark as default category (default: false)
72
-
73
- **Slug Rules:**
74
- - Lowercase alphanumeric with dashes only
75
- - 2-100 characters
76
- - Pattern: `^[a-z0-9-]+$`
77
- - Must be unique within post categories
78
-
79
- ### Get Category
80
- `GET /api/v1/post-categories/[id]`
81
-
82
- Returns a single category by ID.
83
-
84
- **Path Parameters:**
85
- - `id` (string, required): Category ID
86
-
87
- ### Update Category
88
- `PATCH /api/v1/post-categories/[id]`
89
-
90
- Update an existing category. Partial updates supported.
91
-
92
- **Path Parameters:**
93
- - `id` (string, required): Category ID
94
-
95
- **Request Body:**
96
- Any fields from the create schema (partial update).
97
-
98
- ### Delete Category
99
- `DELETE /api/v1/post-categories/[id]`
100
-
101
- Soft delete a category (sets `deletedAt`).
102
-
103
- **Path Parameters:**
104
- - `id` (string, required): Category ID
105
-
106
- ## Hierarchical Categories
107
-
108
- Categories support parent-child relationships:
109
-
110
- ```json
111
- {
112
- "name": "JavaScript",
113
- "slug": "javascript",
114
- "parentId": "cat_technology"
115
- }
116
- ```
117
-
118
- When listing categories, use `parentId` to build tree structures client-side.
119
-
120
- ## Error Responses
121
-
122
- | Status | Description |
123
- |--------|-------------|
124
- | 400 | Bad Request - Validation error or slug already exists |
125
- | 401 | Unauthorized - Authentication required for write operations |
126
- | 404 | Not Found - Category or parent category not found |
127
- | 500 | Server Error - Internal error |
128
-
129
- ## Usage Notes
130
-
131
- - Categories are stored in the `taxonomies` table with `type = 'post_category'`
132
- - Only active categories (`isActive = true`, `deletedAt IS NULL`) are returned
133
- - Slugs are auto-generated from name if not provided
134
- - The `order` field controls sort order in listings
@@ -1,78 +0,0 @@
1
- /**
2
- * API Presets for Post Categories
3
- *
4
- * These presets appear in the DevTools API Explorer's "Presets" tab.
5
- */
6
-
7
- import { defineApiEndpoint } from '@nextsparkjs/core/types/api-presets'
8
-
9
- export default defineApiEndpoint({
10
- endpoint: '/api/v1/post-categories',
11
- summary: 'Manage blog post categories (taxonomies)',
12
- presets: [
13
- // List
14
- {
15
- id: 'list-all',
16
- title: 'List All Categories',
17
- description: 'Fetch all active post categories',
18
- method: 'GET',
19
- tags: ['read', 'list']
20
- },
21
-
22
- // Create
23
- {
24
- id: 'create-category',
25
- title: 'Create Category',
26
- description: 'Create a new post category',
27
- method: 'POST',
28
- payload: {
29
- name: 'Technology',
30
- description: 'Tech news and tutorials',
31
- icon: 'Cpu',
32
- color: '#3b82f6',
33
- order: 1
34
- },
35
- tags: ['write', 'create']
36
- },
37
- {
38
- id: 'create-category-with-slug',
39
- title: 'Create with Custom Slug',
40
- description: 'Create category with explicit slug',
41
- method: 'POST',
42
- payload: {
43
- name: 'Web Development',
44
- slug: 'web-dev',
45
- description: 'Web development tutorials and tips',
46
- order: 2
47
- },
48
- tags: ['write', 'create']
49
- },
50
- {
51
- id: 'create-subcategory',
52
- title: 'Create Subcategory',
53
- description: 'Create child category with parent',
54
- method: 'POST',
55
- payload: {
56
- name: 'JavaScript',
57
- slug: 'javascript',
58
- parentId: 'parent_category_id_here',
59
- description: 'JavaScript tutorials',
60
- order: 1
61
- },
62
- tags: ['write', 'create', 'hierarchy']
63
- },
64
- {
65
- id: 'create-default-category',
66
- title: 'Create Default Category',
67
- description: 'Create category marked as default',
68
- method: 'POST',
69
- payload: {
70
- name: 'Uncategorized',
71
- slug: 'uncategorized',
72
- isDefault: true,
73
- order: 999
74
- },
75
- tags: ['write', 'create']
76
- }
77
- ]
78
- })
@@ -1,119 +0,0 @@
1
- import { NextRequest, NextResponse } from 'next/server'
2
- import { authenticateRequest } from '@nextsparkjs/core/lib/api/auth/dual-auth'
3
- import { query as dbQuery } from '@nextsparkjs/core/lib/db'
4
- import { z } from 'zod'
5
-
6
- const createCategorySchema = z.object({
7
- name: z.string().min(1).max(255),
8
- slug: z.string().min(2).max(100).regex(/^[a-z0-9-]+$/, 'Slug must be lowercase alphanumeric with dashes').optional(),
9
- description: z.string().optional(),
10
- icon: z.string().optional(),
11
- color: z.string().optional(),
12
- parentId: z.string().optional(),
13
- order: z.number().int().default(0),
14
- isDefault: z.boolean().default(false)
15
- })
16
-
17
- // Helper to generate slug from name
18
- function generateSlug(name: string): string {
19
- return name
20
- .toLowerCase()
21
- .trim()
22
- .replace(/[^a-z0-9\s-]/g, '') // Remove special chars
23
- .replace(/\s+/g, '-') // Replace spaces with dashes
24
- .replace(/-+/g, '-') // Replace multiple dashes with single
25
- .replace(/^-|-$/g, '') // Remove leading/trailing dashes
26
- }
27
-
28
- // GET /api/v1/post-categories - List categories (filters taxonomies by type = 'post_category')
29
- export async function GET() {
30
- try {
31
- const result = await dbQuery(
32
- `SELECT id, name, slug, description, icon, color, "parentId", "order", "isDefault", "isActive",
33
- "createdAt", "updatedAt"
34
- FROM taxonomies
35
- WHERE type = 'post_category' AND "deletedAt" IS NULL AND "isActive" = true
36
- ORDER BY "order" ASC, name ASC`
37
- )
38
-
39
- return NextResponse.json({
40
- success: true,
41
- data: result.rows
42
- })
43
- } catch (error) {
44
- console.error('Error fetching post categories:', error)
45
- return NextResponse.json({ success: false, error: 'Internal server error' }, { status: 500 })
46
- }
47
- }
48
-
49
- // POST /api/v1/post-categories - Create category
50
- export async function POST(request: NextRequest) {
51
- try {
52
- // Dual authentication: API key or session
53
- const authResult = await authenticateRequest(request)
54
- if (!authResult.success || !authResult.user) {
55
- return NextResponse.json({ success: false, error: 'Unauthorized' }, { status: 401 })
56
- }
57
-
58
- const body = await request.json()
59
- const data = createCategorySchema.parse(body)
60
-
61
- // Auto-generate slug if not provided
62
- const slug = data.slug || generateSlug(data.name)
63
-
64
- // Check slug uniqueness for this taxonomy type
65
- const existing = await dbQuery(
66
- 'SELECT id FROM taxonomies WHERE type = \'post_category\' AND slug = $1',
67
- [slug]
68
- )
69
-
70
- if (existing.rows.length > 0) {
71
- return NextResponse.json({
72
- success: false,
73
- error: 'Slug already exists',
74
- message: `A category with slug "${slug}" already exists`
75
- }, { status: 400 })
76
- }
77
-
78
- // Verify parentId exists if provided
79
- if (data.parentId) {
80
- const parentCheck = await dbQuery(
81
- 'SELECT id FROM taxonomies WHERE id = $1 AND type = \'post_category\'',
82
- [data.parentId]
83
- )
84
- if (parentCheck.rows.length === 0) {
85
- return NextResponse.json({
86
- success: false,
87
- error: 'Parent category not found'
88
- }, { status: 400 })
89
- }
90
- }
91
-
92
- // Insert category (type is hardcoded to 'post_category')
93
- const result = await dbQuery(
94
- `INSERT INTO taxonomies (
95
- type, slug, name, description, icon, color, "parentId", "order", "isDefault", "userId"
96
- ) VALUES ('post_category', $1, $2, $3, $4, $5, $6, $7, $8, $9)
97
- RETURNING *`,
98
- [
99
- slug,
100
- data.name,
101
- data.description || null,
102
- data.icon || null,
103
- data.color || null,
104
- data.parentId || null,
105
- data.order,
106
- data.isDefault,
107
- authResult.user.id
108
- ]
109
- )
110
-
111
- return NextResponse.json({ success: true, data: result.rows[0] }, { status: 201 })
112
- } catch (error) {
113
- if (error instanceof z.ZodError) {
114
- return NextResponse.json({ success: false, error: 'Validation error', details: error.issues }, { status: 400 })
115
- }
116
- console.error('Error creating post category:', error)
117
- return NextResponse.json({ success: false, error: 'Internal server error' }, { status: 500 })
118
- }
119
- }