All Questions
Tagged with typescript typeorm
1,718
questions
0
votes
0
answers
13
views
How can i generate the arrow function format typeorm migration file?
when ever i am generating migration file i am getting this kind of format
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "transaction&...
1
vote
0
answers
19
views
Unable to Resolve Dependencies from EntityRepository in TypeOrmModule. But EntityRepository doesn't exists
I am working on a NestJS project that uses TypeORM. Currently implementing a data feed in the 'command handler' pattern so each user has a customized output from the same endpoint.
Error Message
- [...
-2
votes
0
answers
20
views
Trouble using Post method in nest js
I used dto to recieve data with object with post in nestjs typeorm
@Post(':userId/charge-amount')
@HttpCode(HttpStatus.OK)
async chargeUser(
@Body() chargeAmountDTO : ChargeAmountDTO,
...
0
votes
1
answer
18
views
How to run a specific migration file using typeorm in node.js?
I'm currently working on a Node.js project using TypeORM with PostgreSQL. I have multiple migration files, but I want to run only one specific migration file instead of all pending migrations. Below ...
0
votes
1
answer
29
views
How to select and enter all role names (separate column) in the incoming data field as an array in typeorm query
I have a typeorm library using nestjs and a mysql database which has a table user, user_roles (many to many) and roles. I also have a user who already has the super_admin role.
const users = await ...
1
vote
1
answer
43
views
TypeOrm QueryBuilder add a new field if a relation was exist
this is my products entity:
@Entity()
export class Products {
@PrimaryGeneratedColumn()
id: number;
@Column()
name: string;
@Column()
code: string;
@Column({
...
0
votes
0
answers
28
views
Getting error as TypeError: typeorm_1.DataSource is not a constructor while exporting it from lib to other project
Getting error as TypeError: typeorm_1.DataSource is not a constructor when try to export from lib project and use in other project.
Basically am upgrading Nodejs, Typeorm and Typescript to latest ...
0
votes
0
answers
17
views
TypeORM - one-to-one relationship is null
First time using TypeORM, so i'm sorry if it's a very basic issue.
I have two entities: user and params:
@Entity()
export class User {
@PrimaryGeneratedColumn()
id: number;
@Column({ ...
0
votes
0
answers
16
views
Can not query users with at least one item of a given array in typeorm (querybuilder)
I have a user table on a Postgres db. A user can have multiple achievements where achievement are its own type T_ACHIEVEMENT_USER
Now I want to write a simple query with typeorm where I get all users ...
0
votes
0
answers
42
views
How to write insert query using CTE from another table in typeorm query builder
I'm trying to create an SQL query using typeorm's query builder but facing some issue with CTE express which will be the input query for the UPSERT statement
Below is the SQL query that I would like ...
0
votes
0
answers
13
views
Getting issue with extends class when upgraded type orm from 0.2.20 to 0.3.20
I have an entity which is extending ValidateBaseEntity.
import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";
import { DateTransformer } from "../common/transformers";
...
0
votes
0
answers
50
views
pg-mem with typeorm for in memory jest testing
i have a express app i am creating in typescript. I also am using typeorm as my orm for connecting to the database and actioning on it.
I already have jest unit tests but i also wanted to create ...
0
votes
1
answer
17
views
How to Mock TypeORM's Entity Manager Transaction for behavior assertion when Unit Testing in Jest?
Question
I am trying to write a unit test for a method that uses TypeORM's entity manager transaction. The method is defined as follows:
class MyRepository {
private readonly repository: Repository&...
0
votes
1
answer
24
views
Node.JS Typescript TypeORM ManyToMany `save` overrides previous relation instead of adding a new one
I have the following typescript TypeORM model:
@Entity()
export class Student extends EntityBase {
@Column({ length: 256 })
public firstName: string
@Column({ length: 256 })
public ...
0
votes
2
answers
32
views
Node.JS Typescript TypeORM ManyToMany relations add a relation and update the entity
I have the following typescript TypeORM model:
@Entity()
export class Teacher extends EntityBase {
@Column({ length: 256 })
public firstName: string
@Column({ length: 256 })
public ...