startAt -> startsAt

This commit is contained in:
syuilo 2023-02-15 14:31:59 +09:00
parent 71c42bef9b
commit e24b0ceb80
6 changed files with 16 additions and 16 deletions

View File

@ -1,9 +1,9 @@
export class ad1676438468213 { export class ad1676438468213 {
name = 'ad1676438468213'; name = 'ad1676438468213';
async up(queryRunner) { async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "ad" ADD "startAt" TIMESTAMP WITH TIME ZONE NOT NULL`); await queryRunner.query(`ALTER TABLE "ad" ADD "startsAt" TIMESTAMP WITH TIME ZONE NOT NULL`);
} }
async down(queryRunner) { async down(queryRunner) {
await queryRunner.query(`ALTER TABLE "role" DROP COLUMN "startAt"`); await queryRunner.query(`ALTER TABLE "role" DROP COLUMN "startsAt"`);
} }
} }

View File

@ -22,7 +22,7 @@ export class Ad {
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The expired date of the Ad.', comment: 'The expired date of the Ad.',
}) })
public startAt: Date; public startsAt: Date;
@Column('varchar', { @Column('varchar', {
length: 32, nullable: false, length: 32, nullable: false,

View File

@ -20,10 +20,10 @@ export const paramDef = {
priority: { type: 'string' }, priority: { type: 'string' },
ratio: { type: 'integer' }, ratio: { type: 'integer' },
expiresAt: { type: 'integer' }, expiresAt: { type: 'integer' },
startAt: { type: 'integer' }, startsAt: { type: 'integer' },
imageUrl: { type: 'string', minLength: 1 }, imageUrl: { type: 'string', minLength: 1 },
}, },
required: ['url', 'memo', 'place', 'priority', 'ratio', 'expiresAt', 'startAt', 'imageUrl'], required: ['url', 'memo', 'place', 'priority', 'ratio', 'expiresAt', 'startsAt', 'imageUrl'],
} as const; } as const;
// eslint-disable-next-line import/no-default-export // eslint-disable-next-line import/no-default-export
@ -40,7 +40,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
id: this.idService.genId(), id: this.idService.genId(),
createdAt: new Date(), createdAt: new Date(),
expiresAt: new Date(ps.expiresAt), expiresAt: new Date(ps.expiresAt),
startAt: new Date(ps.startAt), startsAt: new Date(ps.startsAt),
url: ps.url, url: ps.url,
imageUrl: ps.imageUrl, imageUrl: ps.imageUrl,
priority: ps.priority, priority: ps.priority,

View File

@ -30,9 +30,9 @@ export const paramDef = {
priority: { type: 'string' }, priority: { type: 'string' },
ratio: { type: 'integer' }, ratio: { type: 'integer' },
expiresAt: { type: 'integer' }, expiresAt: { type: 'integer' },
startAt: { type: 'integer' }, startsAt: { type: 'integer' },
}, },
required: ['id', 'memo', 'url', 'imageUrl', 'place', 'priority', 'ratio', 'expiresAt', 'startAt'], required: ['id', 'memo', 'url', 'imageUrl', 'place', 'priority', 'ratio', 'expiresAt', 'startsAt'],
} as const; } as const;
// eslint-disable-next-line import/no-default-export // eslint-disable-next-line import/no-default-export
@ -55,7 +55,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
memo: ps.memo, memo: ps.memo,
imageUrl: ps.imageUrl, imageUrl: ps.imageUrl,
expiresAt: new Date(ps.expiresAt), expiresAt: new Date(ps.expiresAt),
startAt: new Date(ps.startAt), startsAt: new Date(ps.startsAt),
}); });
}); });
} }

View File

@ -262,7 +262,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
const ads = await this.adsRepository.find({ const ads = await this.adsRepository.find({
where: { where: {
expiresAt: MoreThan(new Date()), expiresAt: MoreThan(new Date()),
startAt: LessThanOrEqual(new Date()), startsAt: LessThanOrEqual(new Date()),
}, },
}); });

View File

@ -29,7 +29,7 @@
<MkInput v-model="ad.ratio" type="number"> <MkInput v-model="ad.ratio" type="number">
<template #label>{{ i18n.ts.ratio }}</template> <template #label>{{ i18n.ts.ratio }}</template>
</MkInput> </MkInput>
<MkInput v-model="ad.startAt" type="datetime-local"> <MkInput v-model="ad.startsAt" type="datetime-local">
<template #label>{{ i18n.ts.startingperiod }}</template> <template #label>{{ i18n.ts.startingperiod }}</template>
</MkInput> </MkInput>
<MkInput v-model="ad.expiresAt" type="datetime-local"> <MkInput v-model="ad.expiresAt" type="datetime-local">
@ -70,13 +70,13 @@ const localTimeDiff = localTime.getTimezoneOffset() * 60 * 1000;
os.api('admin/ad/list').then(adsResponse => { os.api('admin/ad/list').then(adsResponse => {
ads = adsResponse.map(r => { ads = adsResponse.map(r => {
const exdate = new Date(r.expiresAt); const exdate = new Date(r.expiresAt);
const stdate = new Date(r.startAt); const stdate = new Date(r.startsAt);
exdate.setMilliseconds(exdate.getMilliseconds() - localTimeDiff); exdate.setMilliseconds(exdate.getMilliseconds() - localTimeDiff);
stdate.setMilliseconds(stdate.getMilliseconds() - localTimeDiff); stdate.setMilliseconds(stdate.getMilliseconds() - localTimeDiff);
return { return {
...r, ...r,
expiresAt: exdate.toISOString().slice(0, 16), expiresAt: exdate.toISOString().slice(0, 16),
startAt: stdate.toISOString().slice(0, 16), startsAt: stdate.toISOString().slice(0, 16),
}; };
}); });
}); });
@ -91,7 +91,7 @@ function add() {
url: '', url: '',
imageUrl: null, imageUrl: null,
expiresAt: null, expiresAt: null,
startAt: null, startsAt: null,
}); });
} }
@ -113,13 +113,13 @@ function save(ad) {
os.apiWithDialog('admin/ad/create', { os.apiWithDialog('admin/ad/create', {
...ad, ...ad,
expiresAt: new Date(ad.expiresAt).getTime(), expiresAt: new Date(ad.expiresAt).getTime(),
startAt: new Date(ad.startAt).getTime(), startsAt: new Date(ad.startsAt).getTime(),
}); });
} else { } else {
os.apiWithDialog('admin/ad/update', { os.apiWithDialog('admin/ad/update', {
...ad, ...ad,
expiresAt: new Date(ad.expiresAt).getTime(), expiresAt: new Date(ad.expiresAt).getTime(),
startAt: new Date(ad.startAt).getTime(), startsAt: new Date(ad.startsAt).getTime(),
}); });
} }
} }