Open kok32gold opened 11 months ago
any solution you got ?
any solutions?
the solution for me was to use https://github.com/SoftwareBrothers/adminjs-cli this cli tool created nestjs typeorm postgres template for me
P.S. Make shure your entities extends BaseEntity import { BaseEntity } from "typeorm";
PP.S Mark relations with Relation type
User.entity.ts
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn, Relation,BaseEntity } from 'typeorm';
import { UserEntity } from './User.entity.js';
@Entity({ name: 'service' })
export class ServiceEntity extends BaseEntity {
@PrimaryGeneratedColumn()
id: number;
@Column()
title: string;
@Column()
description: string;
@ManyToOne(() => UserEntity, (user) => user.services)
owner: Relation<UserEntity>;
}
Service.entity.ts
import { Column, Entity, OneToMany, PrimaryGeneratedColumn, Relation, BaseEntity } from 'typeorm';
import { ServiceEntity } from './Service.entity.js';
@Entity({ name: 'user' })
export class UserEntity extends BaseEntity {
@PrimaryGeneratedColumn()
id: number;
@Column()
name: string;
@Column()
email: string;
@Column()
password: string;
@OneToMany(() => ServiceEntity, (service) => service.owner)
services: Relation<ServiceEntity>[];
}
NestJS 10.2.7 HttpAdapterHost dependency error
Error:
Dependencies:
app.module.ts