misskey/packages/backend/src/models/Instance.ts
anatawa12 83a9aa4533
feat: suspend instance improvements (#13861)
* feat(backend): dead instance detection

* feat(backend): suspend type detection

* feat(frontend): show suspend reason on frontend

* feat(backend): resume federation automatically if the server is automatically suspended

* docs(changelog): 配信停止まわりの改善

* lint: fix lint errors

* Update packages/frontend/src/pages/instance-info.vue

* lint: fix lint error

* chore: suspendedState => suspensionState

---------

Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-05-23 15:55:47 +09:00

162 lines
3.2 KiB
TypeScript

/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { Entity, PrimaryColumn, Index, Column } from 'typeorm';
import { id } from './util/id.js';
@Entity('instance')
export class MiInstance {
@PrimaryColumn(id())
public id: string;
/**
* このインスタンスを捕捉した日時
*/
@Index()
@Column('timestamp with time zone', {
comment: 'The caught date of the Instance.',
})
public firstRetrievedAt: Date;
/**
* ホスト
*/
@Index({ unique: true })
@Column('varchar', {
length: 128,
comment: 'The host of the Instance.',
})
public host: string;
/**
* インスタンスのユーザー数
*/
@Column('integer', {
default: 0,
comment: 'The count of the users of the Instance.',
})
public usersCount: number;
/**
* インスタンスの投稿数
*/
@Column('integer', {
default: 0,
comment: 'The count of the notes of the Instance.',
})
public notesCount: number;
/**
* このインスタンスのユーザーからフォローされている、自インスタンスのユーザーの数
*/
@Column('integer', {
default: 0,
})
public followingCount: number;
/**
* このインスタンスのユーザーをフォローしている、自インスタンスのユーザーの数
*/
@Column('integer', {
default: 0,
})
public followersCount: number;
/**
* 直近のリクエスト受信日時
*/
@Column('timestamp with time zone', {
nullable: true,
})
public latestRequestReceivedAt: Date | null;
/**
* このインスタンスと不通かどうか
*/
@Column('boolean', {
default: false,
})
public isNotResponding: boolean;
/**
* このインスタンスと不通になった日時
*/
@Column('timestamp with time zone', {
nullable: true,
})
public notRespondingSince: Date | null;
/**
* このインスタンスへの配信状態
*/
@Index()
@Column('enum', {
default: 'none',
enum: ['none', 'manuallySuspended', 'goneSuspended', 'autoSuspendedForNotResponding'],
})
public suspensionState: 'none' | 'manuallySuspended' | 'goneSuspended' | 'autoSuspendedForNotResponding';
@Column('varchar', {
length: 64, nullable: true,
comment: 'The software of the Instance.',
})
public softwareName: string | null;
@Column('varchar', {
length: 64, nullable: true,
})
public softwareVersion: string | null;
@Column('boolean', {
nullable: true,
})
public openRegistrations: boolean | null;
@Column('varchar', {
length: 256, nullable: true,
})
public name: string | null;
@Column('varchar', {
length: 4096, nullable: true,
})
public description: string | null;
@Column('varchar', {
length: 128, nullable: true,
})
public maintainerName: string | null;
@Column('varchar', {
length: 256, nullable: true,
})
public maintainerEmail: string | null;
@Column('varchar', {
length: 256, nullable: true,
})
public iconUrl: string | null;
@Column('varchar', {
length: 256, nullable: true,
})
public faviconUrl: string | null;
@Column('varchar', {
length: 64, nullable: true,
})
public themeColor: string | null;
@Column('timestamp with time zone', {
nullable: true,
})
public infoUpdatedAt: Date | null;
@Column('varchar', {
length: 16384, default: '',
})
public moderationNote: string;
}