From 2033d0ec26b356ee036c043404fa984c7bfe9759 Mon Sep 17 00:00:00 2001 From: Ly Tuan Kiet Date: Thu, 5 Dec 2024 18:37:34 +0700 Subject: [PATCH] feat: enhance Docker configuration and update environment variables - Updated .dockerignore to include additional files and directories for better Docker build context management. - Modified compose.yaml to add BASE_URL and change BUCKET_NAME to improve environment configuration. - Refactored Dockerfile to implement a multi-stage build for optimized image size and performance. - Updated package.json to include a new script for production Prisma generation. - Adjusted tsconfig files to refine project structure and exclude unnecessary directories. - Removed delta.mdx.txt file from OpenAI instructions to streamline the service. - Updated package-lock.json and package.json to upgrade Prisma and related dependencies for improved functionality. --- .dockerignore | 9 +- Dockerfile | 50 +++- compose.yaml | 7 +- epess-database | 2 +- nest-cli.json | 4 + package-lock.json | 258 +++++++++++++++--- package.json | 8 +- src/Minio/minio.service.ts | 2 +- .../Instructions/{delta.mdx.txt => delta.mdx} | 0 src/OpenAI/openai.service.ts | 2 +- tsconfig.build.json | 15 +- tsconfig.json | 1 + 12 files changed, 294 insertions(+), 64 deletions(-) rename src/OpenAI/Instructions/{delta.mdx.txt => delta.mdx} (100%) diff --git a/.dockerignore b/.dockerignore index 42923cd..9c64d0c 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,9 @@ node_modules -epess-database/node_modules \ No newline at end of file +epess-database/node_modules +npm-debug.log +Dockerfile +.dockerignore +.git +.gitignore +README.md +epess-database/prisma/**/*.js diff --git a/Dockerfile b/Dockerfile index 78169ac..4c712e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,23 +1,49 @@ -FROM node:22.6.0-alpine AS node_base - -# Set the working directory +# Use multi-stage build for optimization +FROM node:22.6.0-alpine AS dependencies WORKDIR /app -# Enable legacy peer deps -RUN npm config set legacy-peer-deps true +# Copy only package files first to leverage Docker cache +COPY package*.json ./ +COPY epess-database/prisma ./prisma -COPY . . +# Enable legacy peer deps and install dependencies in one layer +RUN npm config set legacy-peer-deps true && \ + npm ci --only=production && \ + npm install --save-dev typescript @types/node @swc/core @swc/cli && \ + npx prisma generate -# Install the dependencies -RUN npm install +# Second stage for build +FROM node:22.6.0-alpine AS builder +WORKDIR /app +# Set legacy peer deps and copy only necessary files +COPY --from=dependencies /app/node_modules ./node_modules +COPY --from=dependencies /app/prisma ./prisma +COPY package*.json tsconfig*.json ./ +COPY nest-cli.json ./ +COPY src ./src -# Generate the Prisma client -RUN npm run prisma:generate +# Generate Prisma client and build +RUN npm config set legacy-peer-deps true && \ + npm run build + +# Final stage +FROM node:22.6.0-alpine AS runner +WORKDIR /app + +# Copy only necessary files with minimal layers +COPY --from=dependencies /app/node_modules ./node_modules +COPY --from=builder /app/dist ./dist +COPY --from=builder /app/prisma ./prisma +COPY --from=builder /app/package*.json ./ # Expose the port EXPOSE 3000 -# Start the application +# Use non-root user for security +USER node -CMD ["npm", "run", "start:dev"] \ No newline at end of file +# Pause to allow manual inspection (for debugging) +# CMD ["sh", "-c", "echo 'Paused. Press Ctrl+C to continue...'; sleep infinity"] + +CMD ["npm", "run", "start:prod"] \ No newline at end of file diff --git a/compose.yaml b/compose.yaml index 109e359..fc753c0 100644 --- a/compose.yaml +++ b/compose.yaml @@ -7,11 +7,10 @@ services: pull_policy: always ports: - '8888:3069' - volumes: - - ./src:/app/src environment: - NODE_ENV=development - DISABLE_AUTH=false + - BASE_URL=epess.org # - CENTER_BASE_URL=http://localhost:3000 - CENTER_BASE_URL=https://center.epess.org - DATABASE_URL=postgresql://your_username:your_password@10.0.27.1:5432/epess @@ -23,10 +22,10 @@ services: - SWAGGER_PATH=/swagger - API_PATH=/v1 - MINIO_ENDPOINT=objects.epess.org - - MINIO_BUCKET_NAME=epess + - BUCKET_NAME=epess - MINIO_ACCESS_KEY=71dNgJtzkelXtG3R6IVt - MINIO_SECRET_KEY=53LmFiDCZxvflJIOsVF9cf0aqkIjNU2oOWtLzGsf - - RECORDING_BUCKET_NAME=epess-recordings + - MINIO_REGION=default - PAYOS_CLIENT_ID=e31f27d7-611a-468d-8d46-db21574a8fae - PAYOS_API_KEY=a31d1fa1-a1b9-4e91-9948-6e46e94ce27e - PAYOS_CHECKSUM_KEY=0b82fe148ab98083d471997df5cdd08f3c383013f8bc85e87d7ab1ab4433614e diff --git a/epess-database b/epess-database index 52b1b86..cf5e1bc 160000 --- a/epess-database +++ b/epess-database @@ -1 +1 @@ -Subproject commit 52b1b86761e93a288ad0b275277288a4694dcf63 +Subproject commit cf5e1bcf315ac012464882aa5e15ce3b55270158 diff --git a/nest-cli.json b/nest-cli.json index d9a6011..89c13ee 100644 --- a/nest-cli.json +++ b/nest-cli.json @@ -22,6 +22,10 @@ { "include": "**/*.pem", "outDir": "./dist/src/" + }, + { + "include": "**/*.mdx", + "outDir": "./dist/src/OpenAI/Instructions" } ] } diff --git a/package-lock.json b/package-lock.json index 4d9e438..c552a17 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,7 +41,7 @@ "@pothos/plugin-simple-objects": "^4.1.0", "@pothos/plugin-smart-subscriptions": "^4.1.0", "@pothos/plugin-zod": "^4.1.0", - "@prisma/client": "^5.21.1", + "@prisma/client": "^6.0.1", "@smatch-corp/nestjs-pothos": "^0.3.0", "@smatch-corp/nestjs-pothos-apollo-driver": "^0.1.0", "apollo-server-express": "^3.13.0", @@ -102,7 +102,7 @@ "globals": "^15.10.0", "jest": "^29.5.0", "prettier": "^3.0.0", - "prisma": "^5.21.1", + "prisma": "^6.0.1", "source-map-support": "^0.5.21", "supertest": "^7.0.0", "ts-jest": "^29.1.0", @@ -111,6 +111,9 @@ "tsconfig-paths": "^4.2.0", "typescript": "^5.6.3", "ws": "^8.18.0" + }, + "optionalDependencies": { + "@css-inline/css-inline-linux-x64-musl": "^0.14.3" } }, "node_modules/@ampproject/remapping": { @@ -1861,6 +1864,134 @@ "@css-inline/css-inline-win32-x64-msvc": "0.14.1" } }, + "node_modules/@css-inline/css-inline-android-arm-eabi": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/@css-inline/css-inline-android-arm-eabi/-/css-inline-android-arm-eabi-0.14.1.tgz", + "integrity": "sha512-LNUR8TY4ldfYi0mi/d4UNuHJ+3o8yLQH9r2Nt6i4qeg1i7xswfL3n/LDLRXvGjBYqeEYNlhlBQzbPwMX1qrU6A==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@css-inline/css-inline-android-arm64": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/@css-inline/css-inline-android-arm64/-/css-inline-android-arm64-0.14.1.tgz", + "integrity": "sha512-tH5us0NYGoTNBHOUHVV7j9KfJ4DtFOeTLA3cM0XNoMtArNu2pmaaBMFJPqECzavfXkLc7x5Z22UPZYjoyHfvCA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@css-inline/css-inline-darwin-arm64": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/@css-inline/css-inline-darwin-arm64/-/css-inline-darwin-arm64-0.14.1.tgz", + "integrity": "sha512-QE5W1YRIfRayFrtrcK/wqEaxNaqLULPI0gZB4ArbFRd3d56IycvgBasDTHPre5qL2cXCO3VyPx+80XyHOaVkag==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@css-inline/css-inline-darwin-x64": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/@css-inline/css-inline-darwin-x64/-/css-inline-darwin-x64-0.14.1.tgz", + "integrity": "sha512-mAvv2sN8awNFsbvBzlFkZPbCNZ6GCWY5/YcIz7V5dPYw+bHHRbjnlkNTEZq5BsDxErVrMIGvz05PGgzuNvZvdQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@css-inline/css-inline-linux-arm-gnueabihf": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/@css-inline/css-inline-linux-arm-gnueabihf/-/css-inline-linux-arm-gnueabihf-0.14.1.tgz", + "integrity": "sha512-AWC44xL0X7BgKvrWEqfSqkT2tJA5kwSGrAGT+m0gt11wnTYySvQ6YpX0fTY9i3ppYGu4bEdXFjyK2uY1DTQMHA==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@css-inline/css-inline-linux-arm64-gnu": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/@css-inline/css-inline-linux-arm64-gnu/-/css-inline-linux-arm64-gnu-0.14.1.tgz", + "integrity": "sha512-drj0ciiJgdP3xKXvNAt4W+FH4KKMs8vB5iKLJ3HcH07sNZj58Sx++2GxFRS1el3p+GFp9OoYA6dgouJsGEqt0Q==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@css-inline/css-inline-linux-x64-gnu": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/@css-inline/css-inline-linux-x64-gnu/-/css-inline-linux-x64-gnu-0.14.1.tgz", + "integrity": "sha512-yubbEye+daDY/4vXnyASAxH88s256pPati1DfVoZpU1V0+KP0BZ1dByZOU1ktExurbPH3gZOWisAnBE9xon0Uw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@css-inline/css-inline-linux-x64-musl": { + "version": "0.14.3", + "resolved": "https://registry.npmjs.org/@css-inline/css-inline-linux-x64-musl/-/css-inline-linux-x64-musl-0.14.3.tgz", + "integrity": "sha512-xUP5lAPEj5FdJurG2whVC0+cnLiEpPdacj6yqrbpIbScrimMRopEfb84AvfYQnplKXXtqUB1apEjwLREbyfRGA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, "node_modules/@css-inline/css-inline-win32-x64-msvc": { "version": "0.14.1", "resolved": "https://registry.npmjs.org/@css-inline/css-inline-win32-x64-msvc/-/css-inline-win32-x64-msvc-0.14.1.tgz", @@ -1877,6 +2008,38 @@ "node": ">= 10" } }, + "node_modules/@css-inline/css-inline/node_modules/@css-inline/css-inline-linux-arm64-musl": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/@css-inline/css-inline-linux-arm64-musl/-/css-inline-linux-arm64-musl-0.14.1.tgz", + "integrity": "sha512-FzknI+st8eA8YQSdEJU9ykcM0LZjjigBuynVF5/p7hiMm9OMP8aNhWbhZ8LKJpKbZrQsxSGS4g9Vnr6n6FiSdQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@css-inline/css-inline/node_modules/@css-inline/css-inline-linux-x64-musl": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/@css-inline/css-inline-linux-x64-musl/-/css-inline-linux-x64-musl-0.14.1.tgz", + "integrity": "sha512-6CRAZzoy1dMLPC/tns2rTt1ZwPo0nL/jYBEIAsYTCWhfAnNnpoLKVh5Nm+fSU3OOwTTqU87UkGrFJhObD/wobQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, "node_modules/@faker-js/faker": { "version": "9.2.0", "resolved": "https://registry.npmjs.org/@faker-js/faker/-/faker-9.2.0.tgz", @@ -4790,13 +4953,13 @@ } }, "node_modules/@prisma/client": { - "version": "5.22.0", - "resolved": "https://registry.npmjs.org/@prisma/client/-/client-5.22.0.tgz", - "integrity": "sha512-M0SVXfyHnQREBKxCgyo7sffrKttwE6R8PMq330MIUF0pTwjUhLbW84pFDlf06B27XyCR++VtjugEnIHdr07SVA==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@prisma/client/-/client-6.0.1.tgz", + "integrity": "sha512-60w7kL6bUxz7M6Gs/V+OWMhwy94FshpngVmOY05TmGD0Lhk+Ac0ZgtjlL6Wll9TD4G03t4Sq1wZekNVy+Xdlbg==", "hasInstallScript": true, "license": "Apache-2.0", "engines": { - "node": ">=16.13" + "node": ">=18.18" }, "peerDependencies": { "prisma": "*" @@ -4814,49 +4977,49 @@ "license": "Apache-2.0" }, "node_modules/@prisma/engines": { - "version": "5.22.0", - "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-5.22.0.tgz", - "integrity": "sha512-UNjfslWhAt06kVL3CjkuYpHAWSO6L4kDCVPegV6itt7nD1kSJavd3vhgAEhjglLJJKEdJ7oIqDJ+yHk6qO8gPA==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-6.0.1.tgz", + "integrity": "sha512-4hxzI+YQIR2uuDyVsDooFZGu5AtixbvM2psp+iayDZ4hRrAHo/YwgA17N23UWq7G6gRu18NvuNMb48qjP3DPQw==", "dev": true, "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "@prisma/debug": "5.22.0", - "@prisma/engines-version": "5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2", - "@prisma/fetch-engine": "5.22.0", - "@prisma/get-platform": "5.22.0" + "@prisma/debug": "6.0.1", + "@prisma/engines-version": "5.23.0-27.5dbef10bdbfb579e07d35cc85fb1518d357cb99e", + "@prisma/fetch-engine": "6.0.1", + "@prisma/get-platform": "6.0.1" } }, "node_modules/@prisma/engines-version": { - "version": "5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2", - "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2.tgz", - "integrity": "sha512-2PTmxFR2yHW/eB3uqWtcgRcgAbG1rwG9ZriSvQw+nnb7c4uCr3RAcGMb6/zfE88SKlC1Nj2ziUvc96Z379mHgQ==", + "version": "5.23.0-27.5dbef10bdbfb579e07d35cc85fb1518d357cb99e", + "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.23.0-27.5dbef10bdbfb579e07d35cc85fb1518d357cb99e.tgz", + "integrity": "sha512-JmIds0Q2/vsOmnuTJYxY4LE+sajqjYKhLtdOT6y4imojqv5d/aeVEfbBGC74t8Be1uSp0OP8lxIj2OqoKbLsfQ==", "dev": true, "license": "Apache-2.0" }, "node_modules/@prisma/engines/node_modules/@prisma/debug": { - "version": "5.22.0", - "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-5.22.0.tgz", - "integrity": "sha512-AUt44v3YJeggO2ZU5BkXI7M4hu9BF2zzH2iF2V5pyXT/lRTyWiElZ7It+bRH1EshoMRxHgpYg4VB6rCM+mG5jQ==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-6.0.1.tgz", + "integrity": "sha512-jQylgSOf7ibTVxqBacnAlVGvek6fQxJIYCQOeX2KexsfypNzXjJQSS2o5s+Mjj2Np93iSOQUaw6TvPj8syhG4w==", "dev": true, "license": "Apache-2.0" }, "node_modules/@prisma/fetch-engine": { - "version": "5.22.0", - "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-5.22.0.tgz", - "integrity": "sha512-bkrD/Mc2fSvkQBV5EpoFcZ87AvOgDxbG99488a5cexp5Ccny+UM6MAe/UFkUC0wLYD9+9befNOqGiIJhhq+HbA==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-6.0.1.tgz", + "integrity": "sha512-T36bWFVGeGYYSyYOj9d+O9G3sBC+pAyMC+jc45iSL63/Haq1GrYjQPgPMxrEj9m739taXrupoysRedQ+VyvM/Q==", "dev": true, "license": "Apache-2.0", "dependencies": { - "@prisma/debug": "5.22.0", - "@prisma/engines-version": "5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2", - "@prisma/get-platform": "5.22.0" + "@prisma/debug": "6.0.1", + "@prisma/engines-version": "5.23.0-27.5dbef10bdbfb579e07d35cc85fb1518d357cb99e", + "@prisma/get-platform": "6.0.1" } }, "node_modules/@prisma/fetch-engine/node_modules/@prisma/debug": { - "version": "5.22.0", - "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-5.22.0.tgz", - "integrity": "sha512-AUt44v3YJeggO2ZU5BkXI7M4hu9BF2zzH2iF2V5pyXT/lRTyWiElZ7It+bRH1EshoMRxHgpYg4VB6rCM+mG5jQ==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-6.0.1.tgz", + "integrity": "sha512-jQylgSOf7ibTVxqBacnAlVGvek6fQxJIYCQOeX2KexsfypNzXjJQSS2o5s+Mjj2Np93iSOQUaw6TvPj8syhG4w==", "dev": true, "license": "Apache-2.0" }, @@ -4870,19 +5033,19 @@ } }, "node_modules/@prisma/get-platform": { - "version": "5.22.0", - "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-5.22.0.tgz", - "integrity": "sha512-pHhpQdr1UPFpt+zFfnPazhulaZYCUqeIcPpJViYoq9R+D/yw4fjE+CtnsnKzPYm0ddUbeXUzjGVGIRVgPDCk4Q==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-6.0.1.tgz", + "integrity": "sha512-zspC9vlxAqx4E6epMPMLLBMED2VD8axDe8sPnquZ8GOsn6tiacWK0oxrGK4UAHYzYUVuMVUApJbdXB2dFpLhvg==", "dev": true, "license": "Apache-2.0", "dependencies": { - "@prisma/debug": "5.22.0" + "@prisma/debug": "6.0.1" } }, "node_modules/@prisma/get-platform/node_modules/@prisma/debug": { - "version": "5.22.0", - "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-5.22.0.tgz", - "integrity": "sha512-AUt44v3YJeggO2ZU5BkXI7M4hu9BF2zzH2iF2V5pyXT/lRTyWiElZ7It+bRH1EshoMRxHgpYg4VB6rCM+mG5jQ==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-6.0.1.tgz", + "integrity": "sha512-jQylgSOf7ibTVxqBacnAlVGvek6fQxJIYCQOeX2KexsfypNzXjJQSS2o5s+Mjj2Np93iSOQUaw6TvPj8syhG4w==", "dev": true, "license": "Apache-2.0" }, @@ -10002,6 +10165,21 @@ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "license": "ISC" }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", @@ -14824,20 +15002,20 @@ } }, "node_modules/prisma": { - "version": "5.22.0", - "resolved": "https://registry.npmjs.org/prisma/-/prisma-5.22.0.tgz", - "integrity": "sha512-vtpjW3XuYCSnMsNVBjLMNkTj6OZbudcPPTPYHqX0CJfpcdWciI1dM8uHETwmDxxiqEwCIE6WvXucWUetJgfu/A==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-6.0.1.tgz", + "integrity": "sha512-CaMNFHkf+DDq8zq3X/JJsQ4Koy7dyWwwtOKibkT/Am9j/tDxcfbg7+lB1Dzhx18G/+RQCMgjPYB61bhRqteNBQ==", "dev": true, "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "@prisma/engines": "5.22.0" + "@prisma/engines": "6.0.1" }, "bin": { "prisma": "build/index.js" }, "engines": { - "node": ">=16.13" + "node": ">=18.18" }, "optionalDependencies": { "fsevents": "2.3.3" diff --git a/package.json b/package.json index e1d0b6f..0d681ee 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "start:debug": "nest start --debug --watch", "start:prod": "node dist/main", "prisma:generate": "npx prisma generate --schema=./epess-database/prisma/schema.prisma", + "prisma:generate:prod": "npx prisma generate", "prisma:migrate": "npx prisma migrate dev --schema=./epess-database/prisma/schema.prisma", "prisma:push": "npx prisma db push --schema=./epess-database/prisma/schema.prisma", "prisma:reset": "npx prisma migrate reset --schema=./epess-database/prisma/schema.prisma", @@ -61,7 +62,7 @@ "@pothos/plugin-simple-objects": "^4.1.0", "@pothos/plugin-smart-subscriptions": "^4.1.0", "@pothos/plugin-zod": "^4.1.0", - "@prisma/client": "^5.21.1", + "@prisma/client": "^6.0.1", "@smatch-corp/nestjs-pothos": "^0.3.0", "@smatch-corp/nestjs-pothos-apollo-driver": "^0.1.0", "apollo-server-express": "^3.13.0", @@ -122,7 +123,7 @@ "globals": "^15.10.0", "jest": "^29.5.0", "prettier": "^3.0.0", - "prisma": "^5.21.1", + "prisma": "^6.0.1", "source-map-support": "^0.5.21", "supertest": "^7.0.0", "ts-jest": "^29.1.0", @@ -132,6 +133,9 @@ "typescript": "^5.6.3", "ws": "^8.18.0" }, + "optionalDependencies": { + "@css-inline/css-inline-linux-x64-musl": "^0.14.3" + }, "jest": { "moduleFileExtensions": ["js", "json", "ts"], "rootDir": "src", diff --git a/src/Minio/minio.service.ts b/src/Minio/minio.service.ts index 77af64f..97caba5 100644 --- a/src/Minio/minio.service.ts +++ b/src/Minio/minio.service.ts @@ -125,7 +125,7 @@ export class MinioService { } listRecords(roomId: string) { - return this.minioClient.listObjects(this.configService.get('BUCKET_NAME') ?? 'epess', `records/${roomId}`) + return this.minioClient.listObjects(this.configService.get('BUCKET_NAME') ?? 'epess', `epess/records/${roomId}`) } // export document to docx format by get all pages and convert to docx async exportDocument(id: string) { diff --git a/src/OpenAI/Instructions/delta.mdx.txt b/src/OpenAI/Instructions/delta.mdx similarity index 100% rename from src/OpenAI/Instructions/delta.mdx.txt rename to src/OpenAI/Instructions/delta.mdx diff --git a/src/OpenAI/openai.service.ts b/src/OpenAI/openai.service.ts index 45ccc10..9c6d8eb 100644 --- a/src/OpenAI/openai.service.ts +++ b/src/OpenAI/openai.service.ts @@ -5,7 +5,7 @@ import { z } from 'zod' import { zodResponseFormat } from 'openai/helpers/zod' import { readFileSync } from 'fs' -const DELTA_INSTRUCTIONS = readFileSync('./src/OpenAI/Instructions/delta.mdx.txt', 'utf8') +const DELTA_INSTRUCTIONS = '' @Injectable() export class OpenaiService { diff --git a/tsconfig.build.json b/tsconfig.build.json index 64f86c6..f3fb1fe 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -1,4 +1,15 @@ { "extends": "./tsconfig.json", - "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] -} + "exclude": [ + "node_modules", + "test", + "dist", + "**/*spec.ts", + "epess-database", + "codegen.ts", + ], + "compilerOptions": { + "rootDir": "./src", + "allowJs": true + } +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 51de306..956221d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,6 +10,7 @@ "sourceMap": true, "outDir": "./dist", "baseUrl": "./", + "rootDir": "./src", "incremental": true, "skipLibCheck": true, "strictNullChecks": true,