2021-05-04 15:15:57 +03:00
|
|
|
import { Entity, Index, Column, PrimaryColumn } from 'typeorm';
|
2021-08-19 12:33:41 +03:00
|
|
|
import { id } from '../id.js';
|
2021-05-04 15:15:57 +03:00
|
|
|
|
|
|
|
@Entity()
|
|
|
|
export class Ad {
|
|
|
|
@PrimaryColumn(id())
|
|
|
|
public id: string;
|
|
|
|
|
|
|
|
@Index()
|
|
|
|
@Column('timestamp with time zone', {
|
|
|
|
comment: 'The created date of the Ad.'
|
|
|
|
})
|
|
|
|
public createdAt: Date;
|
|
|
|
|
|
|
|
@Index()
|
|
|
|
@Column('timestamp with time zone', {
|
|
|
|
comment: 'The expired date of the Ad.'
|
|
|
|
})
|
|
|
|
public expiresAt: Date;
|
|
|
|
|
|
|
|
@Column('varchar', {
|
|
|
|
length: 32, nullable: false
|
|
|
|
})
|
|
|
|
public place: string;
|
|
|
|
|
2021-05-07 08:22:13 +03:00
|
|
|
// 今は使われていないが将来的に活用される可能性はある
|
2021-05-04 15:15:57 +03:00
|
|
|
@Column('varchar', {
|
|
|
|
length: 32, nullable: false
|
|
|
|
})
|
|
|
|
public priority: string;
|
|
|
|
|
2021-05-07 08:22:13 +03:00
|
|
|
@Column('integer', {
|
|
|
|
default: 1, nullable: false
|
|
|
|
})
|
|
|
|
public ratio: number;
|
|
|
|
|
2021-05-04 15:15:57 +03:00
|
|
|
@Column('varchar', {
|
|
|
|
length: 1024, nullable: false
|
|
|
|
})
|
|
|
|
public url: string;
|
|
|
|
|
|
|
|
@Column('varchar', {
|
|
|
|
length: 1024, nullable: false
|
|
|
|
})
|
|
|
|
public imageUrl: string;
|
|
|
|
|
|
|
|
@Column('varchar', {
|
|
|
|
length: 8192, nullable: false
|
|
|
|
})
|
|
|
|
public memo: string;
|
|
|
|
|
|
|
|
constructor(data: Partial<Ad>) {
|
|
|
|
if (data == null) return;
|
|
|
|
|
|
|
|
for (const [k, v] of Object.entries(data)) {
|
|
|
|
(this as any)[k] = v;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|