MCPcopy Create free account
hub / github.com/loopbackio/loopback-next / belongsTo

Method belongsTo

packages/repository/src/model.ts:195–206  ·  view source on GitHub ↗

* Define a new belongsTo relation. * @param name - The name of the belongsTo relation. * @param definition - The definition of the belongsTo relation.

(
    name: string,
    definition: Omit<BelongsToDefinition, 'name' | 'type' | 'targetsMany'>,
  )

Source from the content-addressed store, hash-verified

193 * @param definition - The definition of the belongsTo relation.
194 */
195 belongsTo(
196 name: string,
197 definition: Omit<BelongsToDefinition, 'name' | 'type' | 'targetsMany'>,
198 ): this {
199 const meta: BelongsToDefinition = {
200 ...definition,
201 name,
202 type: RelationType.belongsTo,
203 targetsMany: false,
204 };
205 return this.addRelation(meta);
206 }
207
208 /**
209 * Define a new hasOne relation.

Callers 3

OrderClass · 0.80
model.unit.tsFile · 0.80
getSequelizeModelMethod · 0.80

Calls 1

addRelationMethod · 0.95

Tested by

no test coverage detected