Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
22 views

Querying associated record fails "Cannot read properties of undefined (reading 'joinColumns')", not loading inverse relation in TypeORM in NestJS app

Well I see a very similar problem here, sadly there was no definitive answer: TypeORM & NestJS: TypeError: Cannot read properties of undefined (reading 'joinColumns') Summary I have an ...
Allister Moon's user avatar
0 votes
1 answer
14 views

beforeSoftRemove hook not updating database entry using Nest.js and TypeORM

I want to implement a solution in Nest.js and TypeORM application that every record that is getting created should have createdById, updatedById and deletedById against their actions. Let me share the ...
Muhammad Zeeshan's user avatar
0 votes
0 answers
14 views

TypeORM can not order by on addSelect field

I have this code block: async getReceiptsForTimeline( userId: string, getTimelineInput: GetTimelineInput, ): Promise<ReceiptCursorBasedPaginatedResult> { const { cursor, take = 10, ...
minikdev's user avatar
  • 101
-1 votes
1 answer
37 views

How to add random data to postgresql table with relations

I'm using postgresql, nestsj, typeorm i pgAdmin4. I have an entity with some columns and relations. I want to add random rows to this table, ideally with some relations, also randomly populated. Is it ...
Korer's user avatar
  • 115
0 votes
1 answer
58 views

Proccess dates in nest.js and typeOrm

I got this table: Id date_time_capture idHive 1001 2024-06-19 20:17:45 2 1002 2024-06-19 20:18:45 2 date_time_capture is a datetime field in my database using MySql then in postman: This is my ...
Andres Lopez's user avatar
0 votes
0 answers
14 views

How to Sum and Map Counts of Two Related Entities in TypeORM QueryBuilder?

I'm working on a TypeScript project using NestJS and TypeORM. I'm trying to build a query that retrieves a list of "tasks" with the following requirements: Count the number of "...
venkatraman hiregange's user avatar
0 votes
1 answer
20 views

UnknownElementException [Error]: Nest could not find DataSource element (this provider does not exis

I am writing an e2e test, the application has type or postgres 2 databases in the configuration, the test is successful, all actions with the database are performed, but when the application is closed,...
Даниил Дроздов's user avatar
0 votes
1 answer
33 views

How to Sort Users by Their Last Sent Message Timestamp in NestJS with TypeORM and PostgreSQL?

I'm working on a NestJS application with TypeORM and PostgreSQL, and I need to fetch a list of users sorted by the timestamp of the last message they sent. I have two entities, User and Message, ...
StormTrooper's user avatar
  • 1,811
0 votes
0 answers
15 views

No way to add a 'before hook' custom filter depending on an array in AdminJS

What's the problem? I want to add a before hook on the list action that can pre filter my list of records depending on an array. In the following example I want to pre filter the list of users ...
charles_r's user avatar
0 votes
0 answers
21 views

How to fix an error when creating a migration

Error: Debug Failure. False expression: Non-string value passed to ts.resolveTypeReferenceDirective, likely by a wrapping package working with an outdated resolveTypeReferenceDirectives signature. ...
daniel_kuv's user avatar
0 votes
1 answer
27 views

TypeORM not saving entity on database - Sutck on Save/Insert - SQL Lite Expo - React Native

I'm new on React Native world, and I'm trying to store data on SQL Lite. I have an expo React Native project, with SQL Lite and TypeORM configured (I followed the documentation). The problem is that ...
Vitor's user avatar
  • 307
0 votes
1 answer
23 views

Typeorm How to save data with @OneToOne relation?

I have two entity ProductKey Entity import { Column, Entity, OneToOne, PrimaryColumn } from 'typeorm'; import { Products } from './entity.products'; @Entity() export class ProductKey { @...
tonykrjhc's user avatar
  • 141
0 votes
0 answers
52 views

Duplicate Session Entry and Missing Session Support

I'm building a Discord bot dashboard API using NestJS, Passport, and TypeORM for session management. When a user attempts to log in through Discord, I encounter two errors: [Nest] 19524 - 09.08.2024 ...
Meenic's user avatar
  • 3
0 votes
0 answers
12 views

NestJS: Cant catch an Error inside a pipe

Im trying to code a "Template"-Service for my TypeORM tables, but i cant manage the errors like i want. I tried something like this: My TableService: import { DeleteResult, FindOptionsWhere, ...
Lambdanos's user avatar
1 vote
0 answers
40 views

Why do I get "Can't add new command when connection is in closed state" error when using TypeORM with MySQL and createQueryBuilder?

I'm working on a Node.js project using TypeORM with MySQL. I've encountered an issue where I get the following error when trying to execute a query using createQueryBuilder: Error: Can't add new ...
Ilya's user avatar
  • 55
-3 votes
0 answers
16 views

Can TypeORM generate migration files in .sql format instead of .ts or .js?

I've been using Prisma, which generates migration files in .sql format, making it easy to view and edit raw SQL queries. However, I've noticed that in most TypeORM tutorials, migration files are ...
octave Nkurunziza's user avatar
-2 votes
2 answers
36 views

Nest.js relations change from one-to-many to one-to-one

For now I have project with two entities: Account and Profile, with relation one-to-many - one account can have multiple profiles. For now I have several instances of accounts and profiles, some of ...
Ivan Markhaichuk's user avatar
0 votes
0 answers
31 views

TypeORM Entity metadata for Some#other was not found. Check if you specified a correct entity object and if it's connected in the connection options

Im having an issue and i have read almost all other active issues on this topic. Im trying to make a custom ManyToMany mapping table as per the TypeORM docs using a seperate entity: Mapping entity: ...
user26603322's user avatar
0 votes
1 answer
25 views

Fetch details from 2 tables using typeorm

I have 2 table MainBranch and Subbranch get the details from both the tables based on branch code and branchname import { Entity, PrimaryGeneratedColumn, Column } from "typeorm" @Entity() ...
user1187's user avatar
  • 2,148
0 votes
0 answers
21 views

Generate migration schema for initial database

I created an entity, and now I wish to generate the migration that will create the table for this entity. How do I do this? I only see documentation mentioning running migrations for changes; but what ...
FooBar's user avatar
  • 6,000
0 votes
2 answers
53 views

Nested async call how to handle in NEST js using typeORM

I have a service like below and I want to do lots of different validations before creating a task. How can I handle the nested async calls? I tried the code below and getDataForFirstValidation ...
user1187's user avatar
  • 2,148
0 votes
0 answers
22 views

How can I handle the gap between adding new columns in table and deploying the code?

I am using typeorm as orm library in typescript to integrate with PostgreSQL database. I have a table in the db and created a class in typeorm to map to that table like: @Entity('contacts') export ...
Joey Yi Zhao's user avatar
  • 41.5k
0 votes
1 answer
44 views

Typeorm find - select fields of nested relations

I have an entity with nested relations, and I want to select a certain field from the nested relation. This is my query: const data = await this.entityRepository.find({ select: { id: true, ...
Yahli Gitzi's user avatar
0 votes
0 answers
23 views

Error during generation of migrations typescript 5

While running a database migration I do get the following errors: apps/mtb-api/src/dbconfig_entity/User.ts:11:4 - error TS1240: Unable to resolve signature of property decorator when called as an ...
nthoelen's user avatar
1 vote
1 answer
68 views

How to handle table names with dots (".") in SQL Server using TypeORM in a NestJS application?

I'm working on a NestJS project where I need to interact with a SQL Server database. One of the tables in the database has a name with dots, specifically dbo.Bonos.Bonos. I'm using TypeORM to manage ...
Pablo Álvarez Relat's user avatar
0 votes
0 answers
12 views

Custom NestJS repositories only expose extended class functions

I recently came across a unique situation. I am using NestJS, TypeOrm and Postgres. I have a DynamicModule called CoreModule that is registered in the AppModule as following: @Module({ imports: [ ...
Tajammul's user avatar
-1 votes
1 answer
63 views

How to get the last row added to a certain table

I use TypeORM with Nest.js in my backend and I need a method to get the last row added to a table in order to get its id (not auto incrementing). My goal is to use it for API call and I need the id + ...
Hakapichona's user avatar
0 votes
0 answers
20 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&...
Sriram Alavalapati's user avatar
1 vote
0 answers
30 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 - [...
cryxnet's user avatar
  • 155
0 votes
0 answers
30 views

Using TypeORM in Nuxt 3

I am trying tu use TypeORM in a Nuxt 3 application. [email protected] [email protected] I added TypeORM as a plugin: // plugins/typeorm.ts import 'reflect-metadata'; import { defineNuxtPlugin } from '#app'; ...
nicodel's user avatar
  • 11
0 votes
0 answers
21 views

Typeorm PostgreSQL schema acts like not existing even it exists

I have a database in postgres with different schemas. I want to use schema named g which contains my tables, see: This is what app module looks like: ... TypeOrmModule.forRootAsync({ imports : [...
Martin Fric's user avatar
0 votes
0 answers
16 views

Typeorm Subscibrers UpdateEvent

async afterUpdate(event: UpdateEvent<Experience>) { const old_pub = event.databaseEntity; const new_pub = event.entity as Experience; const statusJustChanged = old_pub.status != ...
Toby Yhs's user avatar
  • 383
0 votes
0 answers
22 views

ER_NOT_SUPPORTED_AUTH_MODE Error even though mysql2 is being used [duplicate]

I am receiving an error ERROR [ExceptionHandler] ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client every time I try to ...
CairoMisr's user avatar
0 votes
1 answer
32 views

Why don't I automatically write time information to @CreateDateColumn?

this's my datebase column info; `create_time` datetime DEFAULT NULL COMMENT 'Create Time', `update_time` datetime DEFAULT NULL COMMENT 'Update Time', and this's my entity @CreateDateColumn({ type: ...
Zuxing Xu's user avatar
0 votes
0 answers
16 views

NestJS: Why does custom DB-logger (implementing TypeOrmLogger) only show DB-requests in log, not DB-responses

In my NestJS service, I've implemented a custom DB logger, which is meant to log both the before (requests), as well as the after (DB responses) info. I've done this by implementing the suggested ...
Schalk Sevenster's user avatar
0 votes
1 answer
37 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 ...
Jaskaran's user avatar
0 votes
1 answer
34 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 ...
Dmitriy Novikov's user avatar
0 votes
0 answers
27 views

TypeORM fails to load postgresql tables associated with the id in Nest.js application

The problem I'm facing is that this query sometimes returns jobs where userId is not present in reviewUsers, inviteUsers, or favouriteUsers, despite expecting to retrieve all jobs where userId matches ...
Aleksandregvrm's user avatar
0 votes
0 answers
23 views

How to use a custom DB logger with TypeORM?

I am using TypeORM and NestJS. The default TypeORM logger seems to not log in JSON output format, which is what I want. How can I create a custom DB logger that allows me to customise how I want to ...
Schalk Sevenster's user avatar
1 vote
1 answer
49 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({ ...
alireza kargar's user avatar
0 votes
0 answers
22 views

No metadata for "User" was found using TypeORM, ExpressJS, Supertest and Testcontainers

I am trying to write integration tests for an expressjs application which uses TypeORM and a PostgreSQL database. The main application works fine without any issues with a main datasource, migrations ...
greazleay's user avatar
0 votes
1 answer
36 views

How to dynamically inject a repository in Nestjs

I want to create a service that receives an entity and creates a repository. This is my attempt: export class MyService<T extends ObjectLiteral> { protected repo: Repository<T>; ...
Sherif eldeeb's user avatar
0 votes
1 answer
20 views

Issue while returning array of objects from graphQL query response

hey I'm using graphQL with NestJS and Apollo Server. The issue is I can return one object but while returing array of objects it's throwing error. Please find the response I want to return: {  ...
Nick's user avatar
  • 761
0 votes
0 answers
32 views

Can't run TypeOrm migrations with webpack: MODULE_NOT_FOUND

I have node.js app built with webpack. I am following this FAQ My webpack config has one entrypoint for the migrator script, and multiple entrypoints for migration files: const commonConfig = require('...
Vololodymyr's user avatar
  • 2,188
0 votes
1 answer
65 views

How to correctly create the connection to a local SQL Server database using TypeORM for Langchain?

I am trying to connect to my local SQL Server database to use it with Langchain. This is how I am trying to create the connection but keep getting the error shown below when fromDataSourceParams runs: ...
user34534's user avatar
0 votes
0 answers
49 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 ...
Devsi Odedra's user avatar
  • 5,282
0 votes
0 answers
33 views

Where not in query error invalid input syntax for type bigint typeorm

I was working on a project and i need to use "where not in" query like this return manager .getRepository(SlideshowItemEntity) .createQueryBuilder('slideshow_items') .softDelete() ....
Babak Asadzadeh's user avatar
0 votes
0 answers
22 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({ ...
Kaneda's user avatar
  • 132
0 votes
0 answers
17 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 ...
zlZimon's user avatar
  • 2,438
0 votes
0 answers
120 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 ...
Rohit Khatri's user avatar
  • 2,000

1
2 3 4 5
97