create-ej-app 6.0.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +88 -14
- package/cli.ts +100 -17
- package/package.json +2 -2
- package/template/base/.env.example +11 -15
- package/template/base/Dockerfile +15 -0
- package/template/base/components.json +10 -5
- package/template/base/drizzle.config.ts +4 -5
- package/template/{new → base}/eslint.config.mjs +6 -1
- package/template/base/package.json +58 -75
- package/template/base/postcss.config.mjs +1 -4
- package/template/base/src/app/(admin)/layout.tsx +20 -0
- package/template/base/src/app/(app)/layout.tsx +13 -118
- package/template/base/src/app/(auth)/login/page.tsx +65 -42
- package/template/base/src/app/(marketing)/layout.tsx +7 -35
- package/template/base/src/app/(marketing)/page.tsx +2 -96
- package/template/base/src/app/(marketing)/privacy/page.tsx +3 -0
- package/template/base/src/app/(marketing)/terms/page.tsx +3 -0
- package/template/base/src/app/globals.css +118 -66
- package/template/base/src/app/layout.tsx +27 -12
- package/template/base/src/app/not-found.tsx +27 -0
- package/template/base/src/components/site-footer.tsx +16 -24
- package/template/base/src/components/ui/button.tsx +31 -27
- package/template/base/src/components/ui/card.tsx +83 -70
- package/template/base/src/components/ui/form.tsx +38 -47
- package/template/base/src/components/ui/input.tsx +16 -20
- package/template/base/src/components/ui/label.tsx +16 -18
- package/template/base/src/components/ui/separator.tsx +11 -14
- package/template/base/src/components/ui/sonner.tsx +22 -13
- package/template/base/src/db/index.ts +4 -11
- package/template/base/src/db/schema.ts +60 -268
- package/template/{new → base}/src/env.ts +2 -2
- package/template/{new → base}/src/lib/auth-client.ts +2 -0
- package/template/base/src/lib/auth.ts +64 -80
- package/template/base/src/lib/safe-action.ts +30 -6
- package/template/base/tsconfig.json +9 -7
- package/template/{prisma-advanced → old}/.env.example +10 -9
- package/template/{prisma → old}/components.json +1 -1
- package/template/old/drizzle.config.ts +11 -0
- package/template/old/package.json +87 -0
- package/template/old/postcss.config.mjs +8 -0
- package/template/{prisma-advanced → old}/src/app/(app)/layout.tsx +11 -3
- package/template/{prisma-advanced → old}/src/app/(auth)/login/page.tsx +2 -2
- package/template/{prisma → old}/src/app/(marketing)/page.tsx +8 -7
- package/template/old/src/app/layout.tsx +31 -0
- package/template/old/src/components/ui/sonner.tsx +31 -0
- package/template/old/src/db/index.ts +14 -0
- package/template/old/src/db/schema.ts +287 -0
- package/template/old/src/lib/auth.ts +89 -0
- package/template/old/src/lib/safe-action.ts +19 -0
- package/template/{prisma-advanced → old}/tsconfig.json +3 -2
- package/template/new/.env.example +0 -13
- package/template/new/components.json +0 -22
- package/template/new/drizzle.config.ts +0 -10
- package/template/new/package.json +0 -81
- package/template/new/postcss.config.mjs +0 -5
- package/template/new/src/app/(auth)/login/page.tsx +0 -72
- package/template/new/src/app/globals.css +0 -128
- package/template/new/src/app/layout.tsx +0 -50
- package/template/new/src/app/page.tsx +0 -3
- package/template/new/src/components/ui/button.tsx +0 -60
- package/template/new/src/components/ui/card.tsx +0 -92
- package/template/new/src/components/ui/form.tsx +0 -167
- package/template/new/src/components/ui/input.tsx +0 -21
- package/template/new/src/components/ui/label.tsx +0 -24
- package/template/new/src/components/ui/separator.tsx +0 -28
- package/template/new/src/components/ui/sonner.tsx +0 -40
- package/template/new/src/db/index.ts +0 -7
- package/template/new/src/db/schema.ts +0 -74
- package/template/new/src/lib/auth.ts +0 -67
- package/template/new/src/lib/safe-action.ts +0 -15
- package/template/new/tsconfig.json +0 -49
- package/template/prisma/.env.example +0 -16
- package/template/prisma/.eslintrc.cjs +0 -24
- package/template/prisma/next.config.mjs +0 -15
- package/template/prisma/package.json +0 -80
- package/template/prisma/postcss.config.cjs +0 -6
- package/template/prisma/prettier.config.ts +0 -11
- package/template/prisma/prisma/schema.prisma +0 -115
- package/template/prisma/public/next.svg +0 -1
- package/template/prisma/src/app/(app)/dashboard/page.tsx +0 -19
- package/template/prisma/src/app/(app)/layout.tsx +0 -90
- package/template/prisma/src/app/(app)/settings/actions.ts +0 -18
- package/template/prisma/src/app/(app)/settings/loading.tsx +0 -28
- package/template/prisma/src/app/(app)/settings/page.tsx +0 -28
- package/template/prisma/src/app/(app)/settings/render.tsx +0 -113
- package/template/prisma/src/app/(app)/tasks/[id]/actions.ts +0 -147
- package/template/prisma/src/app/(app)/tasks/[id]/page.tsx +0 -25
- package/template/prisma/src/app/(app)/tasks/[id]/render.tsx +0 -413
- package/template/prisma/src/app/(app)/tasks/actions.ts +0 -69
- package/template/prisma/src/app/(app)/tasks/page.tsx +0 -53
- package/template/prisma/src/app/(app)/tasks/render.tsx +0 -107
- package/template/prisma/src/app/(app)/users/[id]/actions.ts +0 -83
- package/template/prisma/src/app/(app)/users/[id]/page.tsx +0 -32
- package/template/prisma/src/app/(app)/users/[id]/render.tsx +0 -240
- package/template/prisma/src/app/(app)/users/actions.ts +0 -55
- package/template/prisma/src/app/(app)/users/page.tsx +0 -49
- package/template/prisma/src/app/(app)/users/render.tsx +0 -80
- package/template/prisma/src/app/(auth)/layout.tsx +0 -20
- package/template/prisma/src/app/(auth)/login/page.tsx +0 -49
- package/template/prisma/src/app/(auth)/login/user-auth-form.tsx +0 -152
- package/template/prisma/src/app/api/auth/[...nextauth]/route.ts +0 -7
- package/template/prisma/src/app/api/upload/route.ts +0 -36
- package/template/prisma/src/app/favicon.ico +0 -0
- package/template/prisma/src/app/layout.tsx +0 -34
- package/template/prisma/src/components/app-nav-command.tsx +0 -160
- package/template/prisma/src/components/dark-mode-toggle.tsx +0 -43
- package/template/prisma/src/components/data-table/data-table-column-header.tsx +0 -91
- package/template/prisma/src/components/data-table/data-table-faceted-filter.tsx +0 -149
- package/template/prisma/src/components/data-table/data-table-loading.tsx +0 -77
- package/template/prisma/src/components/data-table/data-table-pagination.tsx +0 -94
- package/template/prisma/src/components/data-table/data-table-toolbar.tsx +0 -78
- package/template/prisma/src/components/data-table/data-table-types.ts +0 -17
- package/template/prisma/src/components/data-table/data-table-view-options.tsx +0 -59
- package/template/prisma/src/components/data-table/data-table.tsx +0 -301
- package/template/prisma/src/components/data-table/simple-data-table.tsx +0 -109
- package/template/prisma/src/components/empty-placeholder.tsx +0 -78
- package/template/prisma/src/components/heading.tsx +0 -17
- package/template/prisma/src/components/icons.tsx +0 -85
- package/template/prisma/src/components/main-nav.tsx +0 -64
- package/template/prisma/src/components/mobile-nav.tsx +0 -50
- package/template/prisma/src/components/shell.tsx +0 -13
- package/template/prisma/src/components/side-nav.tsx +0 -51
- package/template/prisma/src/components/site-footer.tsx +0 -31
- package/template/prisma/src/components/system-info.tsx +0 -36
- package/template/prisma/src/components/theme-provider.tsx +0 -13
- package/template/prisma/src/components/ui/alert-dialog.tsx +0 -141
- package/template/prisma/src/components/ui/avatar.tsx +0 -50
- package/template/prisma/src/components/ui/badge.tsx +0 -36
- package/template/prisma/src/components/ui/button.tsx +0 -56
- package/template/prisma/src/components/ui/card.tsx +0 -79
- package/template/prisma/src/components/ui/checkbox.tsx +0 -30
- package/template/prisma/src/components/ui/command.tsx +0 -155
- package/template/prisma/src/components/ui/dialog.tsx +0 -122
- package/template/prisma/src/components/ui/dropdown-menu.tsx +0 -200
- package/template/prisma/src/components/ui/form.tsx +0 -176
- package/template/prisma/src/components/ui/input.tsx +0 -25
- package/template/prisma/src/components/ui/label.tsx +0 -26
- package/template/prisma/src/components/ui/popover.tsx +0 -31
- package/template/prisma/src/components/ui/select.tsx +0 -160
- package/template/prisma/src/components/ui/separator.tsx +0 -31
- package/template/prisma/src/components/ui/skeleton.tsx +0 -15
- package/template/prisma/src/components/ui/table.tsx +0 -117
- package/template/prisma/src/components/ui/textarea.tsx +0 -24
- package/template/prisma/src/components/ui/toast.tsx +0 -127
- package/template/prisma/src/components/ui/toaster.tsx +0 -35
- package/template/prisma/src/components/ui/use-toast.ts +0 -189
- package/template/prisma/src/components/user-account-nav.tsx +0 -60
- package/template/prisma/src/components/user-avatar.tsx +0 -25
- package/template/prisma/src/env.mjs +0 -78
- package/template/prisma/src/hooks/use-debounce.ts +0 -17
- package/template/prisma/src/hooks/use-lock-body.tsx +0 -12
- package/template/prisma/src/lib/auth.ts +0 -80
- package/template/prisma/src/lib/cn.ts +0 -4
- package/template/prisma/src/lib/db.ts +0 -20
- package/template/prisma/src/lib/delay.ts +0 -2
- package/template/prisma/src/lib/formatDate.ts +0 -11
- package/template/prisma/src/lib/generateLabel.ts +0 -5
- package/template/prisma/src/lib/siteConfig.ts +0 -4
- package/template/prisma/src/lib/storageClient.ts +0 -11
- package/template/prisma/src/styles/editor.css +0 -61
- package/template/prisma/src/styles/globals.css +0 -76
- package/template/prisma/src/types/UnwrapPromise.ts +0 -1
- package/template/prisma/tailwind.config.ts +0 -80
- package/template/prisma/tsconfig.json +0 -46
- package/template/prisma-advanced/.eslintrc.cjs +0 -24
- package/template/prisma-advanced/components.json +0 -17
- package/template/prisma-advanced/next.config.mjs +0 -15
- package/template/prisma-advanced/package.json +0 -80
- package/template/prisma-advanced/postcss.config.cjs +0 -6
- package/template/prisma-advanced/prettier.config.ts +0 -11
- package/template/prisma-advanced/prisma/schema.prisma +0 -154
- package/template/prisma-advanced/public/next.svg +0 -1
- package/template/prisma-advanced/src/app/(app)/dashboard/page.tsx +0 -19
- package/template/prisma-advanced/src/app/(app)/roles/[id]/actions.ts +0 -100
- package/template/prisma-advanced/src/app/(app)/roles/[id]/page.tsx +0 -36
- package/template/prisma-advanced/src/app/(app)/roles/[id]/render.tsx +0 -266
- package/template/prisma-advanced/src/app/(app)/roles/actions.ts +0 -67
- package/template/prisma-advanced/src/app/(app)/roles/page.tsx +0 -51
- package/template/prisma-advanced/src/app/(app)/roles/render.tsx +0 -70
- package/template/prisma-advanced/src/app/(app)/settings/actions.ts +0 -18
- package/template/prisma-advanced/src/app/(app)/settings/loading.tsx +0 -28
- package/template/prisma-advanced/src/app/(app)/settings/page.tsx +0 -28
- package/template/prisma-advanced/src/app/(app)/settings/render.tsx +0 -113
- package/template/prisma-advanced/src/app/(app)/tasks/[id]/actions.ts +0 -147
- package/template/prisma-advanced/src/app/(app)/tasks/[id]/page.tsx +0 -55
- package/template/prisma-advanced/src/app/(app)/tasks/[id]/render.tsx +0 -418
- package/template/prisma-advanced/src/app/(app)/tasks/actions.ts +0 -69
- package/template/prisma-advanced/src/app/(app)/tasks/page.tsx +0 -63
- package/template/prisma-advanced/src/app/(app)/tasks/render.tsx +0 -114
- package/template/prisma-advanced/src/app/(app)/users/[id]/actions.ts +0 -104
- package/template/prisma-advanced/src/app/(app)/users/[id]/page.tsx +0 -39
- package/template/prisma-advanced/src/app/(app)/users/[id]/render.tsx +0 -320
- package/template/prisma-advanced/src/app/(app)/users/actions.ts +0 -67
- package/template/prisma-advanced/src/app/(app)/users/page.tsx +0 -61
- package/template/prisma-advanced/src/app/(app)/users/render.tsx +0 -108
- package/template/prisma-advanced/src/app/(auth)/layout.tsx +0 -20
- package/template/prisma-advanced/src/app/(auth)/login/user-auth-form.tsx +0 -152
- package/template/prisma-advanced/src/app/(marketing)/layout.tsx +0 -42
- package/template/prisma-advanced/src/app/(marketing)/page.tsx +0 -96
- package/template/prisma-advanced/src/app/api/auth/[...nextauth]/route.ts +0 -7
- package/template/prisma-advanced/src/app/api/upload/route.ts +0 -36
- package/template/prisma-advanced/src/app/favicon.ico +0 -0
- package/template/prisma-advanced/src/app/layout.tsx +0 -34
- package/template/prisma-advanced/src/components/app-nav-command.tsx +0 -160
- package/template/prisma-advanced/src/components/dark-mode-toggle.tsx +0 -43
- package/template/prisma-advanced/src/components/data-table/data-table-column-header.tsx +0 -91
- package/template/prisma-advanced/src/components/data-table/data-table-faceted-filter.tsx +0 -149
- package/template/prisma-advanced/src/components/data-table/data-table-loading.tsx +0 -77
- package/template/prisma-advanced/src/components/data-table/data-table-pagination.tsx +0 -94
- package/template/prisma-advanced/src/components/data-table/data-table-toolbar.tsx +0 -78
- package/template/prisma-advanced/src/components/data-table/data-table-types.ts +0 -17
- package/template/prisma-advanced/src/components/data-table/data-table-view-options.tsx +0 -59
- package/template/prisma-advanced/src/components/data-table/data-table.tsx +0 -301
- package/template/prisma-advanced/src/components/data-table/simple-data-table.tsx +0 -109
- package/template/prisma-advanced/src/components/empty-placeholder.tsx +0 -78
- package/template/prisma-advanced/src/components/heading.tsx +0 -17
- package/template/prisma-advanced/src/components/icons.tsx +0 -85
- package/template/prisma-advanced/src/components/main-nav.tsx +0 -64
- package/template/prisma-advanced/src/components/shell.tsx +0 -13
- package/template/prisma-advanced/src/components/side-nav.tsx +0 -51
- package/template/prisma-advanced/src/components/system-info.tsx +0 -36
- package/template/prisma-advanced/src/components/theme-provider.tsx +0 -13
- package/template/prisma-advanced/src/components/ui/alert-dialog.tsx +0 -141
- package/template/prisma-advanced/src/components/ui/avatar.tsx +0 -50
- package/template/prisma-advanced/src/components/ui/badge.tsx +0 -36
- package/template/prisma-advanced/src/components/ui/checkbox.tsx +0 -30
- package/template/prisma-advanced/src/components/ui/command.tsx +0 -155
- package/template/prisma-advanced/src/components/ui/dialog.tsx +0 -122
- package/template/prisma-advanced/src/components/ui/dropdown-menu.tsx +0 -200
- package/template/prisma-advanced/src/components/ui/popover.tsx +0 -31
- package/template/prisma-advanced/src/components/ui/select.tsx +0 -160
- package/template/prisma-advanced/src/components/ui/skeleton.tsx +0 -15
- package/template/prisma-advanced/src/components/ui/table.tsx +0 -117
- package/template/prisma-advanced/src/components/ui/textarea.tsx +0 -24
- package/template/prisma-advanced/src/components/ui/toast.tsx +0 -127
- package/template/prisma-advanced/src/components/ui/toaster.tsx +0 -35
- package/template/prisma-advanced/src/components/ui/use-toast.ts +0 -189
- package/template/prisma-advanced/src/components/user-account-nav.tsx +0 -60
- package/template/prisma-advanced/src/components/user-avatar.tsx +0 -25
- package/template/prisma-advanced/src/env.mjs +0 -78
- package/template/prisma-advanced/src/hooks/use-debounce.ts +0 -17
- package/template/prisma-advanced/src/hooks/use-lock-body.tsx +0 -12
- package/template/prisma-advanced/src/lib/auth.ts +0 -180
- package/template/prisma-advanced/src/lib/cn.ts +0 -4
- package/template/prisma-advanced/src/lib/db.ts +0 -20
- package/template/prisma-advanced/src/lib/delay.ts +0 -2
- package/template/prisma-advanced/src/lib/formatDate.ts +0 -11
- package/template/prisma-advanced/src/lib/generateLabel.ts +0 -5
- package/template/prisma-advanced/src/lib/siteConfig.ts +0 -4
- package/template/prisma-advanced/src/lib/storageClient.ts +0 -11
- package/template/prisma-advanced/src/styles/editor.css +0 -61
- package/template/prisma-advanced/src/types/UnwrapPromise.ts +0 -1
- package/template/prisma-advanced/tailwind.config.ts +0 -80
- package/template/{new → base}/next.config.ts +0 -0
- package/template/{new → base}/public/placeholder.svg +0 -0
- package/template/{new → base}/src/app/(auth)/login/email-login-form.tsx +0 -0
- package/template/{new → base}/src/app/(auth)/login/social-login-buttons.tsx +0 -0
- package/template/{new → base}/src/app/api/auth/[...all]/route.ts +0 -0
- package/template/{new → base}/src/components/loader.tsx +0 -0
- package/template/{new → base}/src/components/react-query-provider.tsx +0 -0
- package/template/{new → base}/src/components/screen-size.tsx +0 -0
- package/template/{new → base}/src/components/theme-toggle.tsx +0 -0
- package/template/{new → base}/src/lib/toast-message.ts +0 -0
- package/template/{base → old}/.eslintrc.cjs +0 -0
- package/template/{base → old}/next.config.mjs +0 -0
- package/template/{new → old}/prettier.config.mjs +0 -0
- package/template/{base → old}/public/next.svg +0 -0
- package/template/{base → old}/public/vercel.svg +0 -0
- package/template/{base → old}/src/app/(app)/dashboard/layout.tsx +0 -0
- package/template/{base → old}/src/app/(app)/dashboard/page.tsx +0 -0
- package/template/{base → old}/src/app/(app)/roles/[id]/actions.ts +0 -0
- package/template/{base → old}/src/app/(app)/roles/[id]/page.tsx +0 -0
- package/template/{base → old}/src/app/(app)/roles/[id]/render.tsx +0 -0
- package/template/{base → old}/src/app/(app)/roles/[id]/validation.ts +0 -0
- package/template/{base → old}/src/app/(app)/roles/actions.ts +0 -0
- package/template/{base → old}/src/app/(app)/roles/page.tsx +0 -0
- package/template/{base → old}/src/app/(app)/roles/render.tsx +0 -0
- package/template/{base → old}/src/app/(app)/settings/actions.ts +0 -0
- package/template/{base → old}/src/app/(app)/settings/layout.tsx +0 -0
- package/template/{base → old}/src/app/(app)/settings/loading.tsx +0 -0
- package/template/{base → old}/src/app/(app)/settings/page.tsx +0 -0
- package/template/{base → old}/src/app/(app)/settings/render.tsx +0 -0
- package/template/{base → old}/src/app/(app)/settings/validation.ts +0 -0
- package/template/{base → old}/src/app/(app)/tasks/[id]/actions.ts +0 -0
- package/template/{base → old}/src/app/(app)/tasks/[id]/page.tsx +0 -0
- package/template/{base → old}/src/app/(app)/tasks/[id]/render.tsx +0 -0
- package/template/{base → old}/src/app/(app)/tasks/[id]/validation.ts +0 -0
- package/template/{base → old}/src/app/(app)/tasks/actions.ts +0 -0
- package/template/{base → old}/src/app/(app)/tasks/page.tsx +0 -0
- package/template/{base → old}/src/app/(app)/tasks/render.tsx +0 -0
- package/template/{base → old}/src/app/(app)/tasks/statusEnum.ts +0 -0
- package/template/{base → old}/src/app/(app)/users/[id]/actions.ts +0 -0
- package/template/{base → old}/src/app/(app)/users/[id]/page.tsx +0 -0
- package/template/{base → old}/src/app/(app)/users/[id]/render.tsx +0 -0
- package/template/{base → old}/src/app/(app)/users/[id]/validation.ts +0 -0
- package/template/{base → old}/src/app/(app)/users/actions.ts +0 -0
- package/template/{base → old}/src/app/(app)/users/page.tsx +0 -0
- package/template/{base → old}/src/app/(app)/users/render.tsx +0 -0
- package/template/{base → old}/src/app/(auth)/layout.tsx +0 -0
- package/template/{base → old}/src/app/(auth)/login/render.tsx +0 -0
- package/template/{prisma → old}/src/app/(marketing)/layout.tsx +1 -1
- /package/template/{base → old}/src/app/api/auth/[...nextauth]/route.ts +0 -0
- /package/template/{new → old}/src/app/favicon.ico +0 -0
- /package/template/{prisma-advanced/src/styles → old/src/app}/globals.css +0 -0
- /package/template/{base → old}/src/components/app-nav-command.tsx +0 -0
- /package/template/{base → old}/src/components/dark-mode-toggle.tsx +0 -0
- /package/template/{base → old}/src/components/data-table/data-table-column-header.tsx +0 -0
- /package/template/{base → old}/src/components/data-table/data-table-faceted-filter.tsx +0 -0
- /package/template/{base → old}/src/components/data-table/data-table-loading.tsx +0 -0
- /package/template/{base → old}/src/components/data-table/data-table-pagination.tsx +0 -0
- /package/template/{base → old}/src/components/data-table/data-table-toolbar.tsx +0 -0
- /package/template/{base → old}/src/components/data-table/data-table-types.ts +0 -0
- /package/template/{base → old}/src/components/data-table/data-table-view-options.tsx +0 -0
- /package/template/{base → old}/src/components/data-table/data-table.tsx +0 -0
- /package/template/{base → old}/src/components/data-table/simple-data-table.tsx +0 -0
- /package/template/{base → old}/src/components/empty-placeholder.tsx +0 -0
- /package/template/{base → old}/src/components/heading.tsx +0 -0
- /package/template/{base → old}/src/components/icons.tsx +0 -0
- /package/template/{base → old}/src/components/main-nav.tsx +0 -0
- /package/template/{base → old}/src/components/mobile-nav.tsx +0 -0
- /package/template/{base → old}/src/components/shell.tsx +0 -0
- /package/template/{base → old}/src/components/side-nav.tsx +0 -0
- /package/template/{prisma-advanced → old}/src/components/site-footer.tsx +0 -0
- /package/template/{base → old}/src/components/system-info.tsx +0 -0
- /package/template/{base → old}/src/components/ui/alert-dialog.tsx +0 -0
- /package/template/{base → old}/src/components/ui/avatar.tsx +0 -0
- /package/template/{base → old}/src/components/ui/badge.tsx +0 -0
- /package/template/{prisma-advanced → old}/src/components/ui/button.tsx +0 -0
- /package/template/{prisma-advanced → old}/src/components/ui/card.tsx +0 -0
- /package/template/{base → old}/src/components/ui/checkbox.tsx +0 -0
- /package/template/{base → old}/src/components/ui/command.tsx +0 -0
- /package/template/{base → old}/src/components/ui/dialog.tsx +0 -0
- /package/template/{base → old}/src/components/ui/dropdown-menu.tsx +0 -0
- /package/template/{prisma-advanced → old}/src/components/ui/form.tsx +0 -0
- /package/template/{prisma-advanced → old}/src/components/ui/input.tsx +0 -0
- /package/template/{prisma-advanced → old}/src/components/ui/label.tsx +0 -0
- /package/template/{base → old}/src/components/ui/popover.tsx +0 -0
- /package/template/{base → old}/src/components/ui/select.tsx +0 -0
- /package/template/{prisma-advanced → old}/src/components/ui/separator.tsx +0 -0
- /package/template/{base → old}/src/components/ui/skeleton.tsx +0 -0
- /package/template/{base → old}/src/components/ui/table.tsx +0 -0
- /package/template/{base → old}/src/components/user-account-nav.tsx +0 -0
- /package/template/{base → old}/src/components/user-avatar.tsx +0 -0
- /package/template/{base → old}/src/data-access/resource.ts +0 -0
- /package/template/{base → old}/src/data-access/role-permission.ts +0 -0
- /package/template/{base → old}/src/data-access/role.ts +0 -0
- /package/template/{base → old}/src/data-access/task.ts +0 -0
- /package/template/{base → old}/src/data-access/user.ts +0 -0
- /package/template/{base → old}/src/env.mjs +0 -0
- /package/template/{base → old}/src/hooks/use-debounce.tsx +0 -0
- /package/template/{base → old}/src/hooks/use-lock-body.tsx +0 -0
- /package/template/{new → old}/src/lib/cn.ts +0 -0
- /package/template/{base → old}/src/lib/currentUser.ts +0 -0
- /package/template/{new → old}/src/lib/delay.ts +0 -0
- /package/template/{base → old}/src/lib/formatDate.ts +0 -0
- /package/template/{base → old}/src/lib/generateLabel.ts +0 -0
- /package/template/{base → old}/src/lib/s3Client.ts +0 -0
- /package/template/{new → old}/src/lib/siteConfig.ts +0 -0
- /package/template/{base → old}/src/lib/sortOrderEnum.ts +0 -0
- /package/template/{base → old}/src/use-case/role-permission.ts +0 -0
- /package/template/{base → old}/src/use-case/role.ts +0 -0
- /package/template/{base → old}/src/use-case/task.ts +0 -0
- /package/template/{base → old}/src/use-case/user.ts +0 -0
- /package/template/{base → old}/tailwind.config.ts +0 -0
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import Link from 'next/link'
|
|
4
|
-
import { FC } from 'react'
|
|
5
|
-
|
|
6
|
-
import { DataTable } from '@/components/data-table/data-table'
|
|
7
|
-
import { DataTableColumnHeader } from '@/components/data-table/data-table-column-header'
|
|
8
|
-
import { Heading } from '@/components/heading'
|
|
9
|
-
import { Icons } from '@/components/icons'
|
|
10
|
-
import { Shell } from '@/components/shell'
|
|
11
|
-
import { Button } from '@/components/ui/button'
|
|
12
|
-
import { formatDateTime, timesAgo } from '@/lib/formatDate'
|
|
13
|
-
import { GetRolesFnDataType } from './actions'
|
|
14
|
-
|
|
15
|
-
export const Render: FC<{
|
|
16
|
-
data: GetRolesFnDataType
|
|
17
|
-
}> = ({ data }) => {
|
|
18
|
-
return (
|
|
19
|
-
<Shell>
|
|
20
|
-
<Heading heading="Roles" text="List of all the roles">
|
|
21
|
-
<Link href="/roles/new">
|
|
22
|
-
<Button>
|
|
23
|
-
<Icons.add className="mr-2 h-4 w-4" />
|
|
24
|
-
New
|
|
25
|
-
</Button>
|
|
26
|
-
</Link>
|
|
27
|
-
</Heading>
|
|
28
|
-
<DataTable
|
|
29
|
-
columns={[
|
|
30
|
-
{
|
|
31
|
-
accessorKey: 'name',
|
|
32
|
-
header: ({ column }) => (
|
|
33
|
-
<DataTableColumnHeader column={column} title="Name" />
|
|
34
|
-
),
|
|
35
|
-
cell: ({ row }) => (
|
|
36
|
-
<Link
|
|
37
|
-
className="underline underline-offset-4"
|
|
38
|
-
href={`/roles/${row.original.id}`}
|
|
39
|
-
>
|
|
40
|
-
{row.original.name}
|
|
41
|
-
</Link>
|
|
42
|
-
)
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
accessorKey: 'createdAt',
|
|
46
|
-
header: ({ column }) => (
|
|
47
|
-
<DataTableColumnHeader column={column} title="Created At" />
|
|
48
|
-
),
|
|
49
|
-
cell: ({ row }) => formatDateTime(row.original.createdAt)
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
accessorKey: 'updatedAt',
|
|
53
|
-
header: ({ column }) => (
|
|
54
|
-
<DataTableColumnHeader column={column} title="Updated At" />
|
|
55
|
-
),
|
|
56
|
-
cell: ({ row }) => timesAgo(row.original.updatedAt)
|
|
57
|
-
}
|
|
58
|
-
]}
|
|
59
|
-
data={data.roles}
|
|
60
|
-
total={data.total}
|
|
61
|
-
searchableColumns={[
|
|
62
|
-
{
|
|
63
|
-
id: 'name',
|
|
64
|
-
title: 'Name'
|
|
65
|
-
}
|
|
66
|
-
]}
|
|
67
|
-
/>
|
|
68
|
-
</Shell>
|
|
69
|
-
)
|
|
70
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
'use server'
|
|
2
|
-
|
|
3
|
-
import { getAuthSession } from '@/lib/auth'
|
|
4
|
-
import { prisma } from '@/lib/db'
|
|
5
|
-
|
|
6
|
-
export const updateName = async ({ name }: { name: string }) => {
|
|
7
|
-
const session = await getAuthSession()
|
|
8
|
-
if (!session?.user) throw new Error('Unauthorized')
|
|
9
|
-
|
|
10
|
-
await prisma.user.update({
|
|
11
|
-
where: {
|
|
12
|
-
id: session.user.id
|
|
13
|
-
},
|
|
14
|
-
data: {
|
|
15
|
-
name
|
|
16
|
-
}
|
|
17
|
-
})
|
|
18
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Heading } from '@/components/heading'
|
|
2
|
-
import { Shell } from '@/components/shell'
|
|
3
|
-
import { Card, CardContent, CardFooter, CardHeader } from '@/components/ui/card'
|
|
4
|
-
import { Skeleton } from '@/components/ui/skeleton'
|
|
5
|
-
|
|
6
|
-
const Loading = () => {
|
|
7
|
-
return (
|
|
8
|
-
<Shell>
|
|
9
|
-
<Heading heading="Settings" text="Manage account and profile settings." />
|
|
10
|
-
<div className="grid gap-10">
|
|
11
|
-
<Card>
|
|
12
|
-
<CardHeader className="gap-2">
|
|
13
|
-
<Skeleton className="h-6 w-1/5" />
|
|
14
|
-
<Skeleton className="h-4 w-4/5" />
|
|
15
|
-
</CardHeader>
|
|
16
|
-
<CardContent className="h-10">
|
|
17
|
-
<Skeleton className="h-8 w-full max-w-[400px]" />
|
|
18
|
-
</CardContent>
|
|
19
|
-
<CardFooter>
|
|
20
|
-
<Skeleton className="h-8 w-full max-w-[120px]" />
|
|
21
|
-
</CardFooter>
|
|
22
|
-
</Card>
|
|
23
|
-
</div>
|
|
24
|
-
</Shell>
|
|
25
|
-
)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export default Loading
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Metadata } from 'next'
|
|
2
|
-
|
|
3
|
-
import { Heading } from '@/components/heading'
|
|
4
|
-
import { Shell } from '@/components/shell'
|
|
5
|
-
import { getAuthSession } from '@/lib/auth'
|
|
6
|
-
import { siteConfig } from '@/lib/siteConfig'
|
|
7
|
-
import { Render } from './render'
|
|
8
|
-
|
|
9
|
-
export const metadata: Metadata = {
|
|
10
|
-
title: 'Settings' + ' | ' + siteConfig.name
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const SettingsPage = async () => {
|
|
14
|
-
const session = await getAuthSession()
|
|
15
|
-
|
|
16
|
-
if (!session?.user) return
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<Shell>
|
|
20
|
-
<Heading heading="Settings" text="Manage account and profile settings." />
|
|
21
|
-
<div className="grid gap-10">
|
|
22
|
-
<Render name={session.user.name || ''} />
|
|
23
|
-
</div>
|
|
24
|
-
</Shell>
|
|
25
|
-
)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export default SettingsPage
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import { zodResolver } from '@hookform/resolvers/zod'
|
|
4
|
-
import { useRouter } from 'next/navigation'
|
|
5
|
-
import { FC, useState } from 'react'
|
|
6
|
-
import { useForm } from 'react-hook-form'
|
|
7
|
-
import { z } from 'zod'
|
|
8
|
-
|
|
9
|
-
import { Icons } from '@/components/icons'
|
|
10
|
-
import { Button } from '@/components/ui/button'
|
|
11
|
-
import {
|
|
12
|
-
Card,
|
|
13
|
-
CardContent,
|
|
14
|
-
CardDescription,
|
|
15
|
-
CardFooter,
|
|
16
|
-
CardHeader,
|
|
17
|
-
CardTitle
|
|
18
|
-
} from '@/components/ui/card'
|
|
19
|
-
import {
|
|
20
|
-
Form,
|
|
21
|
-
FormControl,
|
|
22
|
-
FormField,
|
|
23
|
-
FormItem,
|
|
24
|
-
FormMessage
|
|
25
|
-
} from '@/components/ui/form'
|
|
26
|
-
import { Input } from '@/components/ui/input'
|
|
27
|
-
import { toast } from '@/components/ui/use-toast'
|
|
28
|
-
import { updateName } from './actions'
|
|
29
|
-
|
|
30
|
-
const userSchema = z.object({
|
|
31
|
-
name: z.string().nonempty()
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
type FormData = z.infer<typeof userSchema>
|
|
35
|
-
|
|
36
|
-
export const Render: FC<{ name: string }> = ({ name }) => {
|
|
37
|
-
const form = useForm<FormData>({
|
|
38
|
-
resolver: zodResolver(userSchema),
|
|
39
|
-
defaultValues: {
|
|
40
|
-
name
|
|
41
|
-
}
|
|
42
|
-
})
|
|
43
|
-
const router = useRouter()
|
|
44
|
-
const [isSaving, setIsSaving] = useState(false)
|
|
45
|
-
|
|
46
|
-
async function onSubmit(data: FormData) {
|
|
47
|
-
setIsSaving(true)
|
|
48
|
-
|
|
49
|
-
try {
|
|
50
|
-
await updateName({
|
|
51
|
-
...data
|
|
52
|
-
})
|
|
53
|
-
toast({
|
|
54
|
-
title: 'Your name has been updated.'
|
|
55
|
-
})
|
|
56
|
-
router.refresh()
|
|
57
|
-
} catch (err) {
|
|
58
|
-
toast({
|
|
59
|
-
title: 'Internal Server Error',
|
|
60
|
-
variant: 'destructive',
|
|
61
|
-
description: 'Please try again later.'
|
|
62
|
-
})
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
setIsSaving(false)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<Form {...form}>
|
|
70
|
-
<form onSubmit={form.handleSubmit(onSubmit)}>
|
|
71
|
-
<Card>
|
|
72
|
-
<CardHeader>
|
|
73
|
-
<CardTitle>Your Name</CardTitle>
|
|
74
|
-
<CardDescription>
|
|
75
|
-
Please enter your full name or a display name you are comfortable
|
|
76
|
-
with.
|
|
77
|
-
</CardDescription>
|
|
78
|
-
</CardHeader>
|
|
79
|
-
<CardContent>
|
|
80
|
-
<FormField
|
|
81
|
-
control={form.control}
|
|
82
|
-
name="name"
|
|
83
|
-
render={({ field }) => (
|
|
84
|
-
<FormItem className="max-w-[400px]">
|
|
85
|
-
<FormControl>
|
|
86
|
-
<Input
|
|
87
|
-
type="text"
|
|
88
|
-
placeholder="Your Name"
|
|
89
|
-
autoComplete="name"
|
|
90
|
-
disabled={isSaving}
|
|
91
|
-
{...field}
|
|
92
|
-
/>
|
|
93
|
-
</FormControl>
|
|
94
|
-
<FormMessage />
|
|
95
|
-
</FormItem>
|
|
96
|
-
)}
|
|
97
|
-
/>
|
|
98
|
-
</CardContent>
|
|
99
|
-
<CardFooter>
|
|
100
|
-
<Button type="submit" disabled={isSaving}>
|
|
101
|
-
{isSaving ? (
|
|
102
|
-
<Icons.spinner className="mr-2 h-4 w-4 animate-spin" />
|
|
103
|
-
) : (
|
|
104
|
-
<Icons.save className="mr-2 h-4 w-4" />
|
|
105
|
-
)}
|
|
106
|
-
<span>Save</span>
|
|
107
|
-
</Button>
|
|
108
|
-
</CardFooter>
|
|
109
|
-
</Card>
|
|
110
|
-
</form>
|
|
111
|
-
</Form>
|
|
112
|
-
)
|
|
113
|
-
}
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
'use server'
|
|
2
|
-
|
|
3
|
-
import { TaskStatus } from '@prisma/client'
|
|
4
|
-
import { revalidatePath } from 'next/cache'
|
|
5
|
-
|
|
6
|
-
import { authGuard } from '@/lib/auth'
|
|
7
|
-
import { prisma } from '@/lib/db'
|
|
8
|
-
import { storageClient } from '@/lib/storageClient'
|
|
9
|
-
import { UnwrapPromise } from '@/types/UnwrapPromise'
|
|
10
|
-
|
|
11
|
-
const handleImages = async (imageIds: string[], taskId: string) => {
|
|
12
|
-
const prevImages = await prisma.resource.findMany({
|
|
13
|
-
where: {
|
|
14
|
-
taskId
|
|
15
|
-
}
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
for (const p of prevImages) {
|
|
19
|
-
if (imageIds.includes(p.id)) continue
|
|
20
|
-
await Promise.all([
|
|
21
|
-
storageClient.deleteFile(p.newFilename),
|
|
22
|
-
prisma.resource.delete({
|
|
23
|
-
where: {
|
|
24
|
-
id: p.id
|
|
25
|
-
}
|
|
26
|
-
})
|
|
27
|
-
])
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (imageIds.length)
|
|
31
|
-
await prisma.resource.updateMany({
|
|
32
|
-
where: {
|
|
33
|
-
id: {
|
|
34
|
-
in: imageIds
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
data: {
|
|
38
|
-
taskId
|
|
39
|
-
}
|
|
40
|
-
})
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export const getTask = async (id: string) => {
|
|
44
|
-
const session = await authGuard(['Root', 'Normal'], 'TaskView')
|
|
45
|
-
if (!session) throw new Error('Unauthorized')
|
|
46
|
-
|
|
47
|
-
return await prisma.task.findUnique({
|
|
48
|
-
where: {
|
|
49
|
-
id
|
|
50
|
-
},
|
|
51
|
-
include: {
|
|
52
|
-
createdBy: {
|
|
53
|
-
select: {
|
|
54
|
-
id: true,
|
|
55
|
-
name: true
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
updatedBy: {
|
|
59
|
-
select: {
|
|
60
|
-
id: true,
|
|
61
|
-
name: true
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
})
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export type GetTaskFnDataType = UnwrapPromise<ReturnType<typeof getTask>>
|
|
69
|
-
|
|
70
|
-
export const createTask = async ({
|
|
71
|
-
title,
|
|
72
|
-
status,
|
|
73
|
-
description,
|
|
74
|
-
imageIds
|
|
75
|
-
}: {
|
|
76
|
-
title: string
|
|
77
|
-
status: TaskStatus
|
|
78
|
-
description?: any
|
|
79
|
-
imageIds: string[]
|
|
80
|
-
}) => {
|
|
81
|
-
const session = await authGuard(['Root', 'Normal'], 'TaskCreate')
|
|
82
|
-
if (!session) throw new Error('Unauthorized')
|
|
83
|
-
|
|
84
|
-
const { id } = await prisma.task.create({
|
|
85
|
-
data: {
|
|
86
|
-
title,
|
|
87
|
-
status,
|
|
88
|
-
description,
|
|
89
|
-
createdById: session.user.id,
|
|
90
|
-
updatedById: session.user.id
|
|
91
|
-
}
|
|
92
|
-
})
|
|
93
|
-
await handleImages(imageIds, id)
|
|
94
|
-
|
|
95
|
-
revalidatePath('/tasks')
|
|
96
|
-
revalidatePath(`/tasks/${id}`)
|
|
97
|
-
|
|
98
|
-
return id
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export const updateTask = async ({
|
|
102
|
-
id,
|
|
103
|
-
title,
|
|
104
|
-
status,
|
|
105
|
-
description,
|
|
106
|
-
imageIds
|
|
107
|
-
}: {
|
|
108
|
-
id: string
|
|
109
|
-
title: string
|
|
110
|
-
status: TaskStatus
|
|
111
|
-
description?: any
|
|
112
|
-
imageIds: string[]
|
|
113
|
-
}) => {
|
|
114
|
-
const session = await authGuard(['Root', 'Normal'], 'TaskUpdate')
|
|
115
|
-
if (!session) throw new Error('Unauthorized')
|
|
116
|
-
|
|
117
|
-
await prisma.task.update({
|
|
118
|
-
where: {
|
|
119
|
-
id
|
|
120
|
-
},
|
|
121
|
-
data: {
|
|
122
|
-
title,
|
|
123
|
-
status,
|
|
124
|
-
description,
|
|
125
|
-
updatedById: session.user.id
|
|
126
|
-
}
|
|
127
|
-
})
|
|
128
|
-
await handleImages(imageIds, id)
|
|
129
|
-
|
|
130
|
-
revalidatePath('/tasks')
|
|
131
|
-
revalidatePath(`/tasks/${id}`)
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export const deleteTask = async (id: string) => {
|
|
135
|
-
const session = await authGuard(['Root', 'Normal'], 'TaskDelete')
|
|
136
|
-
if (!session) throw new Error('Unauthorized')
|
|
137
|
-
|
|
138
|
-
await handleImages([], id)
|
|
139
|
-
await prisma.task.delete({
|
|
140
|
-
where: {
|
|
141
|
-
id
|
|
142
|
-
}
|
|
143
|
-
})
|
|
144
|
-
|
|
145
|
-
revalidatePath('/tasks')
|
|
146
|
-
revalidatePath(`/tasks/${id}`)
|
|
147
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { Metadata } from 'next'
|
|
2
|
-
import { Session } from 'next-auth'
|
|
3
|
-
import { notFound } from 'next/navigation'
|
|
4
|
-
|
|
5
|
-
import { authGuard, checkForPermission } from '@/lib/auth'
|
|
6
|
-
import { siteConfig } from '@/lib/siteConfig'
|
|
7
|
-
import { GetTaskFnDataType, getTask } from './actions'
|
|
8
|
-
import { Render } from './render'
|
|
9
|
-
|
|
10
|
-
export const generateMetadata = async (props: {
|
|
11
|
-
params: { id: string }
|
|
12
|
-
}): Promise<Metadata> => ({
|
|
13
|
-
title: 'Task - ' + props.params.id + ' | ' + siteConfig.name
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
const TaskPage = async ({
|
|
17
|
-
params: { id }
|
|
18
|
-
}: {
|
|
19
|
-
params: {
|
|
20
|
-
id: string
|
|
21
|
-
}
|
|
22
|
-
}) => {
|
|
23
|
-
let session: Session
|
|
24
|
-
let task: GetTaskFnDataType | undefined
|
|
25
|
-
|
|
26
|
-
if (id === 'new') {
|
|
27
|
-
const tempSession = await authGuard(undefined, 'TaskCreate')
|
|
28
|
-
if (!tempSession) return notFound()
|
|
29
|
-
session = tempSession
|
|
30
|
-
} else {
|
|
31
|
-
const tempSession = await authGuard(undefined, 'TaskView')
|
|
32
|
-
if (!tempSession) return notFound()
|
|
33
|
-
session = tempSession
|
|
34
|
-
const x = await getTask(id)
|
|
35
|
-
if (!x) return notFound()
|
|
36
|
-
task = x
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const [canUpdate, canCreate, canDelete] = await Promise.all([
|
|
40
|
-
checkForPermission('TaskUpdate', session),
|
|
41
|
-
checkForPermission('TaskCreate', session),
|
|
42
|
-
checkForPermission('TaskDelete', session)
|
|
43
|
-
])
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<Render
|
|
47
|
-
task={task}
|
|
48
|
-
canUpdate={canUpdate}
|
|
49
|
-
canCreate={canCreate}
|
|
50
|
-
canDelete={canDelete}
|
|
51
|
-
/>
|
|
52
|
-
)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export default TaskPage
|