@randombenj/db
Version:
Display, search and copy LXD-images using a web interface.
72 lines (54 loc) • 1.59 kB
text/typescript
import {
BaseEntity,
Column,
Entity,
JoinColumn,
ManyToOne,
OneToMany,
PrimaryGeneratedColumn
} from 'typeorm';
import { Alias, ImageAvailability, OperatingSystemArchitecture } from '.';
()
export class Image extends BaseEntity {
()
id: number;
(
type => ImageAvailability,
imageAvailability => imageAvailability.image
)
()
imageAvailabilities: ImageAvailability[];
({ unique: true, type: 'varchar', nullable: true })
fingerprint?: string;
/** The size in human-readable form (e.g. '12 kB') */
({ type: 'varchar', nullable: true })
size?: string;
({ type: 'varchar', nullable: true })
label?: string;
({ type: 'varchar', nullable: true })
serial?: string;
({ type: 'varchar', nullable: true })
description?: string;
({ type: 'boolean', nullable: true })
autoUpdate?: boolean;
({ type: 'varchar', nullable: true })
createdAt?: Date;
({ type: 'varchar', nullable: true })
expiresAt?: Date;
({ type: 'varchar', nullable: true })
lastUsedAt?: Date;
({ type: 'varchar', nullable: true })
uploadedAt?: Date;
(type => OperatingSystemArchitecture)
osArchitecture: OperatingSystemArchitecture;
(type => Alias, alias => alias.image)
aliases: Alias[];
({ type: 'boolean', nullable: true })
public?: boolean;
/**
* Returns a 12 character long fingerprint
*/
get readableFingerprint() {
return this.fingerprint.substring(0, 12);
}
}