-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
RelationsModel relations (has many, etc.)Model relations (has many, etc.)needs steps to reproduceIssues missing a small app and/or instructions for reproducing the problemIssues missing a small app and/or instructions for reproducing the problem
Description
I have try with following code but i will got only first table record, there are missed second table info.
person.model.ts:
@property({
name: 'name',
type: 'string',
})
name: string;
@hasOne(() => Info)
infos: Info;
info.model.ts:
@property({
type: 'number',
id: true,
required: true,
})
id: number;
@belongsTo(() => Person)
personId?: number;
person.repository.ts
export class PersonRepository extends DefaultCrudRepository<Person,typeof Person.prototype.id>
{
public readonly infos: HasOneRepositoryFactory<Info,typeof Person.prototype.id>;
constructor(@inject('datasources.db') dataSource: DbDataSource,
@repository.getter('InfoRepository')
getInfoRepository: Getter<InfoRepository>,) {
super(Person, dataSource);
this.infos = this._createHasOneRepositoryFactoryFor('infos',getInfoRepository);
}
}
Current Behavior
But when i will call the api using explorer they have return following schema
Example Value
Schema
[ {
"id": 0,
"name": "string"
}]
Is there any solution for this?
Metadata
Metadata
Assignees
Labels
RelationsModel relations (has many, etc.)Model relations (has many, etc.)needs steps to reproduceIssues missing a small app and/or instructions for reproducing the problemIssues missing a small app and/or instructions for reproducing the problem