Currently, I am utilizing NestJs in conjunction with the automapper library from https://github.com/nartc/mapper. Although I have a strong affinity for this library, it lacks structured documentation specifically tailored for NestJs. As a result, numerous errors remain undocumented. Interestingly, the library functions flawlessly within my other entities even when I am following identical procedures.
When attempting to execute the map creation process using the following line of code:
createMap(mapper, CreateUserDto, User);
I encounter the below-mentioned error message:
TypeError: Cannot convert undefined or null to object
Please extend your support by troubleshooting this issue.
Provided below are both my DTO and entity definitions:
import { IsArray, IsEmail, IsEnum, IsNotEmpty, IsNumber, IsOptional, IsString, ValidateNested } from "class-validator";
import { Type } from "class-transformer";
import { Scope } from "src/scope/scope.enum";
import { Status } from "src/status/status.enum";
import { ReadDepartmentDto } from "src/department/dept.dto";
import { ReadProjectDto } from "src/project/project.dto";
import { AutoMap } from "@automapper/classes";
// Include relevant attributes and methods
Entity Definition:
import { Scope } from "src/scope/scope.enum";
import { Exclude, instanceToPlain } from "class-transformer";
import { Department } from "src/department/dept.entity";
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, OneToMany } from "typeorm";
import { Project } from "src/project/project.entity";
import { Status } from "src/status/status.enum";
import { AutoMap } from "@automapper/classes";
// Include relevant attributes and methods