2025-03-29 09:26:24 -04:00
|
|
|
import { AssetTable } from 'src/schema/tables/asset.table';
|
|
|
|
|
import { UserTable } from 'src/schema/tables/user.table';
|
2025-03-28 10:40:09 -04:00
|
|
|
import { ForeignKeyColumn, PrimaryGeneratedColumn, Table } from 'src/sql-tools';
|
|
|
|
|
|
|
|
|
|
@Table('asset_stack')
|
|
|
|
|
export class StackTable {
|
|
|
|
|
@PrimaryGeneratedColumn()
|
|
|
|
|
id!: string;
|
|
|
|
|
|
|
|
|
|
//TODO: Add constraint to ensure primary asset exists in the assets array
|
|
|
|
|
@ForeignKeyColumn(() => AssetTable, { nullable: false, unique: true })
|
|
|
|
|
primaryAssetId!: string;
|
2025-04-07 15:12:12 -04:00
|
|
|
|
|
|
|
|
@ForeignKeyColumn(() => UserTable, { onDelete: 'CASCADE', onUpdate: 'CASCADE' })
|
|
|
|
|
ownerId!: string;
|
2025-03-28 10:40:09 -04:00
|
|
|
}
|