7b43ce5844
Phase 28's in-game mail UI groups personal threads by the other party's race. To support that without an extra membership-listing RPC, the diplomail subsystem now: - accepts `recipient_race_name` on `POST /messages` and `POST /admin` (target=user) as an alternative to `recipient_user_id`; the service resolves it via the existing `Memberships.ListMembers(gameID, "active")` and rejects with `forbidden` when the matching member is no longer active; - snapshots `diplomail_messages.sender_race_name` at send time for every player sender (admin / system rows stay NULL). The UI keys per-race threading on this column. Schema, openapi, README, and a focused e2e test for the new path (happy path + dual / missing / unknown / kicked errors) land in this commit; the gateway + UI legs follow in subsequent commits on this branch. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
118 lines
4.6 KiB
Go
118 lines
4.6 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 DiplomailMessages = newDiplomailMessagesTable("backend", "diplomail_messages", "")
|
|
|
|
type diplomailMessagesTable struct {
|
|
postgres.Table
|
|
|
|
// Columns
|
|
MessageID postgres.ColumnString
|
|
GameID postgres.ColumnString
|
|
GameName postgres.ColumnString
|
|
Kind postgres.ColumnString
|
|
SenderKind postgres.ColumnString
|
|
SenderUserID postgres.ColumnString
|
|
SenderUsername postgres.ColumnString
|
|
SenderRaceName postgres.ColumnString
|
|
SenderIP postgres.ColumnString
|
|
Subject postgres.ColumnString
|
|
Body postgres.ColumnString
|
|
BodyLang postgres.ColumnString
|
|
BroadcastScope postgres.ColumnString
|
|
CreatedAt postgres.ColumnTimestampz
|
|
|
|
AllColumns postgres.ColumnList
|
|
MutableColumns postgres.ColumnList
|
|
DefaultColumns postgres.ColumnList
|
|
}
|
|
|
|
type DiplomailMessagesTable struct {
|
|
diplomailMessagesTable
|
|
|
|
EXCLUDED diplomailMessagesTable
|
|
}
|
|
|
|
// AS creates new DiplomailMessagesTable with assigned alias
|
|
func (a DiplomailMessagesTable) AS(alias string) *DiplomailMessagesTable {
|
|
return newDiplomailMessagesTable(a.SchemaName(), a.TableName(), alias)
|
|
}
|
|
|
|
// Schema creates new DiplomailMessagesTable with assigned schema name
|
|
func (a DiplomailMessagesTable) FromSchema(schemaName string) *DiplomailMessagesTable {
|
|
return newDiplomailMessagesTable(schemaName, a.TableName(), a.Alias())
|
|
}
|
|
|
|
// WithPrefix creates new DiplomailMessagesTable with assigned table prefix
|
|
func (a DiplomailMessagesTable) WithPrefix(prefix string) *DiplomailMessagesTable {
|
|
return newDiplomailMessagesTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
|
}
|
|
|
|
// WithSuffix creates new DiplomailMessagesTable with assigned table suffix
|
|
func (a DiplomailMessagesTable) WithSuffix(suffix string) *DiplomailMessagesTable {
|
|
return newDiplomailMessagesTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
|
}
|
|
|
|
func newDiplomailMessagesTable(schemaName, tableName, alias string) *DiplomailMessagesTable {
|
|
return &DiplomailMessagesTable{
|
|
diplomailMessagesTable: newDiplomailMessagesTableImpl(schemaName, tableName, alias),
|
|
EXCLUDED: newDiplomailMessagesTableImpl("", "excluded", ""),
|
|
}
|
|
}
|
|
|
|
func newDiplomailMessagesTableImpl(schemaName, tableName, alias string) diplomailMessagesTable {
|
|
var (
|
|
MessageIDColumn = postgres.StringColumn("message_id")
|
|
GameIDColumn = postgres.StringColumn("game_id")
|
|
GameNameColumn = postgres.StringColumn("game_name")
|
|
KindColumn = postgres.StringColumn("kind")
|
|
SenderKindColumn = postgres.StringColumn("sender_kind")
|
|
SenderUserIDColumn = postgres.StringColumn("sender_user_id")
|
|
SenderUsernameColumn = postgres.StringColumn("sender_username")
|
|
SenderRaceNameColumn = postgres.StringColumn("sender_race_name")
|
|
SenderIPColumn = postgres.StringColumn("sender_ip")
|
|
SubjectColumn = postgres.StringColumn("subject")
|
|
BodyColumn = postgres.StringColumn("body")
|
|
BodyLangColumn = postgres.StringColumn("body_lang")
|
|
BroadcastScopeColumn = postgres.StringColumn("broadcast_scope")
|
|
CreatedAtColumn = postgres.TimestampzColumn("created_at")
|
|
allColumns = postgres.ColumnList{MessageIDColumn, GameIDColumn, GameNameColumn, KindColumn, SenderKindColumn, SenderUserIDColumn, SenderUsernameColumn, SenderRaceNameColumn, SenderIPColumn, SubjectColumn, BodyColumn, BodyLangColumn, BroadcastScopeColumn, CreatedAtColumn}
|
|
mutableColumns = postgres.ColumnList{GameIDColumn, GameNameColumn, KindColumn, SenderKindColumn, SenderUserIDColumn, SenderUsernameColumn, SenderRaceNameColumn, SenderIPColumn, SubjectColumn, BodyColumn, BodyLangColumn, BroadcastScopeColumn, CreatedAtColumn}
|
|
defaultColumns = postgres.ColumnList{SenderIPColumn, SubjectColumn, BodyLangColumn, BroadcastScopeColumn, CreatedAtColumn}
|
|
)
|
|
|
|
return diplomailMessagesTable{
|
|
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
|
|
|
//Columns
|
|
MessageID: MessageIDColumn,
|
|
GameID: GameIDColumn,
|
|
GameName: GameNameColumn,
|
|
Kind: KindColumn,
|
|
SenderKind: SenderKindColumn,
|
|
SenderUserID: SenderUserIDColumn,
|
|
SenderUsername: SenderUsernameColumn,
|
|
SenderRaceName: SenderRaceNameColumn,
|
|
SenderIP: SenderIPColumn,
|
|
Subject: SubjectColumn,
|
|
Body: BodyColumn,
|
|
BodyLang: BodyLangColumn,
|
|
BroadcastScope: BroadcastScopeColumn,
|
|
CreatedAt: CreatedAtColumn,
|
|
|
|
AllColumns: allColumns,
|
|
MutableColumns: mutableColumns,
|
|
DefaultColumns: defaultColumns,
|
|
}
|
|
}
|