chore: update environment configuration and enhance Prisma integration
Some checks failed
Lint and Check Types / validations (push) Failing after 47s

- Added MINIO_PORT to .env.example for Minio configuration.
- Updated package.json to include a script for Prisma generation.
- Modified turbo.json to ensure db:generate task is executed during build and dev processes.
- Updated CI workflow to run Prisma generate step.
- Adjusted imports in the API to reference the generated Prisma client correctly.
- Added .gitignore entry for Prisma client directory.
This commit is contained in:
Juan Sebastián Montoya 2025-05-06 18:36:47 -05:00
parent bb4deff66b
commit c7911953df
10 changed files with 20 additions and 8 deletions

View file

@ -11,6 +11,7 @@ MINIO_BUCKET_NAME=your-bucket-name
MINIO_ENDPOINT=your-endpoint MINIO_ENDPOINT=your-endpoint
MINIO_SECRET_KEY=your-secret-key MINIO_SECRET_KEY=your-secret-key
MINIO_USE_SSL=true MINIO_USE_SSL=true
MINIO_PORT=9000
NODE_ENV=production NODE_ENV=production
TOKEN_SECRET=your-secret-key TOKEN_SECRET=your-secret-key

View file

@ -1,7 +1,7 @@
name: CI name: Lint and Check Types
on: [push] on: [push]
jobs: jobs:
test: validations:
runs-on: docker runs-on: docker
steps: steps:
- name: Checkout - name: Checkout
@ -12,6 +12,8 @@ jobs:
node-version: 22 node-version: 22
- name: Install - name: Install
run: npm install run: npm install
- name: Prisma Generate
run: npm run prisma:generate
- name: Lint - name: Lint
run: npm run lint run: npm run lint
- name: Check Types - name: Check Types

3
apps/api/.gitignore vendored
View file

@ -56,3 +56,6 @@ profile-*
profile* profile*
*clinic* *clinic*
*flamegraph* *flamegraph*
# prisma
prisma/client

View file

@ -6,6 +6,7 @@
generator client { generator client {
provider = "prisma-client-js" provider = "prisma-client-js"
output = "./client"
} }
datasource db { datasource db {

View file

@ -3,7 +3,7 @@ import dotenv from 'dotenv';
import path from 'path'; import path from 'path';
const rootDir = path.resolve(process.cwd(), '../../'); const rootDir = path.resolve(process.cwd(), '../../');
dotenv.config({ path: `${rootDir}/.env.local` }); dotenv.config({ path: `${rootDir}/.env` });
const schema = z const schema = z
.object({ .object({

View file

@ -4,7 +4,7 @@ import fastifyCookie from '@fastify/cookie';
import fastifyCors from '@fastify/cors'; import fastifyCors from '@fastify/cors';
import mercurius from 'mercurius'; import mercurius from 'mercurius';
import mercuriusCodegen from 'mercurius-codegen'; import mercuriusCodegen from 'mercurius-codegen';
import { PrismaClient } from '@prisma/client'; import { PrismaClient } from '../prisma/client';
import config from './config'; import config from './config';
import { resolvers } from './resolvers'; import { resolvers } from './resolvers';
import schema from './schema'; import schema from './schema';

View file

@ -2,7 +2,7 @@ import jwt from 'jsonwebtoken';
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';
import crypto from 'crypto'; import crypto from 'crypto';
import { TokenConfig } from '../config'; import { TokenConfig } from '../config';
import { PrismaClient } from '@prisma/client'; import { PrismaClient } from '../../prisma/client';
import { MemcService } from './memc.service'; import { MemcService } from './memc.service';
type TransactionClient = Omit< type TransactionClient = Omit<

View file

@ -1,4 +1,4 @@
import { PrismaClient } from '@prisma/client'; import type { PrismaClient } from '../prisma/client';
import { import {
MinioService, MinioService,
TokenService, TokenService,

View file

@ -7,7 +7,8 @@
"start:api": "turbo run start --filter=api", "start:api": "turbo run start --filter=api",
"lint": "turbo run lint", "lint": "turbo run lint",
"format": "prettier --write \"**/*.{ts,tsx,md}\"", "format": "prettier --write \"**/*.{ts,tsx,md}\"",
"check-types": "turbo run check-types" "check-types": "turbo run check-types",
"prisma:generate": "turbo run prisma:generate"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^22.13.9", "@types/node": "^22.13.9",

View file

@ -23,7 +23,7 @@
], ],
"tasks": { "tasks": {
"build": { "build": {
"dependsOn": ["^build"], "dependsOn": ["^build", "^db:generate"],
"inputs": [".env*"], "inputs": [".env*"],
"outputs": ["dist/**"] "outputs": ["dist/**"]
}, },
@ -34,9 +34,13 @@
"dependsOn": ["^check-types"] "dependsOn": ["^check-types"]
}, },
"dev": { "dev": {
"dependsOn": ["^db:generate"],
"cache": false, "cache": false,
"persistent": true "persistent": true
}, },
"db:generate": {
"cache": false
},
"start": { "start": {
"cache": false, "cache": false,
"persistent": true "persistent": true