3c6175d959
* 曜日選択できるように * ラベル選択でもチェックが変更されるように * adを参照しないといけないかも * smallint -> integer * 異物混入だったので取りだし * タイムゾーン指定(Date2つ使うのなんか違和感 * 未テスト * これにすると出てこないかも * UIチョット変更 * UI変更 fix bug * 畳むように修正 * dayofweek->dayOfWeek * マイグレ時にnot null,default設定してるのでnullable:falseでよさそう * コメントの記載 * Update packages/backend/src/server/api/endpoints/meta.ts Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> --------- Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
70 lines
1.3 KiB
TypeScript
70 lines
1.3 KiB
TypeScript
import { Entity, Index, Column, PrimaryColumn } from 'typeorm';
|
|
import { id } from '../id.js';
|
|
|
|
@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;
|
|
|
|
@Index()
|
|
@Column('timestamp with time zone', {
|
|
comment: 'The expired date of the Ad.',
|
|
default: () => 'now()',
|
|
})
|
|
public startsAt: Date;
|
|
|
|
@Column('varchar', {
|
|
length: 32, nullable: false,
|
|
})
|
|
public place: string;
|
|
|
|
// 今は使われていないが将来的に活用される可能性はある
|
|
@Column('varchar', {
|
|
length: 32, nullable: false,
|
|
})
|
|
public priority: string;
|
|
|
|
@Column('integer', {
|
|
default: 1, nullable: false,
|
|
})
|
|
public ratio: number;
|
|
|
|
@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;
|
|
@Column('integer', {
|
|
default: 0, nullable: false,
|
|
})
|
|
public dayOfWeek: number;
|
|
constructor(data: Partial<Ad>) {
|
|
if (data == null) return;
|
|
|
|
for (const [k, v] of Object.entries(data)) {
|
|
(this as any)[k] = v;
|
|
}
|
|
}
|
|
}
|