Closed qstyler closed 1 year ago
I'm getting a normal result if I call findBy
on a repo.
const analysisList = await this.repo.findBy({
userPnl: 'xxxxxx',
});
console.log(analysisList);
Generated SQL is ok:
SELECT "Analysis"."id" AS "Analysis_id", "Analysis"."code" AS "Analysis_code", "Analysis"."name" AS "Analysis_name", "Analysis"."userPnl" AS "Analysis_userPnl", "Analysis"."data" AS "Analysis_data", "Analysis"."createdAt" AS "Analysis_createdAt" FROM "ComGen2"."analysis" "Analysis" WHERE ("Analysis"."userPnl" = @0) -- PARAMETERS: ["xxxxxx"]
And here's the console output:
[
Analysis {
id: 2,
code: 'OkWtWjq-',
name: 'test',
userPnl: 'xxxxxx',
data: { test: '12341234', test2: '987654' },
createdAt: 2022-11-02T07:16:45.803Z
}
]
Somehow this has something to do with “typeorm” version. If I change it to "typeorm": "^0.2.0"
things start to work normally.
This is actually fixed in this PR #797
Hey @qstyler, I got the same problem.. can u share how your package json (nestjsx versions, mssql, typeorm) turned out?
@lhfioravanso It looks like the maintainer doesn't really maintain this project, so I used a fork. There are several out there. Although several days ago he approved several PRs, that solved this problem among others. Unfortunately, it hasn't been released to npm yet.
Bug Report
I have a basic setup with one single entity and I create a CRUD service/controller by just following the docs.
But every entity returned has its ID transformed to an array of two IDs:
The same happens when I request a list of IDs and get a newly created entity in return for
POST
andPATCH
.And I see that SQL generated looks like this. For some reason, it lists
"Analysis"."id"
two times.Here's the entity:
Controller:
And service:
These are the versions I'm using:
I tried to use version
^4
but with the same result.The schema generated by Swagger seems correct though.