create-huenei-template 0.2.13 → 0.2.15
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/dist/config/templates.js +7 -0
- package/dist/templates/cursor/.cursor/agents/config-drift-analyzer.md +152 -0
- package/dist/templates/cursor/.cursor/commands/actualizar-reglas.md +580 -0
- package/dist/templates/frontend/react-ssr/.cursor/agents/accessibility-reviewer.md +22 -0
- package/dist/templates/frontend/react-ssr/.cursor/agents/nextjs-code-reviewer.md +24 -0
- package/dist/templates/frontend/react-ssr/.cursor/agents/react-test-expert.md +32 -0
- package/dist/templates/frontend/react-ssr/.cursor/agents/security-auditor.md +25 -0
- package/dist/templates/frontend/react-ssr/.cursor/commands/new-component.md +97 -0
- package/dist/templates/frontend/react-ssr/.cursor/commands/new-page.md +95 -0
- package/dist/templates/frontend/react-ssr/.cursor/commands/new-prisma-model.md +66 -0
- package/dist/templates/frontend/react-ssr/.cursor/commands/new-server-action.md +89 -0
- package/dist/templates/frontend/react-ssr/.cursor/hooks/auto-format.ts +64 -0
- package/dist/templates/frontend/react-ssr/.cursor/hooks/auto-test-on-stop.ts +94 -0
- package/dist/templates/frontend/react-ssr/.cursor/hooks/block-dangerous-commands.ts +120 -0
- package/dist/templates/frontend/react-ssr/.cursor/hooks/ensure-tests-exist.ts +209 -0
- package/dist/templates/frontend/react-ssr/.cursor/hooks/protect-sensitive-files.ts +101 -0
- package/dist/templates/frontend/react-ssr/.cursor/hooks/session-context.ts +93 -0
- package/dist/templates/frontend/react-ssr/.cursor/hooks/tsconfig.json +10 -0
- package/dist/templates/frontend/react-ssr/.cursor/hooks.json +41 -0
- package/dist/templates/frontend/react-ssr/.cursor/rules/auth-patterns.mdc +48 -0
- package/dist/templates/frontend/react-ssr/.cursor/rules/code-quality.mdc +39 -0
- package/dist/templates/frontend/react-ssr/.cursor/rules/naming-conventions.mdc +32 -0
- package/dist/templates/frontend/react-ssr/.cursor/rules/nextjs-architecture.mdc +51 -0
- package/dist/templates/frontend/react-ssr/.cursor/rules/prisma-standards.mdc +53 -0
- package/dist/templates/frontend/react-ssr/.cursor/rules/react-conventions.mdc +52 -0
- package/dist/templates/frontend/react-ssr/.cursor/rules/testing-conventions.mdc +53 -0
- package/dist/templates/frontend/react-ssr/.cursor/rules/ui-stack.mdc +47 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/authjs-skills/SKILL.md +1149 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/daisyui-5/SKILL.md +189 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/daisyui-5/daisyUI5.skill +0 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/daisyui-5/references/creating-components.md +412 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/daisyui-5/references/data-display.md +341 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/daisyui-5/references/feedback.md +240 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/daisyui-5/references/input.md +283 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/daisyui-5/references/layout.md +275 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/daisyui-5/references/navigation.md +338 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/daisyui-5/scripts/daisy-meta.ts +220 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/daisyui-5/scripts/generate-daisy-safelist.ts +152 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/docker-expert/SKILL.md +413 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/nextjs-app-router-patterns/SKILL.md +537 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/SKILL.md +243 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/db-execute.md +75 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/db-pull.md +185 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/db-push.md +148 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/db-seed.md +191 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/debug.md +46 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/dev.md +157 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/format.md +48 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/generate.md +147 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/init.md +118 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/migrate-deploy.md +127 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/migrate-dev.md +143 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/migrate-diff.md +89 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/migrate-reset.md +72 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/migrate-resolve.md +57 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/migrate-status.md +65 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/studio.md +122 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/validate.md +53 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/SKILL.md +216 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/client-methods.md +221 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/constructor.md +185 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/filters.md +256 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/model-queries.md +281 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/query-options.md +276 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/raw-queries.md +194 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/relations.md +308 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/transactions.md +184 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/AGENTS.md +97 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/README.md +138 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/SKILL.md +116 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/assets/templates/_template.md +26 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/_sections.md +46 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/adv-devtools-performance.md +69 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/adv-formprovider-memo.md +78 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/adv-testing-wrapper.md +63 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/array-complete-default-objects.md +66 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/array-separate-crud-operations.md +76 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/array-unique-fieldarray-per-name.md +58 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/array-use-field-id-as-key.md +54 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/array-virtualization-formprovider.md +64 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/ctrl-avoid-double-registration.md +46 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/ctrl-controller-field-props.md +56 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/ctrl-local-state-combination.md +69 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/ctrl-single-usecontroller-per-component.md +62 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/ctrl-usecontroller-isolation.md +64 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formcfg-async-default-values.md +69 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formcfg-default-values.md +57 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formcfg-revalidate-mode.md +48 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formcfg-should-unregister.md +62 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formcfg-useeffect-dependency.md +54 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formcfg-validation-mode.md +51 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formstate-avoid-isvalid-with-onsubmit.md +58 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formstate-destructure-formstate.md +48 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formstate-getfieldstate-for-single-field.md +49 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formstate-subscribe-to-specific-fields.md +54 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formstate-useformstate-isolation.md +62 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/integ-mui-controller-pattern.md +59 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/integ-shadcn-form-import.md +64 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/integ-shadcn-select-wiring.md +64 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/integ-value-transform.md +59 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/sub-avoid-watch-in-render.md +48 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/sub-deep-subscription.md +62 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/sub-useformcontext-sparingly.md +58 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/sub-usewatch-default-value.md +50 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/sub-usewatch-over-watch.md +58 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/sub-usewatch-with-getvalues.md +54 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/sub-watch-specific-fields.md +54 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/valid-delay-error.md +52 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/valid-dynamic-schema-factory.md +57 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/valid-error-message-strategy.md +65 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/valid-inline-vs-resolver.md +63 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/valid-native-validation.md +60 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/valid-resolver-caching.md +58 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/recharts/SKILL.md +713 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/recharts/references/api_reference.md +1121 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/recharts/references/best_practices.md +782 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/recharts/references/examples.md +940 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/SKILL.md +114 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/cache-gc-time.md +93 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/cache-invalidation.md +116 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/cache-placeholder-vs-initial.md +156 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/cache-stale-time.md +80 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/err-error-boundaries.md +150 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/inf-page-params.md +132 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/mut-invalidate-queries.md +118 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/mut-mutation-state.md +169 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/mut-optimistic-updates.md +137 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/network-mode.md +179 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/parallel-use-queries.md +152 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/perf-select-transform.md +144 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/persist-queries.md +194 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/pf-intent-prefetch.md +143 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/qk-array-structure.md +50 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/qk-factory-pattern.md +102 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/qk-hierarchical-organization.md +76 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/qk-include-dependencies.md +62 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/qk-serializable.md +93 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/query-cancellation.md +171 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/ssr-dehydration.md +158 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-table/SKILL.md +582 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/zod-4/SKILL.md +216 -0
- package/dist/templates/frontend/react-ssr/.dockerignore +14 -0
- package/dist/templates/frontend/react-ssr/.env.example +9 -0
- package/dist/templates/frontend/react-ssr/.husky/pre-commit +1 -0
- package/dist/templates/frontend/react-ssr/Dockerfile +41 -0
- package/dist/templates/frontend/react-ssr/README.md +121 -0
- package/dist/templates/frontend/react-ssr/components.json +22 -0
- package/dist/templates/frontend/react-ssr/docker-compose.yml +21 -0
- package/dist/templates/frontend/react-ssr/eslint.config.mjs +26 -0
- package/dist/templates/frontend/react-ssr/next.config.ts +7 -0
- package/dist/templates/frontend/react-ssr/package.json +86 -0
- package/dist/templates/frontend/react-ssr/postcss.config.mjs +5 -0
- package/dist/templates/frontend/react-ssr/prisma/schema.prisma +75 -0
- package/dist/templates/frontend/react-ssr/prisma/seed.ts +109 -0
- package/dist/templates/frontend/react-ssr/prisma.config.ts +17 -0
- package/dist/templates/frontend/react-ssr/skills-lock.json +65 -0
- package/dist/templates/frontend/react-ssr/src/__tests__/components/ui/badge.test.tsx +26 -0
- package/dist/templates/frontend/react-ssr/src/__tests__/components/ui/button.test.tsx +38 -0
- package/dist/templates/frontend/react-ssr/src/__tests__/components/ui/card.test.tsx +39 -0
- package/dist/templates/frontend/react-ssr/src/__tests__/components/ui/input.test.tsx +32 -0
- package/dist/templates/frontend/react-ssr/src/__tests__/hooks/useLocalStorage.test.ts +53 -0
- package/dist/templates/frontend/react-ssr/src/__tests__/lib/queryClient.test.ts +19 -0
- package/dist/templates/frontend/react-ssr/src/__tests__/lib/utils.test.ts +24 -0
- package/dist/templates/frontend/react-ssr/src/actions/auth.ts +91 -0
- package/dist/templates/frontend/react-ssr/src/actions/contacto.ts +46 -0
- package/dist/templates/frontend/react-ssr/src/actions/proyectos.ts +159 -0
- package/dist/templates/frontend/react-ssr/src/app/(authenticated)/dashboard/dashboard-client.tsx +321 -0
- package/dist/templates/frontend/react-ssr/src/app/(authenticated)/dashboard/page.tsx +48 -0
- package/dist/templates/frontend/react-ssr/src/app/(authenticated)/layout.tsx +34 -0
- package/dist/templates/frontend/react-ssr/src/app/(authenticated)/perfil/page.tsx +85 -0
- package/dist/templates/frontend/react-ssr/src/app/(authenticated)/proyectos-crud/page.tsx +23 -0
- package/dist/templates/frontend/react-ssr/src/app/(authenticated)/proyectos-crud/proyectos-crud-client.tsx +472 -0
- package/dist/templates/frontend/react-ssr/src/app/(authenticated)/ui-components/page.tsx +358 -0
- package/dist/templates/frontend/react-ssr/src/app/api/auth/[...nextauth]/route.ts +3 -0
- package/dist/templates/frontend/react-ssr/src/app/auth/iniciar-sesion/page.tsx +148 -0
- package/dist/templates/frontend/react-ssr/src/app/auth/recuperar-password/page.tsx +100 -0
- package/dist/templates/frontend/react-ssr/src/app/auth/registro/page.tsx +154 -0
- package/dist/templates/frontend/react-ssr/src/app/contacto/contacto-form.tsx +189 -0
- package/dist/templates/frontend/react-ssr/src/app/contacto/page.tsx +11 -0
- package/dist/templates/frontend/react-ssr/src/app/globals.css +99 -0
- package/dist/templates/frontend/react-ssr/src/app/layout.tsx +22 -0
- package/dist/templates/frontend/react-ssr/src/app/loading.tsx +7 -0
- package/dist/templates/frontend/react-ssr/src/app/not-found.tsx +14 -0
- package/dist/templates/frontend/react-ssr/src/app/page.tsx +331 -0
- package/dist/templates/frontend/react-ssr/src/app/proyectos/page.tsx +178 -0
- package/dist/templates/frontend/react-ssr/src/auth.ts +64 -0
- package/dist/templates/frontend/react-ssr/src/components/layout/navbar.tsx +68 -0
- package/dist/templates/frontend/react-ssr/src/components/layout/sidebar.tsx +109 -0
- package/dist/templates/frontend/react-ssr/src/components/layout/sign-out-button.tsx +16 -0
- package/dist/templates/frontend/react-ssr/src/components/providers.tsx +33 -0
- package/dist/templates/frontend/react-ssr/src/components/ui/avatar.tsx +53 -0
- package/dist/templates/frontend/react-ssr/src/components/ui/badge.tsx +42 -0
- package/dist/templates/frontend/react-ssr/src/components/ui/breadcrumb.tsx +114 -0
- package/dist/templates/frontend/react-ssr/src/components/ui/button.tsx +58 -0
- package/dist/templates/frontend/react-ssr/src/components/ui/card.tsx +95 -0
- package/dist/templates/frontend/react-ssr/src/components/ui/dialog.tsx +136 -0
- package/dist/templates/frontend/react-ssr/src/components/ui/form.tsx +168 -0
- package/dist/templates/frontend/react-ssr/src/components/ui/input.tsx +22 -0
- package/dist/templates/frontend/react-ssr/src/components/ui/label.tsx +26 -0
- package/dist/templates/frontend/react-ssr/src/components/ui/password-input.tsx +43 -0
- package/dist/templates/frontend/react-ssr/src/components/ui/separator.tsx +30 -0
- package/dist/templates/frontend/react-ssr/src/components/ui/table.tsx +240 -0
- package/dist/templates/frontend/react-ssr/src/components/ui/tabs.tsx +76 -0
- package/dist/templates/frontend/react-ssr/src/components/ui/textarea.tsx +21 -0
- package/dist/templates/frontend/react-ssr/src/data/dashboard.ts +179 -0
- package/dist/templates/frontend/react-ssr/src/hooks/useLocalStorage.ts +38 -0
- package/dist/templates/frontend/react-ssr/src/lib/prisma.ts +24 -0
- package/dist/templates/frontend/react-ssr/src/lib/queryClient.ts +25 -0
- package/dist/templates/frontend/react-ssr/src/lib/utils.ts +6 -0
- package/dist/templates/frontend/react-ssr/src/proxy.ts +31 -0
- package/dist/templates/frontend/react-ssr/src/test/mocks/next-navigation.ts +16 -0
- package/dist/templates/frontend/react-ssr/src/test/setup.ts +1 -0
- package/dist/templates/frontend/react-ssr/src/test/utils.tsx +30 -0
- package/dist/templates/frontend/react-ssr/src/types/index.ts +36 -0
- package/dist/templates/frontend/react-ssr/tsconfig.json +41 -0
- package/dist/templates/frontend/react-ssr/vitest.config.ts +41 -0
- package/package.json +1 -1
- package/templates/cursor/.cursor/agents/config-drift-analyzer.md +152 -0
- package/templates/cursor/.cursor/commands/actualizar-reglas.md +580 -0
- package/templates/frontend/react-ssr/.cursor/agents/accessibility-reviewer.md +22 -0
- package/templates/frontend/react-ssr/.cursor/agents/nextjs-code-reviewer.md +24 -0
- package/templates/frontend/react-ssr/.cursor/agents/react-test-expert.md +32 -0
- package/templates/frontend/react-ssr/.cursor/agents/security-auditor.md +25 -0
- package/templates/frontend/react-ssr/.cursor/commands/new-component.md +97 -0
- package/templates/frontend/react-ssr/.cursor/commands/new-page.md +95 -0
- package/templates/frontend/react-ssr/.cursor/commands/new-prisma-model.md +66 -0
- package/templates/frontend/react-ssr/.cursor/commands/new-server-action.md +89 -0
- package/templates/frontend/react-ssr/.cursor/hooks/auto-format.ts +64 -0
- package/templates/frontend/react-ssr/.cursor/hooks/auto-test-on-stop.ts +94 -0
- package/templates/frontend/react-ssr/.cursor/hooks/block-dangerous-commands.ts +120 -0
- package/templates/frontend/react-ssr/.cursor/hooks/ensure-tests-exist.ts +209 -0
- package/templates/frontend/react-ssr/.cursor/hooks/protect-sensitive-files.ts +101 -0
- package/templates/frontend/react-ssr/.cursor/hooks/session-context.ts +93 -0
- package/templates/frontend/react-ssr/.cursor/hooks/tsconfig.json +10 -0
- package/templates/frontend/react-ssr/.cursor/hooks.json +41 -0
- package/templates/frontend/react-ssr/.cursor/rules/auth-patterns.mdc +48 -0
- package/templates/frontend/react-ssr/.cursor/rules/code-quality.mdc +39 -0
- package/templates/frontend/react-ssr/.cursor/rules/naming-conventions.mdc +32 -0
- package/templates/frontend/react-ssr/.cursor/rules/nextjs-architecture.mdc +51 -0
- package/templates/frontend/react-ssr/.cursor/rules/prisma-standards.mdc +53 -0
- package/templates/frontend/react-ssr/.cursor/rules/react-conventions.mdc +52 -0
- package/templates/frontend/react-ssr/.cursor/rules/testing-conventions.mdc +53 -0
- package/templates/frontend/react-ssr/.cursor/rules/ui-stack.mdc +47 -0
- package/templates/frontend/react-ssr/.cursor/skills/authjs-skills/SKILL.md +1149 -0
- package/templates/frontend/react-ssr/.cursor/skills/daisyui-5/SKILL.md +189 -0
- package/templates/frontend/react-ssr/.cursor/skills/daisyui-5/daisyUI5.skill +0 -0
- package/templates/frontend/react-ssr/.cursor/skills/daisyui-5/references/creating-components.md +412 -0
- package/templates/frontend/react-ssr/.cursor/skills/daisyui-5/references/data-display.md +341 -0
- package/templates/frontend/react-ssr/.cursor/skills/daisyui-5/references/feedback.md +240 -0
- package/templates/frontend/react-ssr/.cursor/skills/daisyui-5/references/input.md +283 -0
- package/templates/frontend/react-ssr/.cursor/skills/daisyui-5/references/layout.md +275 -0
- package/templates/frontend/react-ssr/.cursor/skills/daisyui-5/references/navigation.md +338 -0
- package/templates/frontend/react-ssr/.cursor/skills/daisyui-5/scripts/daisy-meta.ts +220 -0
- package/templates/frontend/react-ssr/.cursor/skills/daisyui-5/scripts/generate-daisy-safelist.ts +152 -0
- package/templates/frontend/react-ssr/.cursor/skills/docker-expert/SKILL.md +413 -0
- package/templates/frontend/react-ssr/.cursor/skills/nextjs-app-router-patterns/SKILL.md +537 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/SKILL.md +243 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/db-execute.md +75 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/db-pull.md +185 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/db-push.md +148 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/db-seed.md +191 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/debug.md +46 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/dev.md +157 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/format.md +48 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/generate.md +147 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/init.md +118 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/migrate-deploy.md +127 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/migrate-dev.md +143 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/migrate-diff.md +89 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/migrate-reset.md +72 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/migrate-resolve.md +57 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/migrate-status.md +65 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/studio.md +122 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/validate.md +53 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/SKILL.md +216 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/client-methods.md +221 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/constructor.md +185 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/filters.md +256 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/model-queries.md +281 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/query-options.md +276 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/raw-queries.md +194 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/relations.md +308 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/transactions.md +184 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/AGENTS.md +97 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/README.md +138 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/SKILL.md +116 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/assets/templates/_template.md +26 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/_sections.md +46 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/adv-devtools-performance.md +69 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/adv-formprovider-memo.md +78 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/adv-testing-wrapper.md +63 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/array-complete-default-objects.md +66 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/array-separate-crud-operations.md +76 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/array-unique-fieldarray-per-name.md +58 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/array-use-field-id-as-key.md +54 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/array-virtualization-formprovider.md +64 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/ctrl-avoid-double-registration.md +46 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/ctrl-controller-field-props.md +56 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/ctrl-local-state-combination.md +69 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/ctrl-single-usecontroller-per-component.md +62 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/ctrl-usecontroller-isolation.md +64 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formcfg-async-default-values.md +69 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formcfg-default-values.md +57 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formcfg-revalidate-mode.md +48 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formcfg-should-unregister.md +62 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formcfg-useeffect-dependency.md +54 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formcfg-validation-mode.md +51 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formstate-avoid-isvalid-with-onsubmit.md +58 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formstate-destructure-formstate.md +48 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formstate-getfieldstate-for-single-field.md +49 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formstate-subscribe-to-specific-fields.md +54 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formstate-useformstate-isolation.md +62 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/integ-mui-controller-pattern.md +59 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/integ-shadcn-form-import.md +64 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/integ-shadcn-select-wiring.md +64 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/integ-value-transform.md +59 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/sub-avoid-watch-in-render.md +48 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/sub-deep-subscription.md +62 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/sub-useformcontext-sparingly.md +58 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/sub-usewatch-default-value.md +50 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/sub-usewatch-over-watch.md +58 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/sub-usewatch-with-getvalues.md +54 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/sub-watch-specific-fields.md +54 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/valid-delay-error.md +52 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/valid-dynamic-schema-factory.md +57 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/valid-error-message-strategy.md +65 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/valid-inline-vs-resolver.md +63 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/valid-native-validation.md +60 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/valid-resolver-caching.md +58 -0
- package/templates/frontend/react-ssr/.cursor/skills/recharts/SKILL.md +713 -0
- package/templates/frontend/react-ssr/.cursor/skills/recharts/references/api_reference.md +1121 -0
- package/templates/frontend/react-ssr/.cursor/skills/recharts/references/best_practices.md +782 -0
- package/templates/frontend/react-ssr/.cursor/skills/recharts/references/examples.md +940 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/SKILL.md +114 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/cache-gc-time.md +93 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/cache-invalidation.md +116 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/cache-placeholder-vs-initial.md +156 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/cache-stale-time.md +80 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/err-error-boundaries.md +150 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/inf-page-params.md +132 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/mut-invalidate-queries.md +118 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/mut-mutation-state.md +169 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/mut-optimistic-updates.md +137 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/network-mode.md +179 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/parallel-use-queries.md +152 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/perf-select-transform.md +144 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/persist-queries.md +194 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/pf-intent-prefetch.md +143 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/qk-array-structure.md +50 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/qk-factory-pattern.md +102 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/qk-hierarchical-organization.md +76 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/qk-include-dependencies.md +62 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/qk-serializable.md +93 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/query-cancellation.md +171 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/ssr-dehydration.md +158 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-table/SKILL.md +582 -0
- package/templates/frontend/react-ssr/.cursor/skills/zod-4/SKILL.md +216 -0
- package/templates/frontend/react-ssr/.dockerignore +14 -0
- package/templates/frontend/react-ssr/.env.example +9 -0
- package/templates/frontend/react-ssr/.husky/pre-commit +1 -0
- package/templates/frontend/react-ssr/Dockerfile +41 -0
- package/templates/frontend/react-ssr/README.md +121 -0
- package/templates/frontend/react-ssr/components.json +22 -0
- package/templates/frontend/react-ssr/docker-compose.yml +21 -0
- package/templates/frontend/react-ssr/eslint.config.mjs +26 -0
- package/templates/frontend/react-ssr/next.config.ts +7 -0
- package/templates/frontend/react-ssr/package.json +86 -0
- package/templates/frontend/react-ssr/postcss.config.mjs +5 -0
- package/templates/frontend/react-ssr/prisma/schema.prisma +75 -0
- package/templates/frontend/react-ssr/prisma/seed.ts +109 -0
- package/templates/frontend/react-ssr/prisma.config.ts +17 -0
- package/templates/frontend/react-ssr/skills-lock.json +65 -0
- package/templates/frontend/react-ssr/src/__tests__/components/ui/badge.test.tsx +26 -0
- package/templates/frontend/react-ssr/src/__tests__/components/ui/button.test.tsx +38 -0
- package/templates/frontend/react-ssr/src/__tests__/components/ui/card.test.tsx +39 -0
- package/templates/frontend/react-ssr/src/__tests__/components/ui/input.test.tsx +32 -0
- package/templates/frontend/react-ssr/src/__tests__/hooks/useLocalStorage.test.ts +53 -0
- package/templates/frontend/react-ssr/src/__tests__/lib/queryClient.test.ts +19 -0
- package/templates/frontend/react-ssr/src/__tests__/lib/utils.test.ts +24 -0
- package/templates/frontend/react-ssr/src/actions/auth.ts +91 -0
- package/templates/frontend/react-ssr/src/actions/contacto.ts +46 -0
- package/templates/frontend/react-ssr/src/actions/proyectos.ts +159 -0
- package/templates/frontend/react-ssr/src/app/(authenticated)/dashboard/dashboard-client.tsx +321 -0
- package/templates/frontend/react-ssr/src/app/(authenticated)/dashboard/page.tsx +48 -0
- package/templates/frontend/react-ssr/src/app/(authenticated)/layout.tsx +34 -0
- package/templates/frontend/react-ssr/src/app/(authenticated)/perfil/page.tsx +85 -0
- package/templates/frontend/react-ssr/src/app/(authenticated)/proyectos-crud/page.tsx +23 -0
- package/templates/frontend/react-ssr/src/app/(authenticated)/proyectos-crud/proyectos-crud-client.tsx +472 -0
- package/templates/frontend/react-ssr/src/app/(authenticated)/ui-components/page.tsx +358 -0
- package/templates/frontend/react-ssr/src/app/api/auth/[...nextauth]/route.ts +3 -0
- package/templates/frontend/react-ssr/src/app/auth/iniciar-sesion/page.tsx +148 -0
- package/templates/frontend/react-ssr/src/app/auth/recuperar-password/page.tsx +100 -0
- package/templates/frontend/react-ssr/src/app/auth/registro/page.tsx +154 -0
- package/templates/frontend/react-ssr/src/app/contacto/contacto-form.tsx +189 -0
- package/templates/frontend/react-ssr/src/app/contacto/page.tsx +11 -0
- package/templates/frontend/react-ssr/src/app/globals.css +99 -0
- package/templates/frontend/react-ssr/src/app/layout.tsx +22 -0
- package/templates/frontend/react-ssr/src/app/loading.tsx +7 -0
- package/templates/frontend/react-ssr/src/app/not-found.tsx +14 -0
- package/templates/frontend/react-ssr/src/app/page.tsx +331 -0
- package/templates/frontend/react-ssr/src/app/proyectos/page.tsx +178 -0
- package/templates/frontend/react-ssr/src/auth.ts +64 -0
- package/templates/frontend/react-ssr/src/components/layout/navbar.tsx +68 -0
- package/templates/frontend/react-ssr/src/components/layout/sidebar.tsx +109 -0
- package/templates/frontend/react-ssr/src/components/layout/sign-out-button.tsx +16 -0
- package/templates/frontend/react-ssr/src/components/providers.tsx +33 -0
- package/templates/frontend/react-ssr/src/components/ui/avatar.tsx +53 -0
- package/templates/frontend/react-ssr/src/components/ui/badge.tsx +42 -0
- package/templates/frontend/react-ssr/src/components/ui/breadcrumb.tsx +114 -0
- package/templates/frontend/react-ssr/src/components/ui/button.tsx +58 -0
- package/templates/frontend/react-ssr/src/components/ui/card.tsx +95 -0
- package/templates/frontend/react-ssr/src/components/ui/dialog.tsx +136 -0
- package/templates/frontend/react-ssr/src/components/ui/form.tsx +168 -0
- package/templates/frontend/react-ssr/src/components/ui/input.tsx +22 -0
- package/templates/frontend/react-ssr/src/components/ui/label.tsx +26 -0
- package/templates/frontend/react-ssr/src/components/ui/password-input.tsx +43 -0
- package/templates/frontend/react-ssr/src/components/ui/separator.tsx +30 -0
- package/templates/frontend/react-ssr/src/components/ui/table.tsx +240 -0
- package/templates/frontend/react-ssr/src/components/ui/tabs.tsx +76 -0
- package/templates/frontend/react-ssr/src/components/ui/textarea.tsx +21 -0
- package/templates/frontend/react-ssr/src/data/dashboard.ts +179 -0
- package/templates/frontend/react-ssr/src/hooks/useLocalStorage.ts +38 -0
- package/templates/frontend/react-ssr/src/lib/prisma.ts +24 -0
- package/templates/frontend/react-ssr/src/lib/queryClient.ts +25 -0
- package/templates/frontend/react-ssr/src/lib/utils.ts +6 -0
- package/templates/frontend/react-ssr/src/proxy.ts +31 -0
- package/templates/frontend/react-ssr/src/test/mocks/next-navigation.ts +16 -0
- package/templates/frontend/react-ssr/src/test/setup.ts +1 -0
- package/templates/frontend/react-ssr/src/test/utils.tsx +30 -0
- package/templates/frontend/react-ssr/src/types/index.ts +36 -0
- package/templates/frontend/react-ssr/tsconfig.json +41 -0
- package/templates/frontend/react-ssr/vitest.config.ts +41 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import "dotenv/config";
|
|
2
|
+
import { PrismaClient } from "@prisma/client";
|
|
3
|
+
import { PrismaMariaDb } from "@prisma/adapter-mariadb";
|
|
4
|
+
import bcrypt from "bcryptjs";
|
|
5
|
+
|
|
6
|
+
const url = new URL(process.env.DATABASE_URL!);
|
|
7
|
+
const adapter = new PrismaMariaDb({
|
|
8
|
+
host: url.hostname,
|
|
9
|
+
port: Number(url.port) || 3306,
|
|
10
|
+
user: url.username,
|
|
11
|
+
password: url.password,
|
|
12
|
+
database: url.pathname.slice(1),
|
|
13
|
+
});
|
|
14
|
+
const prisma = new PrismaClient({ adapter });
|
|
15
|
+
|
|
16
|
+
async function main() {
|
|
17
|
+
const hashedPassword = await bcrypt.hash("123456", 12);
|
|
18
|
+
|
|
19
|
+
const admin = await prisma.user.upsert({
|
|
20
|
+
where: { email: "admin@huenei.com" },
|
|
21
|
+
update: {},
|
|
22
|
+
create: {
|
|
23
|
+
email: "admin@huenei.com",
|
|
24
|
+
name: "Admin Huenei",
|
|
25
|
+
password: hashedPassword,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const dev = await prisma.user.upsert({
|
|
30
|
+
where: { email: "dev@huenei.com" },
|
|
31
|
+
update: {},
|
|
32
|
+
create: {
|
|
33
|
+
email: "dev@huenei.com",
|
|
34
|
+
name: "Developer",
|
|
35
|
+
password: hashedPassword,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
await prisma.proyecto.createMany({
|
|
40
|
+
skipDuplicates: true,
|
|
41
|
+
data: [
|
|
42
|
+
{
|
|
43
|
+
titulo: "Portal E-commerce",
|
|
44
|
+
descripcion:
|
|
45
|
+
"Plataforma de comercio electrónico con carrito, pagos y gestión de inventario.",
|
|
46
|
+
tecnologias: "Next.js, Prisma, MySQL, Tailwind CSS",
|
|
47
|
+
estado: "En Producción",
|
|
48
|
+
presupuesto: 85000,
|
|
49
|
+
fecha: new Date("2025-03-15"),
|
|
50
|
+
userId: admin.id,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
titulo: "App de Gestión Interna",
|
|
54
|
+
descripcion:
|
|
55
|
+
"Sistema interno para gestión de proyectos, recursos humanos y reportes.",
|
|
56
|
+
tecnologias: "React, NestJS, PostgreSQL",
|
|
57
|
+
estado: "En Desarrollo",
|
|
58
|
+
presupuesto: 120000,
|
|
59
|
+
fecha: new Date("2025-06-01"),
|
|
60
|
+
userId: admin.id,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
titulo: "API de Integraciones",
|
|
64
|
+
descripcion:
|
|
65
|
+
"API REST para integración con sistemas de terceros y microservicios.",
|
|
66
|
+
tecnologias: "NestJS, RabbitMQ, Redis, Docker",
|
|
67
|
+
estado: "En Desarrollo",
|
|
68
|
+
presupuesto: 65000,
|
|
69
|
+
fecha: new Date("2025-08-20"),
|
|
70
|
+
userId: dev.id,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
titulo: "Dashboard Analytics",
|
|
74
|
+
descripcion:
|
|
75
|
+
"Panel de análisis de datos con gráficos interactivos y reportes en tiempo real.",
|
|
76
|
+
tecnologias: "Next.js, Recharts, WebSockets",
|
|
77
|
+
estado: "Pausado",
|
|
78
|
+
presupuesto: 45000,
|
|
79
|
+
fecha: new Date("2025-01-10"),
|
|
80
|
+
userId: dev.id,
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
titulo: "Mobile Banking",
|
|
84
|
+
descripcion:
|
|
85
|
+
"Aplicación móvil para operaciones bancarias, transferencias y consulta de saldos.",
|
|
86
|
+
tecnologias: "React Native, Expo, Node.js",
|
|
87
|
+
estado: "En Producción",
|
|
88
|
+
presupuesto: 200000,
|
|
89
|
+
fecha: new Date("2024-11-05"),
|
|
90
|
+
userId: admin.id,
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
console.log("Seed completado:");
|
|
96
|
+
console.log(` - Usuarios: ${admin.email}, ${dev.email}`);
|
|
97
|
+
console.log(" - Password: 123456 (para ambos)");
|
|
98
|
+
console.log(" - Proyectos: 5 creados");
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
main()
|
|
102
|
+
.then(async () => {
|
|
103
|
+
await prisma.$disconnect();
|
|
104
|
+
})
|
|
105
|
+
.catch(async (e) => {
|
|
106
|
+
console.error(e);
|
|
107
|
+
await prisma.$disconnect();
|
|
108
|
+
process.exit(1);
|
|
109
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import "dotenv/config";
|
|
2
|
+
import { defineConfig, env } from "prisma/config";
|
|
3
|
+
|
|
4
|
+
type Env = {
|
|
5
|
+
DATABASE_URL: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export default defineConfig({
|
|
9
|
+
schema: "prisma/schema.prisma",
|
|
10
|
+
migrations: {
|
|
11
|
+
path: "prisma/migrations",
|
|
12
|
+
seed: "tsx prisma/seed.ts",
|
|
13
|
+
},
|
|
14
|
+
datasource: {
|
|
15
|
+
url: env<Env>("DATABASE_URL"),
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"skills": {
|
|
4
|
+
"authjs-skills": {
|
|
5
|
+
"source": "gocallum/nextjs16-agent-skills",
|
|
6
|
+
"sourceType": "github",
|
|
7
|
+
"computedHash": "a9e50317bfff481c46c9b7199bbb952c9cd776dc02767e1c0f22232452bb0341"
|
|
8
|
+
},
|
|
9
|
+
"daisyui-5": {
|
|
10
|
+
"source": "nenorrell/skills",
|
|
11
|
+
"sourceType": "github",
|
|
12
|
+
"computedHash": "69fdd9b11ef9762697b29887500d28f45920bbe18e8946e823ab3090492dacb7"
|
|
13
|
+
},
|
|
14
|
+
"docker-expert": {
|
|
15
|
+
"source": "sickn33/antigravity-awesome-skills",
|
|
16
|
+
"sourceType": "github",
|
|
17
|
+
"computedHash": "d18feeb0276b89df2c7e57ad36be879633e43e9c505e6f8110abe6e89972abc9"
|
|
18
|
+
},
|
|
19
|
+
"find-skills": {
|
|
20
|
+
"source": "vercel-labs/skills",
|
|
21
|
+
"sourceType": "github",
|
|
22
|
+
"computedHash": "645b891da1edbae76ab79c7b088d4e73397464f8396edaf773c0e01971ce75d6"
|
|
23
|
+
},
|
|
24
|
+
"nextjs-app-router-patterns": {
|
|
25
|
+
"source": "wshobson/agents",
|
|
26
|
+
"sourceType": "github",
|
|
27
|
+
"computedHash": "04c1df896cc2c9ef824d618b95d21686c5b8e24e5cb32b3d6fe9d97d4b661536"
|
|
28
|
+
},
|
|
29
|
+
"prisma-cli": {
|
|
30
|
+
"source": "prisma/skills",
|
|
31
|
+
"sourceType": "github",
|
|
32
|
+
"computedHash": "0f613c8d46027714ec40300d2ece024a31f9d17b1a380eb408d40ef7b8c53849"
|
|
33
|
+
},
|
|
34
|
+
"prisma-client-api": {
|
|
35
|
+
"source": "prisma/skills",
|
|
36
|
+
"sourceType": "github",
|
|
37
|
+
"computedHash": "a982b2a15dc9d4223be7844f082e6481e1e24df1f379fbcf66b82d5b58e80bec"
|
|
38
|
+
},
|
|
39
|
+
"react-hook-form": {
|
|
40
|
+
"source": "pproenca/dot-skills",
|
|
41
|
+
"sourceType": "github",
|
|
42
|
+
"computedHash": "4e32884be8612b5ce12dd328812f68970e38ef81d6809a0d59225e84e57b17ea"
|
|
43
|
+
},
|
|
44
|
+
"recharts": {
|
|
45
|
+
"source": "ansanabria/skills",
|
|
46
|
+
"sourceType": "github",
|
|
47
|
+
"computedHash": "7837f15d0abac0f5199eba9417bd8950e4f01c58731c81884e82e58b0c474404"
|
|
48
|
+
},
|
|
49
|
+
"tanstack-query-best-practices": {
|
|
50
|
+
"source": "deckardger/tanstack-agent-skills",
|
|
51
|
+
"sourceType": "github",
|
|
52
|
+
"computedHash": "addf4358803d7746f7fe0475a3370d835775217e00dd5fc7bbd8a7d6c53d81e5"
|
|
53
|
+
},
|
|
54
|
+
"tanstack-table": {
|
|
55
|
+
"source": "tanstack-skills/tanstack-skills",
|
|
56
|
+
"sourceType": "github",
|
|
57
|
+
"computedHash": "5527e42e541ac26fc1157e49d58c399b95e44eb276ef3caa7576ab138558d593"
|
|
58
|
+
},
|
|
59
|
+
"zod-4": {
|
|
60
|
+
"source": "prowler-cloud/prowler",
|
|
61
|
+
"sourceType": "github",
|
|
62
|
+
"computedHash": "6a653ef30816280ef774a3fa94cc0e6cf7e9ce447bb28ad6456b2fe6b283b288"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { render, screen } from "@/test/utils";
|
|
3
|
+
import { Badge } from "@/components/ui/badge";
|
|
4
|
+
|
|
5
|
+
describe("Badge", () => {
|
|
6
|
+
it("renders with default variant", () => {
|
|
7
|
+
render(<Badge>Default</Badge>);
|
|
8
|
+
expect(screen.getByText("Default")).toBeInTheDocument();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it("renders with secondary variant", () => {
|
|
12
|
+
render(<Badge variant="secondary">Secondary</Badge>);
|
|
13
|
+
expect(screen.getByText("Secondary")).toBeInTheDocument();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("renders with destructive variant", () => {
|
|
17
|
+
render(<Badge variant="destructive">Error</Badge>);
|
|
18
|
+
expect(screen.getByText("Error")).toBeInTheDocument();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("applies custom className", () => {
|
|
22
|
+
render(<Badge className="badge-success">Success</Badge>);
|
|
23
|
+
const badge = screen.getByText("Success");
|
|
24
|
+
expect(badge.className).toContain("badge-success");
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { render, screen } from "@/test/utils";
|
|
3
|
+
import { Button } from "@/components/ui/button";
|
|
4
|
+
|
|
5
|
+
describe("Button", () => {
|
|
6
|
+
it("renders with default variant", () => {
|
|
7
|
+
render(<Button>Click me</Button>);
|
|
8
|
+
const button = screen.getByRole("button", { name: /click me/i });
|
|
9
|
+
expect(button).toBeInTheDocument();
|
|
10
|
+
expect(button).toHaveAttribute("data-variant", "default");
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it("renders with different variants", () => {
|
|
14
|
+
const { rerender } = render(
|
|
15
|
+
<Button variant="destructive">Delete</Button>,
|
|
16
|
+
);
|
|
17
|
+
expect(screen.getByRole("button")).toHaveAttribute(
|
|
18
|
+
"data-variant",
|
|
19
|
+
"destructive",
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
rerender(<Button variant="outline">Outline</Button>);
|
|
23
|
+
expect(screen.getByRole("button")).toHaveAttribute(
|
|
24
|
+
"data-variant",
|
|
25
|
+
"outline",
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("renders with different sizes", () => {
|
|
30
|
+
render(<Button size="sm">Small</Button>);
|
|
31
|
+
expect(screen.getByRole("button")).toHaveAttribute("data-size", "sm");
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("is disabled when disabled prop is true", () => {
|
|
35
|
+
render(<Button disabled>Disabled</Button>);
|
|
36
|
+
expect(screen.getByRole("button")).toBeDisabled();
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { render, screen } from "@/test/utils";
|
|
3
|
+
import {
|
|
4
|
+
Card,
|
|
5
|
+
CardHeader,
|
|
6
|
+
CardTitle,
|
|
7
|
+
CardDescription,
|
|
8
|
+
CardContent,
|
|
9
|
+
CardFooter,
|
|
10
|
+
} from "@/components/ui/card";
|
|
11
|
+
|
|
12
|
+
describe("Card", () => {
|
|
13
|
+
it("renders card with all slots", () => {
|
|
14
|
+
render(
|
|
15
|
+
<Card>
|
|
16
|
+
<CardHeader>
|
|
17
|
+
<CardTitle>Title</CardTitle>
|
|
18
|
+
<CardDescription>Description</CardDescription>
|
|
19
|
+
</CardHeader>
|
|
20
|
+
<CardContent>Content</CardContent>
|
|
21
|
+
<CardFooter>Footer</CardFooter>
|
|
22
|
+
</Card>,
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
expect(screen.getByText("Title")).toBeInTheDocument();
|
|
26
|
+
expect(screen.getByText("Description")).toBeInTheDocument();
|
|
27
|
+
expect(screen.getByText("Content")).toBeInTheDocument();
|
|
28
|
+
expect(screen.getByText("Footer")).toBeInTheDocument();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("applies data-slot attributes", () => {
|
|
32
|
+
render(
|
|
33
|
+
<Card data-testid="card">
|
|
34
|
+
<CardContent>Test</CardContent>
|
|
35
|
+
</Card>,
|
|
36
|
+
);
|
|
37
|
+
expect(screen.getByTestId("card")).toHaveAttribute("data-slot", "card");
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { render, screen } from "@/test/utils";
|
|
3
|
+
import userEvent from "@testing-library/user-event";
|
|
4
|
+
import { Input } from "@/components/ui/input";
|
|
5
|
+
|
|
6
|
+
describe("Input", () => {
|
|
7
|
+
it("renders with placeholder", () => {
|
|
8
|
+
render(<Input placeholder="Enter text" />);
|
|
9
|
+
expect(screen.getByPlaceholderText("Enter text")).toBeInTheDocument();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it("accepts user input", async () => {
|
|
13
|
+
const user = userEvent.setup();
|
|
14
|
+
render(<Input placeholder="Type here" />);
|
|
15
|
+
const input = screen.getByPlaceholderText("Type here");
|
|
16
|
+
await user.type(input, "Hello");
|
|
17
|
+
expect(input).toHaveValue("Hello");
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("renders as disabled", () => {
|
|
21
|
+
render(<Input disabled placeholder="Disabled" />);
|
|
22
|
+
expect(screen.getByPlaceholderText("Disabled")).toBeDisabled();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("renders with different types", () => {
|
|
26
|
+
render(<Input type="email" placeholder="email" />);
|
|
27
|
+
expect(screen.getByPlaceholderText("email")).toHaveAttribute(
|
|
28
|
+
"type",
|
|
29
|
+
"email",
|
|
30
|
+
);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, vi } from "vitest";
|
|
2
|
+
import { renderHook, act } from "@testing-library/react";
|
|
3
|
+
import { useLocalStorage } from "@/hooks/useLocalStorage";
|
|
4
|
+
|
|
5
|
+
describe("useLocalStorage", () => {
|
|
6
|
+
beforeEach(() => {
|
|
7
|
+
localStorage.clear();
|
|
8
|
+
vi.restoreAllMocks();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it("returns initial value when localStorage is empty", () => {
|
|
12
|
+
const { result } = renderHook(() =>
|
|
13
|
+
useLocalStorage("test-key", "default"),
|
|
14
|
+
);
|
|
15
|
+
expect(result.current[0]).toBe("default");
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("updates value and persists to localStorage", () => {
|
|
19
|
+
const { result } = renderHook(() =>
|
|
20
|
+
useLocalStorage("test-key", "default"),
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
act(() => {
|
|
24
|
+
result.current[1]("new value");
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
expect(result.current[0]).toBe("new value");
|
|
28
|
+
expect(JSON.parse(localStorage.getItem("test-key")!)).toBe("new value");
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("handles objects", () => {
|
|
32
|
+
const initial = { name: "test", count: 0 };
|
|
33
|
+
const { result } = renderHook(() =>
|
|
34
|
+
useLocalStorage("obj-key", initial),
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
act(() => {
|
|
38
|
+
result.current[1]({ name: "updated", count: 1 });
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
expect(result.current[0]).toEqual({ name: "updated", count: 1 });
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it("supports updater function", () => {
|
|
45
|
+
const { result } = renderHook(() => useLocalStorage("counter", 0));
|
|
46
|
+
|
|
47
|
+
act(() => {
|
|
48
|
+
result.current[1]((prev) => prev + 1);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
expect(result.current[0]).toBe(1);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { getQueryClient, makeQueryClient } from "@/lib/queryClient";
|
|
3
|
+
|
|
4
|
+
describe("queryClient", () => {
|
|
5
|
+
it("creates a QueryClient with expected defaults", () => {
|
|
6
|
+
const client = makeQueryClient();
|
|
7
|
+
const defaults = client.getDefaultOptions();
|
|
8
|
+
|
|
9
|
+
expect(defaults.queries?.staleTime).toBe(60_000);
|
|
10
|
+
expect(defaults.queries?.retry).toBe(1);
|
|
11
|
+
expect(defaults.queries?.refetchOnWindowFocus).toBe(false);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it("returns the same client on multiple calls in browser", () => {
|
|
15
|
+
const client1 = getQueryClient();
|
|
16
|
+
const client2 = getQueryClient();
|
|
17
|
+
expect(client1).toBe(client2);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { cn } from "@/lib/utils";
|
|
3
|
+
|
|
4
|
+
describe("cn utility", () => {
|
|
5
|
+
it("merges class names", () => {
|
|
6
|
+
expect(cn("foo", "bar")).toBe("foo bar");
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it("handles conditional classes", () => {
|
|
10
|
+
expect(cn("base", false && "hidden", "visible")).toBe("base visible");
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it("handles undefined and null", () => {
|
|
14
|
+
expect(cn("base", undefined, null, "end")).toBe("base end");
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("merges tailwind classes correctly", () => {
|
|
18
|
+
expect(cn("px-4 py-2", "px-6")).toBe("py-2 px-6");
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("returns empty string for no inputs", () => {
|
|
22
|
+
expect(cn()).toBe("");
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
|
|
3
|
+
import { signIn, signOut } from "@/auth";
|
|
4
|
+
import { prisma } from "@/lib/prisma";
|
|
5
|
+
import bcrypt from "bcryptjs";
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import { AuthError } from "next-auth";
|
|
8
|
+
import { redirect } from "next/navigation";
|
|
9
|
+
|
|
10
|
+
const loginSchema = z.object({
|
|
11
|
+
email: z.string().email("Ingresá un email válido"),
|
|
12
|
+
password: z.string().min(1, "La contraseña es requerida"),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const registerSchema = z.object({
|
|
16
|
+
name: z.string().min(2, "El nombre debe tener al menos 2 caracteres"),
|
|
17
|
+
email: z.string().email("Ingresá un email válido"),
|
|
18
|
+
password: z.string().min(6, "La contraseña debe tener al menos 6 caracteres"),
|
|
19
|
+
confirmPassword: z.string(),
|
|
20
|
+
}).refine((data) => data.password === data.confirmPassword, {
|
|
21
|
+
message: "Las contraseñas no coinciden",
|
|
22
|
+
path: ["confirmPassword"],
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export type AuthState = {
|
|
26
|
+
error?: string;
|
|
27
|
+
success?: boolean;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export async function signInAction(
|
|
31
|
+
_prevState: AuthState,
|
|
32
|
+
formData: FormData,
|
|
33
|
+
): Promise<AuthState> {
|
|
34
|
+
const raw = Object.fromEntries(formData);
|
|
35
|
+
const parsed = loginSchema.safeParse(raw);
|
|
36
|
+
|
|
37
|
+
if (!parsed.success) {
|
|
38
|
+
return { error: parsed.error.errors[0].message };
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
await signIn("credentials", {
|
|
43
|
+
email: parsed.data.email,
|
|
44
|
+
password: parsed.data.password,
|
|
45
|
+
redirect: false,
|
|
46
|
+
});
|
|
47
|
+
} catch (error) {
|
|
48
|
+
if (error instanceof AuthError) {
|
|
49
|
+
return { error: "Email o contraseña incorrectos" };
|
|
50
|
+
}
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
redirect(formData.get("callbackUrl")?.toString() || "/dashboard");
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export async function signOutAction() {
|
|
58
|
+
await signOut({ redirectTo: "/" });
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export async function registerAction(
|
|
62
|
+
_prevState: AuthState,
|
|
63
|
+
formData: FormData,
|
|
64
|
+
): Promise<AuthState> {
|
|
65
|
+
const raw = Object.fromEntries(formData);
|
|
66
|
+
const parsed = registerSchema.safeParse(raw);
|
|
67
|
+
|
|
68
|
+
if (!parsed.success) {
|
|
69
|
+
return { error: parsed.error.errors[0].message };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const existingUser = await prisma.user.findUnique({
|
|
73
|
+
where: { email: parsed.data.email },
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
if (existingUser) {
|
|
77
|
+
return { error: "Ya existe una cuenta con este email" };
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const hashedPassword = await bcrypt.hash(parsed.data.password, 12);
|
|
81
|
+
|
|
82
|
+
await prisma.user.create({
|
|
83
|
+
data: {
|
|
84
|
+
name: parsed.data.name,
|
|
85
|
+
email: parsed.data.email,
|
|
86
|
+
password: hashedPassword,
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
redirect("/auth/iniciar-sesion?registered=true");
|
|
91
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
const contactoSchema = z.object({
|
|
6
|
+
nombre: z.string().min(2, "El nombre debe tener al menos 2 caracteres"),
|
|
7
|
+
email: z.string().email("Ingresá un email válido"),
|
|
8
|
+
tipoConsulta: z.enum(
|
|
9
|
+
["consulta", "soporte", "comercial", "otro"],
|
|
10
|
+
{ errorMap: () => ({ message: "Seleccioná un tipo de consulta" }) },
|
|
11
|
+
),
|
|
12
|
+
mensaje: z
|
|
13
|
+
.string()
|
|
14
|
+
.min(10, "El mensaje debe tener al menos 10 caracteres")
|
|
15
|
+
.max(1000, "El mensaje no puede superar los 1000 caracteres"),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export type ContactoState = {
|
|
19
|
+
error?: string;
|
|
20
|
+
fieldErrors?: Record<string, string[]>;
|
|
21
|
+
success?: boolean;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export async function enviarContacto(
|
|
25
|
+
_prevState: ContactoState,
|
|
26
|
+
formData: FormData,
|
|
27
|
+
): Promise<ContactoState> {
|
|
28
|
+
const raw = Object.fromEntries(formData);
|
|
29
|
+
const parsed = contactoSchema.safeParse(raw);
|
|
30
|
+
|
|
31
|
+
if (!parsed.success) {
|
|
32
|
+
return {
|
|
33
|
+
fieldErrors: parsed.error.flatten().fieldErrors as Record<
|
|
34
|
+
string,
|
|
35
|
+
string[]
|
|
36
|
+
>,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Simular envío de email / notificación
|
|
41
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
42
|
+
|
|
43
|
+
console.log("Contacto recibido:", parsed.data);
|
|
44
|
+
|
|
45
|
+
return { success: true };
|
|
46
|
+
}
|