From e24b0ceb803bc0e63407f42d71d4956e8ecac641 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 15 Feb 2023 14:31:59 +0900 Subject: [PATCH] startAt -> startsAt --- packages/backend/migration/1676438468213-ad3.js | 4 ++-- packages/backend/src/models/entities/Ad.ts | 2 +- .../src/server/api/endpoints/admin/ad/create.ts | 6 +++--- .../src/server/api/endpoints/admin/ad/update.ts | 6 +++--- packages/backend/src/server/api/endpoints/meta.ts | 2 +- packages/frontend/src/pages/admin/ads.vue | 12 ++++++------ 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/packages/backend/migration/1676438468213-ad3.js b/packages/backend/migration/1676438468213-ad3.js index 082bb3132..c55f6ae36 100644 --- a/packages/backend/migration/1676438468213-ad3.js +++ b/packages/backend/migration/1676438468213-ad3.js @@ -1,9 +1,9 @@ export class ad1676438468213 { name = 'ad1676438468213'; 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) { - await queryRunner.query(`ALTER TABLE "role" DROP COLUMN "startAt"`); + await queryRunner.query(`ALTER TABLE "role" DROP COLUMN "startsAt"`); } } diff --git a/packages/backend/src/models/entities/Ad.ts b/packages/backend/src/models/entities/Ad.ts index c87932adb..450336a01 100644 --- a/packages/backend/src/models/entities/Ad.ts +++ b/packages/backend/src/models/entities/Ad.ts @@ -22,7 +22,7 @@ export class Ad { @Column('timestamp with time zone', { comment: 'The expired date of the Ad.', }) - public startAt: Date; + public startsAt: Date; @Column('varchar', { length: 32, nullable: false, diff --git a/packages/backend/src/server/api/endpoints/admin/ad/create.ts b/packages/backend/src/server/api/endpoints/admin/ad/create.ts index ba128c75a..917242db3 100644 --- a/packages/backend/src/server/api/endpoints/admin/ad/create.ts +++ b/packages/backend/src/server/api/endpoints/admin/ad/create.ts @@ -20,10 +20,10 @@ export const paramDef = { priority: { type: 'string' }, ratio: { type: 'integer' }, expiresAt: { type: 'integer' }, - startAt: { type: 'integer' }, + startsAt: { type: 'integer' }, 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; // eslint-disable-next-line import/no-default-export @@ -40,7 +40,7 @@ export default class extends Endpoint { id: this.idService.genId(), createdAt: new Date(), expiresAt: new Date(ps.expiresAt), - startAt: new Date(ps.startAt), + startsAt: new Date(ps.startsAt), url: ps.url, imageUrl: ps.imageUrl, priority: ps.priority, diff --git a/packages/backend/src/server/api/endpoints/admin/ad/update.ts b/packages/backend/src/server/api/endpoints/admin/ad/update.ts index 75f6f1d5a..dbab7e9d4 100644 --- a/packages/backend/src/server/api/endpoints/admin/ad/update.ts +++ b/packages/backend/src/server/api/endpoints/admin/ad/update.ts @@ -30,9 +30,9 @@ export const paramDef = { priority: { type: 'string' }, ratio: { 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; // eslint-disable-next-line import/no-default-export @@ -55,7 +55,7 @@ export default class extends Endpoint { memo: ps.memo, imageUrl: ps.imageUrl, expiresAt: new Date(ps.expiresAt), - startAt: new Date(ps.startAt), + startsAt: new Date(ps.startsAt), }); }); } diff --git a/packages/backend/src/server/api/endpoints/meta.ts b/packages/backend/src/server/api/endpoints/meta.ts index 823c3f72b..d688aaca1 100644 --- a/packages/backend/src/server/api/endpoints/meta.ts +++ b/packages/backend/src/server/api/endpoints/meta.ts @@ -262,7 +262,7 @@ export default class extends Endpoint { const ads = await this.adsRepository.find({ where: { expiresAt: MoreThan(new Date()), - startAt: LessThanOrEqual(new Date()), + startsAt: LessThanOrEqual(new Date()), }, }); diff --git a/packages/frontend/src/pages/admin/ads.vue b/packages/frontend/src/pages/admin/ads.vue index 88131fce8..e5431b177 100644 --- a/packages/frontend/src/pages/admin/ads.vue +++ b/packages/frontend/src/pages/admin/ads.vue @@ -29,7 +29,7 @@ - + @@ -70,13 +70,13 @@ const localTimeDiff = localTime.getTimezoneOffset() * 60 * 1000; os.api('admin/ad/list').then(adsResponse => { ads = adsResponse.map(r => { const exdate = new Date(r.expiresAt); - const stdate = new Date(r.startAt); + const stdate = new Date(r.startsAt); exdate.setMilliseconds(exdate.getMilliseconds() - localTimeDiff); stdate.setMilliseconds(stdate.getMilliseconds() - localTimeDiff); return { ...r, 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: '', imageUrl: null, expiresAt: null, - startAt: null, + startsAt: null, }); } @@ -113,13 +113,13 @@ function save(ad) { os.apiWithDialog('admin/ad/create', { ...ad, expiresAt: new Date(ad.expiresAt).getTime(), - startAt: new Date(ad.startAt).getTime(), + startsAt: new Date(ad.startsAt).getTime(), }); } else { os.apiWithDialog('admin/ad/update', { ...ad, expiresAt: new Date(ad.expiresAt).getTime(), - startAt: new Date(ad.startAt).getTime(), + startsAt: new Date(ad.startsAt).getTime(), }); } }