1 import { BaseRelationship } from "./base"
2
3 /**
4 * ManyToMany relationship defines a relationship between two entities
5 * where the owner of the relationship has many instance of the
6 * related entity via a pivot table.
7 *
8 * For example:
9 *
10 * - A user has many teams. But a team has many users as well. So this
11 * relationship requires a pivot table to establish a many to many
12 * relationship between two entities
13 */
14 export class ManyToMany<T> extends BaseRelationship<T> {
15 type = "manyToMany" as const
16
17 static isManyToMany<T>(relationship: any): relationship is ManyToMany<T> {
18 return relationship?.type === "manyToMany"
19 }
20 }