인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

인프런 커뮤니티 질문&답변

21thpoem님의 프로필 이미지
21thpoem

작성한 질문수

Slack 클론 코딩[백엔드 with NestJS + TypeORM]

typeorm 관계 설정하기

TypeORM 반환 데이터 구조

작성

·

288

0

아래와 같이 조인했을 시에 조인 결과가 배열안에 객체로 나오는데 sequelize처럼 여러 객체로 결과 반환할 수 있는 방법이 있을까요? 혹시 몰라서 OneToOne으로 관계 설정 맺었는데 맞는 방법일까요:

[
{
"id": 30,
"equipmentName": "수도(용수) 유량계",
"locationMainId": 1,
"locationSubId": 3,
"importance": null,
"energyId": 30,
"installDtm": null,
"serialNum": null,
"energyPurposeName": "급탕",
"name": "여자화장실 온수기수도계량기",
"remark": null,
"created": "2021-05-20T00:52:11.000Z",
"updated": "2021-06-15T00:44:36.000Z",
"x": 100,
"y": 100,
"webaccessTags": [
{
"tagname": "T3_PT1_Freq*01M",
"equipmentMgmtId": 30,
"tagDescription": "temperature",
"unit": null,
"unitConversion": { "type": "Buffer", "data": [0] },
"isTrend": { "type": "Buffer", "data": [0] },
"loggingTime": 300,
"energyType": null
}
]
},
{
"id": 54,
"equipmentName": "습도 계측기",
"locationMainId": 1,
"locationSubId": 2,
"importance": null,
"energyId": null,
"installDtm": null,
"serialNum": null,
"energyPurposeName": null,
"name": "복도습도",
"remark": null,
"created": "2021-05-20T01:12:12.000Z",
"updated": "2021-06-14T09:02:02.000Z",
"x": 0,
"y": 0,
"webaccessTags": [
{
"tagname": "T3_PT1_Humidity*01M",
"equipmentMgmtId": 54,
"tagDescription": "123",
"unit": null,
"unitConversion": { "type": "Buffer", "data": [0] },
"isTrend": { "type": "Buffer", "data": [0] },
"loggingTime": 60,
"energyType": "습도계"
}
]
},
{
"id": 53,
"equipmentName": "온도 계측기",
"locationMainId": 1,
"locationSubId": 2,
"importance": null,
"energyId": null,
"installDtm": null,
"serialNum": null,
"energyPurposeName": null,
"name": "복도온도",
"remark": null,
"created": "2021-05-20T01:11:58.000Z",
"updated": "2021-06-14T09:02:03.000Z",
"x": 0,
"y": 0,
"webaccessTags": [
{
"tagname": "T3_PT1_Temp*01M",
"equipmentMgmtId": 53,
"tagDescription": "123",
"unit": null,
"unitConversion": { "type": "Buffer", "data": [0] },
"isTrend": { "type": "Buffer", "data": [0] },
"loggingTime": 60,
"energyType": "온도계"
}
]
}
]

답변 1

0

제로초(조현영)님의 프로필 이미지
제로초(조현영)
지식공유자

관계 설정이 잘못된 것으로 보입니다. 엔티티쪽 보여주세요.

21thpoem님의 프로필 이미지
21thpoem

작성한 질문수

질문하기