refactor: rename instance.caughtAt to instance.firstRetrievedAt

This commit is contained in:
syuilo 2023-01-16 05:02:38 +09:00
parent 7e5f3dbf11
commit 30fced38c4
10 changed files with 23 additions and 11 deletions

View File

@ -64,6 +64,7 @@ You should also include the user name that made the change.
- API: `user`および`note`エンティティに`emojis`プロパティが含まれなくなりました - API: `user`および`note`エンティティに`emojis`プロパティが含まれなくなりました
- API: `user`エンティティに`avatarColor`および`bannerColor`プロパティが含まれなくなりました - API: `user`エンティティに`avatarColor`および`bannerColor`プロパティが含まれなくなりました
- API: `instance`エンティティに`latestStatus`、`lastCommunicatedAt`、`latestRequestSentAt`プロパティが含まれなくなりました - API: `instance`エンティティに`latestStatus`、`lastCommunicatedAt`、`latestRequestSentAt`プロパティが含まれなくなりました
- API: `instance`エンティティの`caughtAt`は`firstRetrievedAt`に名前が変わりました
### Improvements ### Improvements
- Role system @syuilo - Role system @syuilo

View File

@ -0,0 +1,11 @@
export class firstRetrievedAt1673812883772 {
name = 'firstRetrievedAt1673812883772'
async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "instance" RENAME COLUMN "caughtAt" TO "firstRetrievedAt"`);
}
async down(queryRunner) {
await queryRunner.query(`ALTER TABLE "instance" RENAME COLUMN "firstRetrievedAt" TO "caughtAt"`);
}
}

View File

@ -34,7 +34,7 @@ export class FederatedInstanceService {
const i = await this.instancesRepository.insert({ const i = await this.instancesRepository.insert({
id: this.idService.genId(), id: this.idService.genId(),
host, host,
caughtAt: new Date(), firstRetrievedAt: new Date(),
}).then(x => this.instancesRepository.findOneByOrFail(x.identifiers[0])); }).then(x => this.instancesRepository.findOneByOrFail(x.identifiers[0]));
this.cache.set(host, i); this.cache.set(host, i);

View File

@ -29,7 +29,7 @@ export class InstanceEntityService {
const meta = await this.metaService.fetch(); const meta = await this.metaService.fetch();
return { return {
id: instance.id, id: instance.id,
caughtAt: instance.caughtAt.toISOString(), firstRetrievedAt: instance.firstRetrievedAt.toISOString(),
host: instance.host, host: instance.host,
usersCount: instance.usersCount, usersCount: instance.usersCount,
notesCount: instance.notesCount, notesCount: instance.notesCount,

View File

@ -13,7 +13,7 @@ export class Instance {
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The caught date of the Instance.', comment: 'The caught date of the Instance.',
}) })
public caughtAt: Date; public firstRetrievedAt: Date;
/** /**
* *

View File

@ -6,7 +6,7 @@ export const packedFederationInstanceSchema = {
optional: false, nullable: false, optional: false, nullable: false,
format: 'id', format: 'id',
}, },
caughtAt: { firstRetrievedAt: {
type: 'string', type: 'string',
optional: false, nullable: false, optional: false, nullable: false,
format: 'date-time', format: 'date-time',

View File

@ -63,8 +63,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
case '-following': query.orderBy('instance.followingCount', 'ASC'); break; case '-following': query.orderBy('instance.followingCount', 'ASC'); break;
case '+followers': query.orderBy('instance.followersCount', 'DESC'); break; case '+followers': query.orderBy('instance.followersCount', 'DESC'); break;
case '-followers': query.orderBy('instance.followersCount', 'ASC'); break; case '-followers': query.orderBy('instance.followersCount', 'ASC'); break;
case '+caughtAt': query.orderBy('instance.caughtAt', 'DESC'); break; case '+firstRetrievedAt': query.orderBy('instance.firstRetrievedAt', 'DESC'); break;
case '-caughtAt': query.orderBy('instance.caughtAt', 'ASC'); break; case '-firstRetrievedAt': query.orderBy('instance.firstRetrievedAt', 'ASC'); break;
case '+latestRequestReceivedAt': query.orderBy('instance.latestRequestReceivedAt', 'DESC', 'NULLS LAST'); break; case '+latestRequestReceivedAt': query.orderBy('instance.latestRequestReceivedAt', 'DESC', 'NULLS LAST'); break;
case '-latestRequestReceivedAt': query.orderBy('instance.latestRequestReceivedAt', 'ASC', 'NULLS FIRST'); break; case '-latestRequestReceivedAt': query.orderBy('instance.latestRequestReceivedAt', 'ASC', 'NULLS FIRST'); break;

View File

@ -28,8 +28,8 @@
<option value="-following">{{ i18n.ts.following }} ({{ i18n.ts.ascendingOrder }})</option> <option value="-following">{{ i18n.ts.following }} ({{ i18n.ts.ascendingOrder }})</option>
<option value="+followers">{{ i18n.ts.followers }} ({{ i18n.ts.descendingOrder }})</option> <option value="+followers">{{ i18n.ts.followers }} ({{ i18n.ts.descendingOrder }})</option>
<option value="-followers">{{ i18n.ts.followers }} ({{ i18n.ts.ascendingOrder }})</option> <option value="-followers">{{ i18n.ts.followers }} ({{ i18n.ts.ascendingOrder }})</option>
<option value="+caughtAt">{{ i18n.ts.registeredAt }} ({{ i18n.ts.descendingOrder }})</option> <option value="+firstRetrievedAt">{{ i18n.ts.registeredAt }} ({{ i18n.ts.descendingOrder }})</option>
<option value="-caughtAt">{{ i18n.ts.registeredAt }} ({{ i18n.ts.ascendingOrder }})</option> <option value="-firstRetrievedAt">{{ i18n.ts.registeredAt }} ({{ i18n.ts.ascendingOrder }})</option>
</MkSelect> </MkSelect>
</FormSplit> </FormSplit>
</div> </div>

View File

@ -32,8 +32,8 @@
<option value="-following">{{ i18n.ts.following }} ({{ i18n.ts.ascendingOrder }})</option> <option value="-following">{{ i18n.ts.following }} ({{ i18n.ts.ascendingOrder }})</option>
<option value="+followers">{{ i18n.ts.followers }} ({{ i18n.ts.descendingOrder }})</option> <option value="+followers">{{ i18n.ts.followers }} ({{ i18n.ts.descendingOrder }})</option>
<option value="-followers">{{ i18n.ts.followers }} ({{ i18n.ts.ascendingOrder }})</option> <option value="-followers">{{ i18n.ts.followers }} ({{ i18n.ts.ascendingOrder }})</option>
<option value="+caughtAt">{{ i18n.ts.registeredAt }} ({{ i18n.ts.descendingOrder }})</option> <option value="+firstRetrievedAt">{{ i18n.ts.registeredAt }} ({{ i18n.ts.descendingOrder }})</option>
<option value="-caughtAt">{{ i18n.ts.registeredAt }} ({{ i18n.ts.ascendingOrder }})</option> <option value="-firstRetrievedAt">{{ i18n.ts.registeredAt }} ({{ i18n.ts.ascendingOrder }})</option>
</MkSelect> </MkSelect>
</FormSplit> </FormSplit>
</div> </div>

View File

@ -38,7 +38,7 @@
<FormSection> <FormSection>
<MkKeyValue oneline style="margin: 1em 0;"> <MkKeyValue oneline style="margin: 1em 0;">
<template #key>{{ i18n.ts.registeredAt }}</template> <template #key>{{ i18n.ts.registeredAt }}</template>
<template #value><MkTime mode="detail" :time="instance.caughtAt"/></template> <template #value><MkTime mode="detail" :time="instance.firstRetrievedAt"/></template>
</MkKeyValue> </MkKeyValue>
<MkKeyValue oneline style="margin: 1em 0;"> <MkKeyValue oneline style="margin: 1em 0;">
<template #key>{{ i18n.ts.updatedAt }}</template> <template #key>{{ i18n.ts.updatedAt }}</template>