lib/common/media/entity/media-file.entity.ts
The entity stores media object files (links)
Properties |
code |
Type : string
|
Decorators :
@Index({unique: true})
|
format |
Type : MediaFormatEntity
|
Decorators :
@ManyToOne(undefined, type => type.code)
|
height |
Type : number
|
Decorators :
@Column('smallint', {nullable: true})
|
id |
Type : number
|
Decorators :
@PrimaryGeneratedColumn({zerofill: true})
|
media |
Type : MediaEntity
|
Decorators :
@ManyToOne(undefined)
|
name |
Type : string
|
Decorators :
@Index()
|
size |
Type : number
|
Decorators :
@Column('int', {nullable: true})
|
width |
Type : number
|
Decorators :
@Column('smallint', {nullable: true})
|
import {
Column,
Entity,
Index,
ManyToOne,
PrimaryGeneratedColumn,
} from "typeorm";
import { MediaEntity } from "./media.entity";
import { MediaFile } from "../media.types";
import { MediaFormatEntity } from "./media-format.entity";
/**
* The entity stores media object files (links)
*/
@Entity("medias_files")
export class MediaFileEntity implements MediaFile {
@PrimaryGeneratedColumn({ zerofill: true })
id: number;
@Index({ unique: true })
@Column("varchar", { nullable: true })
code: string;
@Index()
@Column("varchar", { nullable: true })
name: string;
@Column("smallint", { nullable: true })
width: number;
@Column("smallint", { nullable: true })
height: number;
@Column("int", { nullable: true })
size: number;
@ManyToOne(() => MediaFormatEntity, (type) => type.code)
format: MediaFormatEntity;
@ManyToOne(() => MediaEntity)
media: MediaEntity;
}