feat(contracts): site center schemas, endpoints and migration 0031

Site health/proxy, SiteAccount login state (challenge, lastLoginAt, lastError,
userData), SiteUserData history table, SiteCredentialsBody by kind,
refresh-login/health-check/user-data/delete endpoints, SitesSettings defaults.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-09-28 14:40:07 +08:00
1 parent 381791cd64
commit e2d1e21968
7 files changed
+458 -31

No files matched your search

+39 -1
View File
@@ -228,7 +228,7 @@ export type SiteAdapter = "nexusphp" | "mteam_api" | "api" | "generic_rss";
export type SiteHealthStatus = "unknown" | "healthy" | "degraded" | "failing" | "disabled";
export type SiteCircuitState = "closed" | "open" | "half_open";
export type SiteAccountAuthKind = "cookie" | "passkey" | "api_key" | "password";
export type SiteAccountStatus = "unknown" | "active" | "invalid" | "expired";
export type SiteAccountStatus = "unknown" | "active" | "invalid" | "expired" | "challenge";
export type SiteSnapshotKind = "periodic" | "backfill" | "live_search" | "manual";
export type SiteSnapshotStatus = "running" | "ok" | "partial" | "failed";
export type SourceReleaseResolutionStatus = "unresolved" | "resolved" | "ambiguous" | "unidentifiable" | "rejected";
@@ -1208,6 +1208,10 @@ export interface SiteTable {
snapshot_cursor: Generated<Json>;
created_at: GeneratedTimestamptz;
updated_at: GeneratedTimestamptz;
last_health: Json | null;
last_health_at: Timestamptz | null;
proxy: Generated<boolean>;
deleted_at: Timestamptz | null;
}
export interface SiteAccountTable {
@@ -1222,6 +1226,15 @@ export interface SiteAccountTable {
user_info: Generated<Json>;
created_at: GeneratedTimestamptz;
updated_at: GeneratedTimestamptz;
login_name: string | null;
totp_secret_ref: string | null;
session_secret_ref: string | null;
passkey_secret_ref: string | null;
user_agent: string | null;
last_login_at: Timestamptz | null;
last_error: Json | null;
user_data: Json | null;
user_data_at: Timestamptz | null;
}
export interface SiteSnapshotTable {
@@ -1242,6 +1255,27 @@ export interface SiteSnapshotTable {
updated_at: GeneratedTimestamptz;
}
export interface SiteUserDataTable {
id: Generated<string>;
site_account_id: string;
day: string;
upload: Generated<number>;
download: Generated<number>;
ratio: number | null;
bonus: number | null;
seeding: Generated<number>;
seeding_size: Generated<number>;
leeching: Generated<number>;
user_level: string | null;
vip: boolean | null;
message_unread: Generated<number>;
join_at: string | null;
raw: Generated<Json>;
captured_at: GeneratedTimestamptz;
created_at: GeneratedTimestamptz;
updated_at: GeneratedTimestamptz;
}
export interface SlotDeferralTable {
id: Generated<string>;
slot_id: string;
@@ -1489,6 +1523,7 @@ export interface DB {
site: SiteTable;
site_account: SiteAccountTable;
site_snapshot: SiteSnapshotTable;
site_user_data: SiteUserDataTable;
slot_deferral: SlotDeferralTable;
slot_unit: SlotUnitTable;
source_release: SourceReleaseTable;
@@ -1671,6 +1706,9 @@ export type SiteAccountUpdate = Updateable<SiteAccountTable>;
export type SiteSnapshotRow = Selectable<SiteSnapshotTable>;
export type NewSiteSnapshot = Insertable<SiteSnapshotTable>;
export type SiteSnapshotUpdate = Updateable<SiteSnapshotTable>;
export type SiteUserDataRow = Selectable<SiteUserDataTable>;
export type NewSiteUserData = Insertable<SiteUserDataTable>;
export type SiteUserDataUpdate = Updateable<SiteUserDataTable>;
export type SlotDeferralRow = Selectable<SlotDeferralTable>;
export type NewSlotDeferral = Insertable<SlotDeferralTable>;
export type SlotDeferralUpdate = Updateable<SlotDeferralTable>;