MCPcopy Index your code
hub / github.com/loopbackio/loopback-next / addProperty

Method addProperty

packages/repository/src/model.ts:150–169  ·  view source on GitHub ↗

* Add a property * @param name - Property definition or name (string) * @param definitionOrType - Definition or property type

(
    name: string,
    definitionOrType: PropertyDefinition | PropertyType,
  )

Source from the content-addressed store, hash-verified

148 * @param definitionOrType - Definition or property type
149 */
150 addProperty(
151 name: string,
152 definitionOrType: PropertyDefinition | PropertyType,
153 ): this {
154 const definition = (definitionOrType as PropertyDefinition).type
155 ? (definitionOrType as PropertyDefinition)
156 : {type: definitionOrType};
157
158 if (
159 definition.id === true &&
160 definition.generated === true &&
161 definition.type !== undefined &&
162 definition.useDefaultIdType === undefined
163 ) {
164 definition.useDefaultIdType = false;
165 }
166
167 this.properties[name] = definition;
168 return this;
169 }
170
171 /**
172 * Add a setting

Callers 15

constructorMethod · 0.95
buildModelDefinitionFunction · 0.95
OrderClass · 0.80
CartItemClass · 0.80
ReviewClass · 0.80
CustomerClass · 0.80
ProductClass · 0.80
model.unit.tsFile · 0.80
OrderClass · 0.80
CustomerClass · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected