feat: game lobby service
This commit is contained in:
@@ -62,6 +62,20 @@ type LobbyMembershipRejectedPayload struct {
|
||||
GameName string `json:"game_name"`
|
||||
}
|
||||
|
||||
// LobbyMembershipBlockedPayload stores the normalized payload for
|
||||
// `lobby.membership.blocked` published by the user-lifecycle cascade
|
||||
// when an active membership is blocked because the underlying user was
|
||||
// permanently blocked or deleted.
|
||||
type LobbyMembershipBlockedPayload struct {
|
||||
GameID string `json:"game_id"`
|
||||
GameName string `json:"game_name"`
|
||||
MembershipUserID string `json:"membership_user_id"`
|
||||
MembershipUserName string `json:"membership_user_name"`
|
||||
// Reason captures the upstream lifecycle event that triggered the
|
||||
// cascade. Frozen vocabulary: `permanent_blocked`, `deleted`.
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
|
||||
// LobbyInviteCreatedPayload stores the normalized payload for
|
||||
// `lobby.invite.created`.
|
||||
type LobbyInviteCreatedPayload struct {
|
||||
@@ -89,6 +103,30 @@ type LobbyInviteExpiredPayload struct {
|
||||
InviteeName string `json:"invitee_name"`
|
||||
}
|
||||
|
||||
// LobbyRaceNameRegistrationEligiblePayload stores the normalized payload
|
||||
// for `lobby.race_name.registration_eligible`.
|
||||
type LobbyRaceNameRegistrationEligiblePayload struct {
|
||||
GameID string `json:"game_id"`
|
||||
GameName string `json:"game_name"`
|
||||
RaceName string `json:"race_name"`
|
||||
EligibleUntilMs int64 `json:"eligible_until_ms"`
|
||||
}
|
||||
|
||||
// LobbyRaceNameRegisteredPayload stores the normalized payload for
|
||||
// `lobby.race_name.registered`.
|
||||
type LobbyRaceNameRegisteredPayload struct {
|
||||
RaceName string `json:"race_name"`
|
||||
}
|
||||
|
||||
// LobbyRaceNameRegistrationDeniedPayload stores the normalized payload for
|
||||
// `lobby.race_name.registration_denied`.
|
||||
type LobbyRaceNameRegistrationDeniedPayload struct {
|
||||
GameID string `json:"game_id"`
|
||||
GameName string `json:"game_name"`
|
||||
RaceName string `json:"race_name"`
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
|
||||
// NewGeoReviewRecommendedIntent builds the admin-email intent published by Geo
|
||||
// Profile Service when a user becomes review-worthy.
|
||||
func NewGeoReviewRecommendedIntent(metadata Metadata, payload GeoReviewRecommendedPayload) (Intent, error) {
|
||||
@@ -143,6 +181,14 @@ func NewLobbyMembershipRejectedIntent(metadata Metadata, applicantUserID string,
|
||||
return newIntent(NotificationTypeLobbyMembershipRejected, ProducerGameLobby, AudienceKindUser, []string{applicantUserID}, metadata, payload)
|
||||
}
|
||||
|
||||
// NewLobbyMembershipBlockedIntent builds the private-game owner intent
|
||||
// published by Game Lobby when an active membership is blocked by the
|
||||
// user-lifecycle cascade. ownerUserID is the recipient (private-game
|
||||
// owner whose roster lost the affected member).
|
||||
func NewLobbyMembershipBlockedIntent(metadata Metadata, ownerUserID string, payload LobbyMembershipBlockedPayload) (Intent, error) {
|
||||
return newIntent(NotificationTypeLobbyMembershipBlocked, ProducerGameLobby, AudienceKindUser, []string{ownerUserID}, metadata, payload)
|
||||
}
|
||||
|
||||
// NewLobbyInviteCreatedIntent builds the invited-user intent published by Game
|
||||
// Lobby when a private-game invite is created.
|
||||
func NewLobbyInviteCreatedIntent(metadata Metadata, invitedUserID string, payload LobbyInviteCreatedPayload) (Intent, error) {
|
||||
@@ -160,3 +206,23 @@ func NewLobbyInviteRedeemedIntent(metadata Metadata, ownerUserID string, payload
|
||||
func NewLobbyInviteExpiredIntent(metadata Metadata, ownerUserID string, payload LobbyInviteExpiredPayload) (Intent, error) {
|
||||
return newIntent(NotificationTypeLobbyInviteExpired, ProducerGameLobby, AudienceKindUser, []string{ownerUserID}, metadata, payload)
|
||||
}
|
||||
|
||||
// NewLobbyRaceNameRegistrationEligibleIntent builds the capable-member intent
|
||||
// published by Game Lobby at game finish when a reservation is promoted to
|
||||
// `pending_registration`.
|
||||
func NewLobbyRaceNameRegistrationEligibleIntent(metadata Metadata, recipientUserID string, payload LobbyRaceNameRegistrationEligiblePayload) (Intent, error) {
|
||||
return newIntent(NotificationTypeLobbyRaceNameRegistrationEligible, ProducerGameLobby, AudienceKindUser, []string{recipientUserID}, metadata, payload)
|
||||
}
|
||||
|
||||
// NewLobbyRaceNameRegisteredIntent builds the registering-user intent
|
||||
// published by Game Lobby on successful `lobby.race_name.register` commit.
|
||||
func NewLobbyRaceNameRegisteredIntent(metadata Metadata, recipientUserID string, payload LobbyRaceNameRegisteredPayload) (Intent, error) {
|
||||
return newIntent(NotificationTypeLobbyRaceNameRegistered, ProducerGameLobby, AudienceKindUser, []string{recipientUserID}, metadata, payload)
|
||||
}
|
||||
|
||||
// NewLobbyRaceNameRegistrationDeniedIntent builds the incapable-member intent
|
||||
// published by Game Lobby at game finish when a reservation is released
|
||||
// without a pending-registration window.
|
||||
func NewLobbyRaceNameRegistrationDeniedIntent(metadata Metadata, recipientUserID string, payload LobbyRaceNameRegistrationDeniedPayload) (Intent, error) {
|
||||
return newIntent(NotificationTypeLobbyRaceNameRegistrationDenied, ProducerGameLobby, AudienceKindUser, []string{recipientUserID}, metadata, payload)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user