initial commit, lots of random shit

This commit is contained in:
Erin 2023-11-11 19:09:24 -05:00
commit 7bb18f0a71
27 changed files with 3394 additions and 0 deletions

View file

@ -0,0 +1,29 @@
import {BeforeInsert, Entity, ManyToOne, PrimaryColumn} from 'typeorm';
import {Node} from '$lib/server/entity/Node';
import {ulidMonotonic} from '$lib/server/ulid';
@Entity()
export class Edge {
@PrimaryColumn({type: 'varchar', length: 26})
id = ulidMonotonic();
@ManyToOne(() => Node, node => node.outgoingEdges, {
nullable: false,
cascade: true,
onDelete: 'CASCADE',
})
head!: Node;
@ManyToOne(() => Node, node => node.incomingEdges, {
nullable: false,
cascade: true,
onDelete: 'CASCADE',
})
tail!: Node;
@BeforeInsert()
beforeInsert () {
this.id = ulidMonotonic();
}
}