1 import { BaseRelationship } from "./base"
2
3 /**
4 * HasMany relationship defines a relationship between two entities
5 * where the owner of the relationship has many instance of the
6 * related entity.
7 *
8 * For example:
9 *
10 * - A user HasMany books
11 * - A user HasMany addresses
12 */
13 export class HasMany<T> extends BaseRelationship<T> {
14 type = "hasMany" as const
15
16 static isHasMany<T>(relationship: any): relationship is HasMany<T> {
17 return relationship?.type === "hasMany"
18 }
19 }