27 lines
960 B
Go
27 lines
960 B
Go
package service
|
|
|
|
import (
|
|
"time"
|
|
|
|
roomeventsv1 "hyapp.local/api/proto/events/room/v1"
|
|
"hyapp/services/room-service/internal/room/outbox"
|
|
"hyapp/services/room-service/internal/room/state"
|
|
)
|
|
|
|
// buildMicDownEventForSeat records every non-MicDown release path as the same
|
|
// RoomMicChanged/down fact, so downstream duration consumers never need to infer
|
|
// mic closure from leave/kick/close side effects.
|
|
func buildMicDownEventForSeat(roomID string, roomVersion int64, now time.Time, actorUserID int64, targetUserID int64, seatNo int32, micSessionID string, reason string) (outbox.Record, error) {
|
|
return outbox.Build(roomID, "RoomMicChanged", roomVersion, now, &roomeventsv1.RoomMicChanged{
|
|
ActorUserId: actorUserID,
|
|
TargetUserId: targetUserID,
|
|
FromSeat: seatNo,
|
|
ToSeat: 0,
|
|
Action: "down",
|
|
MicSessionId: micSessionID,
|
|
PublishState: state.MicPublishIdle,
|
|
Reason: reason,
|
|
SeatStatus: state.MicSeatStatusEmpty,
|
|
})
|
|
}
|