Skip to content
module@warp-drive/schema-dsl
ts
function hasMany(options): (target, key) => void;

Defined in: fields/has-many.ts:98

Decorator

CAUTION

This decorator is LEGACY, and only valid on resources decorated with @Resource({ legacy: true }).

Marks a property as a LegacyHasManyField for use with @warp-drive/legacy/model.

Parameters

options

HasManyOptions

Returns

(target, key) => void

Example

ts
import { Resource, hasMany } from '@warp-drive/schema-dsl';

@Resource({ legacy: true })
export class User {
  @hasMany({ type: 'comment', inverse: null, async: false })
  declare replies: unknown[];
}
json
[
  {
    "kind": "hasMany",
    "name": "replies",
    "type": "comment",
    "options": { "async": false, "inverse": null }
  }
]

Since

5.9.0

Released under the MIT License.