ab58062565
- accounts.flagged_high_rate_at baked into the R1 baseline (no prod data; the contour schema is wiped after merge); jet regenerated — the regen also picks up the previously missing game_drafts/game_hidden models. - account.Store: FlagHighRate (set-once), ClearHighRateFlag, the flag in GetByID/ListUsers and a ListFlaggedHighRate review queue. - New internal/ratewatch: ingests the gateway rejection reports, keeps a bounded in-memory episode window for the console and applies the conservative auto-flag (1000 rejected / 10 min, BACKEND_HIGHRATE_FLAG_*). - POST /api/v1/internal/ratelimit/report (network-trusted, like sessions/resolve). - Admin console: Throttled page (episodes + flagged accounts), a high-rate badge in the user list, the marker + operator clear action on the user card. - Tests: ratewatch unit suite, report-route handler test, renderer cases, integration coverage for the store round-trip and the console flow.
130 lines
5.8 KiB
Go
130 lines
5.8 KiB
Go
//
|
|
// Code generated by go-jet DO NOT EDIT.
|
|
//
|
|
// WARNING: Changes to this file may cause incorrect behavior
|
|
// and will be lost if the code is regenerated
|
|
//
|
|
|
|
package table
|
|
|
|
import (
|
|
"github.com/go-jet/jet/v2/postgres"
|
|
)
|
|
|
|
var Accounts = newAccountsTable("backend", "accounts", "")
|
|
|
|
type accountsTable struct {
|
|
postgres.Table
|
|
|
|
// Columns
|
|
AccountID postgres.ColumnString
|
|
DisplayName postgres.ColumnString
|
|
PreferredLanguage postgres.ColumnString
|
|
TimeZone postgres.ColumnString
|
|
BlockChat postgres.ColumnBool
|
|
BlockFriendRequests postgres.ColumnBool
|
|
CreatedAt postgres.ColumnTimestampz
|
|
UpdatedAt postgres.ColumnTimestampz
|
|
AwayStart postgres.ColumnTime
|
|
AwayEnd postgres.ColumnTime
|
|
HintBalance postgres.ColumnInteger
|
|
IsGuest postgres.ColumnBool
|
|
NotificationsInAppOnly postgres.ColumnBool
|
|
PaidAccount postgres.ColumnBool
|
|
MergedInto postgres.ColumnString
|
|
MergedAt postgres.ColumnTimestampz
|
|
ServiceLanguage postgres.ColumnString
|
|
FlaggedHighRateAt postgres.ColumnTimestampz
|
|
|
|
AllColumns postgres.ColumnList
|
|
MutableColumns postgres.ColumnList
|
|
DefaultColumns postgres.ColumnList
|
|
}
|
|
|
|
type AccountsTable struct {
|
|
accountsTable
|
|
|
|
EXCLUDED accountsTable
|
|
}
|
|
|
|
// AS creates new AccountsTable with assigned alias
|
|
func (a AccountsTable) AS(alias string) *AccountsTable {
|
|
return newAccountsTable(a.SchemaName(), a.TableName(), alias)
|
|
}
|
|
|
|
// Schema creates new AccountsTable with assigned schema name
|
|
func (a AccountsTable) FromSchema(schemaName string) *AccountsTable {
|
|
return newAccountsTable(schemaName, a.TableName(), a.Alias())
|
|
}
|
|
|
|
// WithPrefix creates new AccountsTable with assigned table prefix
|
|
func (a AccountsTable) WithPrefix(prefix string) *AccountsTable {
|
|
return newAccountsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
|
}
|
|
|
|
// WithSuffix creates new AccountsTable with assigned table suffix
|
|
func (a AccountsTable) WithSuffix(suffix string) *AccountsTable {
|
|
return newAccountsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
|
}
|
|
|
|
func newAccountsTable(schemaName, tableName, alias string) *AccountsTable {
|
|
return &AccountsTable{
|
|
accountsTable: newAccountsTableImpl(schemaName, tableName, alias),
|
|
EXCLUDED: newAccountsTableImpl("", "excluded", ""),
|
|
}
|
|
}
|
|
|
|
func newAccountsTableImpl(schemaName, tableName, alias string) accountsTable {
|
|
var (
|
|
AccountIDColumn = postgres.StringColumn("account_id")
|
|
DisplayNameColumn = postgres.StringColumn("display_name")
|
|
PreferredLanguageColumn = postgres.StringColumn("preferred_language")
|
|
TimeZoneColumn = postgres.StringColumn("time_zone")
|
|
BlockChatColumn = postgres.BoolColumn("block_chat")
|
|
BlockFriendRequestsColumn = postgres.BoolColumn("block_friend_requests")
|
|
CreatedAtColumn = postgres.TimestampzColumn("created_at")
|
|
UpdatedAtColumn = postgres.TimestampzColumn("updated_at")
|
|
AwayStartColumn = postgres.TimeColumn("away_start")
|
|
AwayEndColumn = postgres.TimeColumn("away_end")
|
|
HintBalanceColumn = postgres.IntegerColumn("hint_balance")
|
|
IsGuestColumn = postgres.BoolColumn("is_guest")
|
|
NotificationsInAppOnlyColumn = postgres.BoolColumn("notifications_in_app_only")
|
|
PaidAccountColumn = postgres.BoolColumn("paid_account")
|
|
MergedIntoColumn = postgres.StringColumn("merged_into")
|
|
MergedAtColumn = postgres.TimestampzColumn("merged_at")
|
|
ServiceLanguageColumn = postgres.StringColumn("service_language")
|
|
FlaggedHighRateAtColumn = postgres.TimestampzColumn("flagged_high_rate_at")
|
|
allColumns = postgres.ColumnList{AccountIDColumn, DisplayNameColumn, PreferredLanguageColumn, TimeZoneColumn, BlockChatColumn, BlockFriendRequestsColumn, CreatedAtColumn, UpdatedAtColumn, AwayStartColumn, AwayEndColumn, HintBalanceColumn, IsGuestColumn, NotificationsInAppOnlyColumn, PaidAccountColumn, MergedIntoColumn, MergedAtColumn, ServiceLanguageColumn, FlaggedHighRateAtColumn}
|
|
mutableColumns = postgres.ColumnList{DisplayNameColumn, PreferredLanguageColumn, TimeZoneColumn, BlockChatColumn, BlockFriendRequestsColumn, CreatedAtColumn, UpdatedAtColumn, AwayStartColumn, AwayEndColumn, HintBalanceColumn, IsGuestColumn, NotificationsInAppOnlyColumn, PaidAccountColumn, MergedIntoColumn, MergedAtColumn, ServiceLanguageColumn, FlaggedHighRateAtColumn}
|
|
defaultColumns = postgres.ColumnList{DisplayNameColumn, PreferredLanguageColumn, TimeZoneColumn, BlockChatColumn, BlockFriendRequestsColumn, CreatedAtColumn, UpdatedAtColumn, AwayStartColumn, AwayEndColumn, HintBalanceColumn, IsGuestColumn, NotificationsInAppOnlyColumn, PaidAccountColumn}
|
|
)
|
|
|
|
return accountsTable{
|
|
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
|
|
|
//Columns
|
|
AccountID: AccountIDColumn,
|
|
DisplayName: DisplayNameColumn,
|
|
PreferredLanguage: PreferredLanguageColumn,
|
|
TimeZone: TimeZoneColumn,
|
|
BlockChat: BlockChatColumn,
|
|
BlockFriendRequests: BlockFriendRequestsColumn,
|
|
CreatedAt: CreatedAtColumn,
|
|
UpdatedAt: UpdatedAtColumn,
|
|
AwayStart: AwayStartColumn,
|
|
AwayEnd: AwayEndColumn,
|
|
HintBalance: HintBalanceColumn,
|
|
IsGuest: IsGuestColumn,
|
|
NotificationsInAppOnly: NotificationsInAppOnlyColumn,
|
|
PaidAccount: PaidAccountColumn,
|
|
MergedInto: MergedIntoColumn,
|
|
MergedAt: MergedAtColumn,
|
|
ServiceLanguage: ServiceLanguageColumn,
|
|
FlaggedHighRateAt: FlaggedHighRateAtColumn,
|
|
|
|
AllColumns: allColumns,
|
|
MutableColumns: mutableColumns,
|
|
DefaultColumns: defaultColumns,
|
|
}
|
|
}
|