entity 연결 수정 및 코드정리
This commit is contained in:
@@ -723,11 +723,9 @@ export class GenomeService {
|
||||
traitVal: detail.traitVal, // 형질 측정값
|
||||
breedVal: detail.traitEbv, // EBV (추정육종가)
|
||||
percentile: detail.traitPercentile, // 백분위 순위
|
||||
traitInfo: {
|
||||
traitNm: detail.traitName, // 형질명
|
||||
traitCtgry: getTraitCategory(detail.traitName || ''), // 카테고리 (공통 함수 사용)
|
||||
traitDesc: '', // 형질 설명 (빈값)
|
||||
},
|
||||
traitName: detail.traitName, // 형질명 (평평한 구조)
|
||||
traitCategory: getTraitCategory(detail.traitName || ''), // 카테고리
|
||||
traitDesc: '', // 형질 설명 (빈값)
|
||||
})),
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { BaseModel } from 'src/common/entities/base.entity';
|
||||
import { FarmModel } from 'src/farm/entities/farm.entity';
|
||||
import { CowModel } from 'src/cow/entities/cow.entity';
|
||||
import {
|
||||
Column,
|
||||
Entity,
|
||||
@@ -254,7 +254,10 @@ export class MptModel extends BaseModel {
|
||||
creatine: number;
|
||||
|
||||
// Relations
|
||||
@ManyToOne(() => FarmModel, { onDelete: 'CASCADE' })
|
||||
@JoinColumn({ name: 'fk_farm_no' })
|
||||
farm: FarmModel;
|
||||
@ManyToOne(() => CowModel, {
|
||||
onDelete: 'CASCADE',
|
||||
createForeignKeyConstraints: false
|
||||
})
|
||||
@JoinColumn({ name: 'cow_id', referencedColumnName: 'cowId' })
|
||||
cow: CowModel;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ export class MptService {
|
||||
async findByCowShortNo(cowShortNo: string): Promise<MptModel[]> {
|
||||
return this.mptRepository.find({
|
||||
where: { cowShortNo: cowShortNo, delDt: IsNull() },
|
||||
relations: ['farm'],
|
||||
relations: ['cow', 'cow.farm'],
|
||||
order: { testDt: 'DESC' },
|
||||
});
|
||||
}
|
||||
@@ -28,7 +28,7 @@ export class MptService {
|
||||
async findByCowId(cowId: string): Promise<MptModel[]> {
|
||||
return this.mptRepository.find({
|
||||
where: { cowId: cowId, delDt: IsNull() },
|
||||
relations: ['farm'],
|
||||
relations: ['cow', 'cow.farm'],
|
||||
order: { testDt: 'DESC' },
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user