mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-17 04:46:05 +00:00
public commit
This commit is contained in:
25
app/src/data/relations/EntityRelationAnchor.ts
Normal file
25
app/src/data/relations/EntityRelationAnchor.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import type { Entity } from "../entities";
|
||||
|
||||
export class EntityRelationAnchor {
|
||||
entity: Entity;
|
||||
cardinality?: number;
|
||||
|
||||
/**
|
||||
* The name that the other entity will use to reference this entity
|
||||
*/
|
||||
reference: string;
|
||||
|
||||
constructor(entity: Entity, name: string, cardinality?: number) {
|
||||
this.entity = entity;
|
||||
this.cardinality = cardinality;
|
||||
this.reference = name;
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
return {
|
||||
entity: this.entity.name,
|
||||
cardinality: this.cardinality,
|
||||
name: this.reference,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user