diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 872a7c1..2cc4672 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -1,48 +1,46 @@ /** @type {import("eslint").Linter.Config} */ const config = { - "parser": "@typescript-eslint/parser", - "parserOptions": { - "project": true - }, - "plugins": [ - "@typescript-eslint", + parser: "@typescript-eslint/parser", + parserOptions: { + project: true, + }, + plugins: ["@typescript-eslint"], + extends: [ + "next/core-web-vitals", + "plugin:@typescript-eslint/recommended-type-checked", + "plugin:@typescript-eslint/stylistic-type-checked", + "plugin:prettier/recommended", + ], + rules: { + "@typescript-eslint/no-unsafe-call": "off", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/array-type": "off", + "@typescript-eslint/consistent-type-definitions": "off", + "@typescript-eslint/no-unsafe-assignment": "off", + "@typescript-eslint/no-unsafe-member-access": "off", + "react/no-unescaped-entities": "off", + "@typescript-eslint/consistent-type-imports": [ + "warn", + { + prefer: "type-imports", + fixStyle: "inline-type-imports", + }, ], - "extends": [ - "next/core-web-vitals", - "plugin:@typescript-eslint/recommended-type-checked", - "plugin:@typescript-eslint/stylistic-type-checked", - "plugin:prettier/recommended" + "@typescript-eslint/no-unused-vars": [ + "warn", + { + argsIgnorePattern: "^_", + }, ], - "rules": { - "@typescript-eslint/no-unsafe-call": "off", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/array-type": "off", - "@typescript-eslint/consistent-type-definitions": "off", - "@typescript-eslint/no-unsafe-assignment": "off", - "@typescript-eslint/no-unsafe-member-access": "off", - "react/no-unescaped-entities": "off", - "@typescript-eslint/consistent-type-imports": [ - "warn", - { - "prefer": "type-imports", - "fixStyle": "inline-type-imports" - } - ], - "@typescript-eslint/no-unused-vars": [ - "warn", - { - "argsIgnorePattern": "^_" - } - ], - "@typescript-eslint/require-await": "off", - "@typescript-eslint/no-misused-promises": [ - "error", - { - "checksVoidReturn": { - "attributes": false - } - } - ] - } + "@typescript-eslint/require-await": "off", + "@typescript-eslint/no-misused-promises": [ + "error", + { + checksVoidReturn: { + attributes: false, + }, + }, + ], + }, } -module.exports = config; +module.exports = config diff --git a/package.json b/package.json index afbd6f0..2e4aecb 100644 --- a/package.json +++ b/package.json @@ -6,20 +6,26 @@ "license": "AGPL-3.0-only", "scripts": { "build": "next build", + "start": "next start", + "dev": "next dev", + "db:migrate": "prisma migrate dev --create-only", "db:push": "prisma db push", "db:studio": "prisma studio", + "db:seed": "prisma seed", "db:docker": "npm run db:push && npm run seed", - "dev": "next dev", + "dev:email": "npx dotenv-run-script dev:email-noenv", "dev:email-noenv": "email dev --dir src/emails", + "postinstall": "prisma generate", + "lint": "next lint", + "lint:fix": "next lint --fix", "lint:prisma": "prisma validate", - "lint:fix": "next lint --fix && prisma format", - "start": "next start", - "ragequit": "rm -rf .next && npm run db:push && npm run dev", - "seed": "prisma db seed" + "lint:prisma:fix": "prisma format", + + "ragequit": "rm -rf .next && npm run db:push && npm run dev" }, "prisma": { "seed": "tsx prisma/seeds/index.ts" diff --git a/postcss.config.cjs b/postcss.config.cjs index 4cdb2f4..b9be8c4 100644 --- a/postcss.config.cjs +++ b/postcss.config.cjs @@ -2,6 +2,6 @@ const config = { plugins: { tailwindcss: {}, }, -}; +} -module.exports = config; +module.exports = config diff --git a/prettier.config.js b/prettier.config.js index c0161e7..96699ac 100644 --- a/prettier.config.js +++ b/prettier.config.js @@ -1,7 +1,7 @@ /** @type {import('prettier').Config & import('prettier-plugin-tailwindcss').PluginOptions} */ const config = { - plugins: ["prettier-plugin-tailwindcss"], - semi: false -}; + plugins: ["prettier-plugin-tailwindcss"], + semi: false, +} -export default config; +export default config diff --git a/prisma/schema.prisma b/prisma/schema.prisma index a145991..aca3990 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -16,12 +16,13 @@ datasource db { // Core Elements model Configurable { - id String @id @default(cuid()) - name String @unique - type ConfigurableType - value String - createdAt DateTime @default(now()) - updatedAt DateTime @updatedAt + id String @id @default(cuid()) + name String @unique + description String? + type ConfigurableType + value String + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt @@index([name]) } diff --git a/prisma/seeds/index.ts b/prisma/seeds/index.ts index 1a84a6d..20d230c 100644 --- a/prisma/seeds/index.ts +++ b/prisma/seeds/index.ts @@ -1,25 +1,27 @@ -import {PrismaClient} from '@prisma/client' - -import {membershipTemplates} from "./models/membershipTemplates"; -import {users} from "./models/users"; +import { PrismaClient } from "@prisma/client" +import { membershipTemplatesSeeds } from "./models/membershipTemplates" +import { usersSeeds } from "./models/users" +import { configurablesSeeds } from "./models/configurables" const prisma = new PrismaClient() -function seedModel(model: any, data: object[]) { - return model.createMany({data, skipDuplicates: true}) +async function seedModel(model: any, data: object[]) { + await model.createMany({ data, skipDuplicates: true }) + return } async function main() { - await seedModel(prisma.user, users) - await seedModel(prisma.membershipTemplate, membershipTemplates) + await seedModel(prisma.user, usersSeeds) + await seedModel(prisma.membershipTemplate, membershipTemplatesSeeds) + await seedModel(prisma.configurable, configurablesSeeds) } main() - .then(async () => { - await prisma.$disconnect() - }) - .catch(async (e) => { - console.error(e) - await prisma.$disconnect() - process.exit(1) - }) \ No newline at end of file + .then(async () => { + await prisma.$disconnect() + }) + .catch(async (e) => { + console.error(e) + await prisma.$disconnect() + process.exit(1) + }) diff --git a/prisma/seeds/models/configurables.ts b/prisma/seeds/models/configurables.ts new file mode 100644 index 0000000..04f9927 --- /dev/null +++ b/prisma/seeds/models/configurables.ts @@ -0,0 +1,18 @@ +import { ConfigurableType } from "@prisma/client" + +export const configurablesSeeds = [ + { + name: "org_name", + type: ConfigurableType.STRING, + value: "ACME Cinema.", + createdAt: new Date(), + updatedAt: new Date(), + }, + { + name: "org_url", + type: ConfigurableType.STRING, + value: "https://example.com", + createdAt: new Date(), + updatedAt: new Date(), + }, +] diff --git a/prisma/seeds/models/membershipTemplates.ts b/prisma/seeds/models/membershipTemplates.ts index f0de46a..bd7d712 100644 --- a/prisma/seeds/models/membershipTemplates.ts +++ b/prisma/seeds/models/membershipTemplates.ts @@ -1,47 +1,50 @@ -import {PricePeriod, PriceUnit} from "@prisma/client"; +import { PricePeriod, PriceUnit } from "@prisma/client" -export const membershipTemplates = [ - { - title: "Cinema Club 2024 Membership", - description: "Support the magic of cinema and join our mission to create a vibrant international community of movie lovers.", - features: [ - "Join an exclusive community of film enthusiasts", - "Early access to tickets for premieres and special screenings", - ], - priceAmount: 3000, - pricePeriod: PricePeriod.Yearly, - priceUnit: PriceUnit.EUR, - stripePriceId: 'price_123456789', - createdAt: new Date(), - updatedAt: new Date(), - }, - { - title: "Cinema Club 2024 Premium", - description: "Contribute to the celebration of cinematic art and be part of our effort to build a global network of individuals passionate about film.", - features: [ - "Priority booking for new releases and exclusive content", - "Enjoy a 10€ discount on every purchase at our cinema shops", - ], - priceAmount: 6000, - pricePeriod: PricePeriod.Yearly, - priceUnit: PriceUnit.EUR, - stripePriceId: 'price_987654321', - createdAt: new Date(), - updatedAt: new Date(), - }, - { - title: "Cinema Club 2024 Elite", - description: "Support leading-edge film presentations and help us foster a worldwide community that celebrates and enhances the cinematic experience.", - features: [ - "Advanced access to workshops with filmmakers and special movie content", - "Receive a 15€ discount on all merchandise and concession orders", - "Exclusive invitations to members-only previews and gala events", - ], - priceAmount: 9000, - pricePeriod: PricePeriod.Yearly, - priceUnit: PriceUnit.EUR, - stripePriceId: 'price_483123255', - createdAt: new Date(), - updatedAt: new Date(), - } -] \ No newline at end of file +export const membershipTemplatesSeeds = [ + { + title: "Cinema Club 2024 Membership", + description: + "Support the magic of cinema and join our mission to create a vibrant international community of movie lovers.", + features: [ + "Join an exclusive community of film enthusiasts", + "Early access to tickets for premieres and special screenings", + ], + priceAmount: 3000, + pricePeriod: PricePeriod.Yearly, + priceUnit: PriceUnit.EUR, + stripePriceId: "price_123456789", + createdAt: new Date(), + updatedAt: new Date(), + }, + { + title: "Cinema Club 2024 Premium", + description: + "Contribute to the celebration of cinematic art and be part of our effort to build a global network of individuals passionate about film.", + features: [ + "Priority booking for new releases and exclusive content", + "Enjoy a 10€ discount on every purchase at our cinema shops", + ], + priceAmount: 6000, + pricePeriod: PricePeriod.Yearly, + priceUnit: PriceUnit.EUR, + stripePriceId: "price_987654321", + createdAt: new Date(), + updatedAt: new Date(), + }, + { + title: "Cinema Club 2024 Elite", + description: + "Support leading-edge film presentations and help us foster a worldwide community that celebrates and enhances the cinematic experience.", + features: [ + "Advanced access to workshops with filmmakers and special movie content", + "Receive a 15€ discount on all merchandise and concession orders", + "Exclusive invitations to members-only previews and gala events", + ], + priceAmount: 9000, + pricePeriod: PricePeriod.Yearly, + priceUnit: PriceUnit.EUR, + stripePriceId: "price_483123255", + createdAt: new Date(), + updatedAt: new Date(), + }, +] diff --git a/prisma/seeds/models/users.ts b/prisma/seeds/models/users.ts index 2db97c5..32ea53d 100644 --- a/prisma/seeds/models/users.ts +++ b/prisma/seeds/models/users.ts @@ -1,16 +1,16 @@ -import {UserRole} from "@prisma/client"; +import { UserRole } from "@prisma/client" -export const users = [ - { - name: "Alice", - role: UserRole.member, - email: "alice@example.com", - emailVerified: new Date(), - }, - { - name: "Bob", - role: UserRole.admin, - email: "bob@example.com", - emailVerified: new Date(), - } -] \ No newline at end of file +export const usersSeeds = [ + { + name: "Alice", + role: UserRole.member, + email: "alice@example.com", + emailVerified: new Date(), + }, + { + name: "Bob", + role: UserRole.admin, + email: "bob@example.com", + emailVerified: new Date(), + }, +] diff --git a/tailwind.config.ts b/tailwind.config.ts index 2e17dd9..1ce0389 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -3,11 +3,11 @@ import type { Config } from "tailwindcss" const config = { darkMode: ["class"], content: [ - './pages/**/*.{ts,tsx}', - './components/**/*.{ts,tsx}', - './app/**/*.{ts,tsx}', - './src/**/*.{ts,tsx}', - ], + "./pages/**/*.{ts,tsx}", + "./components/**/*.{ts,tsx}", + "./app/**/*.{ts,tsx}", + "./src/**/*.{ts,tsx}", + ], prefix: "", theme: { container: { @@ -74,9 +74,7 @@ const config = { }, }, }, - plugins: [ - require("tailwindcss-animate") - ], + plugins: [require("tailwindcss-animate")], } satisfies Config -export default config \ No newline at end of file +export default config diff --git a/tsconfig.json b/tsconfig.json index c5eef6e..298a7bd 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,25 +8,32 @@ "resolveJsonModule": true, "moduleDetection": "force", "isolatedModules": true, - /* Strictness */ "strict": true, "noUncheckedIndexedAccess": true, "checkJs": true, - /* Bundled projects */ - "lib": ["dom", "dom.iterable", "ES2022"], + "lib": [ + "dom", + "dom.iterable", + "ES2022" + ], "noEmit": true, "module": "ESNext", "moduleResolution": "Bundler", "jsx": "preserve", - "plugins": [{ "name": "next" }], + "plugins": [ + { + "name": "next" + } + ], "incremental": true, - /* Path Aliases */ "baseUrl": ".", "paths": { - "@/*": ["./src/*"] + "@/*": [ + "./src/*" + ] } }, "include": [ @@ -38,5 +45,7 @@ "**/*.js", ".next/types/**/*.ts" ], - "exclude": ["node_modules"] + "exclude": [ + "node_modules" + ] }