Category "nestjs"

How to save line breaks in database

I'm using typeorm to management my databse with nestjs framework on server and vuejs on client side, in settings i must provide a large text and i must to save

Is there a way to hide all the end-point in the controller.ts using a single decorator?

Currently, I am using @ApiExcludeEndpoint() ### on top of all methods to hide the end-point in the swagger-ui, like this: import { Controller, Get, Query,

NestJS and Mongoose find by reference object Id

I have a Mongo collection of Users and a collection of Addresses. Each address is owned by one user.Here are my schema classes: export type UserDocument = User

How to fix: No changes in database schema were found - cannot generate a migration?

I searched a lot and there are several questions like this however most of them do not have any answer or are not relevant to me. I'm using TypeORM(v0.2.45) wit

@IsPhoneNumber() npm class validator how to add multiple countries code

In Nest js dto I want to validate user mobile number with multiple countries Regex. How can I do this? @IsPhoneNumber('IN', { message: (args: ValidationArg

Validation does not work with Partial<DTO> - NestJS

I want to apply server-side validation on my CRUD API. The entity in question is called Employee. I am using an employee.dto (shown below) for the create and up

How to automatically update virtual model property when updating its foreign key reference?

I have a order table that refers to status table by foreign key status_id: $ select order_id, status_id from "order"; order_id | status_id ----------+-------

Validation does not work with Partial<DTO> - NestJS

I want to apply server-side validation on my CRUD API. The entity in question is called Employee. I am using an employee.dto (shown below) for the create and up

How to automatically update virtual model property when updating its foreign key reference?

I have a order table that refers to status table by foreign key status_id: $ select order_id, status_id from "order"; order_id | status_id ----------+-------

Typeorm How Can I get Min field with Where clause?

I use Typeorm and nestjs in my project. I have Schema: export class GroupEntity implements IGroup { // Attributes @PrimaryGeneratedColumn({ type: 'string' }

Return many files with json from backend to client

I want to know may i respond to client from backend controller with many files (with application/octet-stream). It will be more better, if i respond array of fi

How to pass a dynamic port to the Websockets-gateway in NestJS?

I wanted to dynamically set the Websockets-gateway port from config in NestJS. Below is my websockets-gateway code. import { WebSocketGateway } from '@nestjs/we

How to provide a Guard for a specific Module in Nest.js?

I have a module called AdminModule which should be protected by AdminGuard. I tried to set up the Guard directly in the module like this: @Module({ imports: [

How to test NestJs response interceptor

I tried to follow this thread but it I keep getting an error. transform-response.interceptor.ts: import { Injectable, NestInterceptor, ExecutionContext, CallHan

How to fix CORS Error when using the Nest JS framework

I added cors package in the main.ts. but still it's throwing error. I don't understand why this error throwing can you pls explain how to properly handling cors

Typeorm. use only the date part while querying via date and exclude the timestamp part

I have a use case where I have to retrieve a users record from the database via his date of birth. The thing is that we have stored the date of birth of the use

GraphQLError: Query root type must be provided

I'm using NestJS, TypeORM and GraphQL for my backend API. I'm getting the following error: GraphQLError [Object]: Query root type must be provided. at Sch

how to I get a user's IP address when separate client and server apps, in Node with Nest.js

I have two apps, one front end (react.js) and one a REST API back-end(nest.js based on express.js). How do I get the IP address of the user accessing the back-e

NestJs: Unable to read env variables in module files but able in service files?

I have an .env file at the root of my NestJs project with some env variables in it. The strange thing is that I am able to read the variables in service files

NestJs: Unable to read env variables in module files but able in service files?

I have an .env file at the root of my NestJs project with some env variables in it. The strange thing is that I am able to read the variables in service files