chore: update Node version and enhance debugging capabilities
- Removed .nvmrc file to eliminate version locking. - Updated Dockerfile to use Node 22.6.0-alpine for improved performance and security. - Modified package.json to enhance the 'start:dev' script with debugging options. - Added new launch configuration in VSCode for attaching to Node processes by PID. - Cleaned up settings.json by removing unused configurations. - Refactored main.ts to simplify the bootstrap process. - Enhanced logging in OrderSchema and ScheduleSchema for better traceability of operations.
This commit is contained in:
20
.vscode/launch.json
vendored
20
.vscode/launch.json
vendored
@@ -4,14 +4,28 @@
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Attach by Process ID",
|
||||
"processId": "${command:PickProcess}",
|
||||
"request": "attach",
|
||||
"skipFiles": [
|
||||
"<node_internals>/**"
|
||||
],
|
||||
"type": "node"
|
||||
},
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Launch Program",
|
||||
"runtimeExecutable": "C:\\Users\\AliensVN\\AppData\\Roaming\\fnm\\node-versions\\v20.17.0\\installation\\node.exe",
|
||||
"skipFiles": ["<node_internals>/**"],
|
||||
"runtimeExecutable": "C:\\Users\\AliensVN\\AppData\\Roaming\\fnm\\node-versions\\v22.6.0\\installation\\node.exe",
|
||||
"skipFiles": [
|
||||
"<node_internals>/**"
|
||||
],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"program": "${file}",
|
||||
"outFiles": ["${workspaceFolder}/**/*.js"]
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/**/*.js"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@@ -1,6 +1,4 @@
|
||||
{
|
||||
"dependi.npm.lockFileEnabled": false,
|
||||
"typescript.tsdk": "node_modules\\typescript\\lib",
|
||||
"compile-hero.disable-compile-files-on-did-save-code": true,
|
||||
"docwriter.style": "JSDoc"
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM node:alpine AS node_base
|
||||
FROM node:22.6.0-alpine AS node_base
|
||||
|
||||
# Set the working directory
|
||||
WORKDIR /app
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"build": "nest build",
|
||||
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||
"start": "nest start",
|
||||
"start:dev": "nest start --watch",
|
||||
"start:dev": "nest start --watch --inspect --debug",
|
||||
"start:debug": "nest start --debug --watch",
|
||||
"start:prod": "node dist/main",
|
||||
"prisma:generate": "npx prisma generate --schema=./epess-database/prisma/schema.prisma",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Inject, Injectable } from '@nestjs/common'
|
||||
import { Inject, Injectable, Logger } from '@nestjs/common'
|
||||
import { Pothos, PothosRef, PothosSchema, SchemaBuilderToken } from '@smatch-corp/nestjs-pothos'
|
||||
import { Builder } from '../Graphql/graphql.builder'
|
||||
import { PrismaService } from '../Prisma/prisma.service'
|
||||
@@ -201,8 +201,8 @@ export class OrderSchema extends PothosSchema {
|
||||
expiredAt: DateTimeUtils.now().plus({ minutes: 15 }).toJSDate(),
|
||||
},
|
||||
})
|
||||
|
||||
const _name = _.map(_.slice(_.split(service.name, ' '), 0, 10), (word) => _.deburr(word)).join(' ')
|
||||
const _name = _.deburr(service.name).slice(0, 10)
|
||||
Logger.log(`Creating payment for ${_name}`)
|
||||
// generate payment url
|
||||
const paymentData = await this.payosService.createPayment({
|
||||
orderCode: paymentCode,
|
||||
|
||||
@@ -262,6 +262,7 @@ export class ScheduleSchema extends PothosSchema {
|
||||
if (!ctx.http?.me?.id) {
|
||||
throw new Error('User not found')
|
||||
}
|
||||
Logger.log(`ctx.http.me.role: ${ctx.http.me.role}`)
|
||||
// use case 1: customer query schedules where customer is participant
|
||||
if (ctx.http.me.role === Role.CUSTOMER) {
|
||||
const schedules = await this.prisma.schedule.findMany({
|
||||
@@ -286,6 +287,7 @@ export class ScheduleSchema extends PothosSchema {
|
||||
if (!center) {
|
||||
throw new Error('Center not found')
|
||||
}
|
||||
// get all schedules belong to center
|
||||
const schedules = await this.prisma.schedule.findMany({
|
||||
...query,
|
||||
skip: args.skip ?? undefined,
|
||||
|
||||
@@ -82,7 +82,5 @@ async function bootstrap() {
|
||||
Logger.log(`Server is running on http://${host}:${port}`, 'Bootstrap')
|
||||
})
|
||||
}
|
||||
// IIFE
|
||||
;(async () => {
|
||||
await bootstrap()
|
||||
})()
|
||||
|
||||
bootstrap()
|
||||
|
||||
Reference in New Issue
Block a user