@@ -40,19 +40,18 @@ func (r *Repository) AddParticipantToRoomState(room *livekit.Room, participant *
4040 if roomState .RoomID .String () == room .Name {
4141 t := time .Unix (participant .JoinedAt , 0 ).In (time .FixedZone ("Asia/Tokyo" , 9 * 60 * 60 ))
4242 r .RoomState [i ].Participants = append (r .RoomState [i ].Participants , Participant {
43- Identity : & participant .Identity ,
44- JoinedAt : & t ,
45- Name : & participant .Name ,
43+ Identity : participant .Identity ,
44+ JoinedAt : t ,
45+ Name : participant .Name ,
4646 Attributes : & participant .Attributes ,
47- CanPublish : & participant .Permission .CanPublish ,
47+ CanPublish : participant .Permission .CanPublish ,
4848 })
4949
5050 if r .Hub != nil {
5151 r .Hub .Publish (hub.Message {
5252 Name : event .QallRoomStateChanged ,
5353 Fields : hub.Fields {
54- "room_id" : roomState .RoomID ,
55- "state" : & r .RoomState [i ],
54+ "roomState" : r .RoomState ,
5655 },
5756 })
5857 }
@@ -67,15 +66,14 @@ func (r *Repository) UpdateParticipantCanPublish(roomID string, participantID st
6766 for i , roomState := range r .RoomState {
6867 if roomState .RoomID .String () == roomID {
6968 for j , participant := range roomState .Participants {
70- if * participant .Identity == participantID {
71- r .RoomState [i ].Participants [j ].CanPublish = & canPublish
69+ if participant .Identity == participantID {
70+ r .RoomState [i ].Participants [j ].CanPublish = canPublish
7271
7372 if r .Hub != nil {
7473 r .Hub .Publish (hub.Message {
7574 Name : event .QallRoomStateChanged ,
7675 Fields : hub.Fields {
77- "room_id" : roomState .RoomID ,
78- "state" : & r .RoomState [i ],
76+ "roomState" : r .RoomState ,
7977 },
8078 })
8179 }
@@ -93,22 +91,21 @@ func (r *Repository) UpdateParticipant(roomID string, participant *livekit.Parti
9391 for i , roomState := range r .RoomState {
9492 if roomState .RoomID .String () == roomID {
9593 for j , p := range roomState .Participants {
96- if * p .Identity == participant .Identity {
94+ if p .Identity == participant .Identity {
9795 t := time .Unix (participant .JoinedAt , 0 ).In (time .FixedZone ("Asia/Tokyo" , 9 * 60 * 60 ))
9896 r .RoomState [i ].Participants [j ] = Participant {
99- Identity : & participant .Identity ,
100- JoinedAt : & t ,
101- Name : & participant .Name ,
97+ Identity : participant .Identity ,
98+ JoinedAt : t ,
99+ Name : participant .Name ,
102100 Attributes : & participant .Attributes ,
103- CanPublish : & participant .Permission .CanPublish ,
101+ CanPublish : participant .Permission .CanPublish ,
104102 }
105103
106104 if r .Hub != nil {
107105 r .Hub .Publish (hub.Message {
108106 Name : event .QallRoomStateChanged ,
109107 Fields : hub.Fields {
110- "room_id" : roomState .RoomID ,
111- "state" : & r .RoomState [i ],
108+ "roomState" : r .RoomState ,
112109 },
113110 })
114111 }
@@ -126,15 +123,14 @@ func (r *Repository) RemoveParticipant(roomID string, participantID string) {
126123 for i , roomState := range r .RoomState {
127124 if roomState .RoomID .String () == roomID {
128125 for j , participant := range roomState .Participants {
129- if * participant .Identity == participantID {
126+ if participant .Identity == participantID {
130127 r .RoomState [i ].Participants = slices .Delete (r .RoomState [i ].Participants , j , j + 1 )
131128
132129 if r .Hub != nil {
133130 r .Hub .Publish (hub.Message {
134131 Name : event .QallRoomStateChanged ,
135132 Fields : hub.Fields {
136- "room_id" : roomState .RoomID ,
137- "state" : & r .RoomState [i ],
133+ "roomState" : r .RoomState ,
138134 },
139135 })
140136 }
@@ -165,8 +161,7 @@ func (r *Repository) AddRoomState(room RoomWithParticipants) {
165161 r .Hub .Publish (hub.Message {
166162 Name : event .QallRoomStateChanged ,
167163 Fields : hub.Fields {
168- "room_id" : room .RoomID ,
169- "state" : & room ,
164+ "roomState" : r .RoomState ,
170165 },
171166 })
172167 }
@@ -182,8 +177,7 @@ func (r *Repository) UpdateRoomMetadata(roomID string, metadata Metadata) {
182177 r .Hub .Publish (hub.Message {
183178 Name : event .QallRoomStateChanged ,
184179 Fields : hub.Fields {
185- "room_id" : roomState .RoomID ,
186- "state" : & r .RoomState [i ],
180+ "roomState" : r .RoomState ,
187181 },
188182 })
189183 }
@@ -200,16 +194,12 @@ func (r *Repository) RemoveRoomState(roomID string) {
200194 r .RoomState = append (r .RoomState [:i ], r .RoomState [i + 1 :]... )
201195
202196 if r .Hub != nil {
203- roomUUID , err := uuid .FromString (roomID )
204- if err == nil {
205- r .Hub .Publish (hub.Message {
206- Name : event .QallRoomStateChanged ,
207- Fields : hub.Fields {
208- "room_id" : roomUUID ,
209- "state" : nil ,
210- },
211- })
212- }
197+ r .Hub .Publish (hub.Message {
198+ Name : event .QallRoomStateChanged ,
199+ Fields : hub.Fields {
200+ "roomState" : r .RoomState ,
201+ },
202+ })
213203 }
214204
215205 break
@@ -254,9 +244,9 @@ func (r *Repository) GetRoomsWithParticipantsByLiveKitServer(ctx context.Context
254244 for _ , p := range partResp .Participants {
255245 t := time .Unix (p .JoinedAt , 0 ).In (time .FixedZone ("Asia/Tokyo" , 9 * 60 * 60 ))
256246 Participants = append (Participants , Participant {
257- Identity : & p .Identity ,
258- JoinedAt : & t ,
259- Name : & p .Name ,
247+ Identity : p .Identity ,
248+ JoinedAt : t ,
249+ Name : p .Name ,
260250 Attributes : & p .Attributes ,
261251 })
262252 }
@@ -275,7 +265,7 @@ func (r *Repository) GetRoomsWithParticipantsByLiveKitServer(ctx context.Context
275265
276266 roomWithParticipants = append (roomWithParticipants , RoomWithParticipants {
277267 Metadata : & metadata .Status ,
278- IsWebinar : & metadata .IsWebinar ,
268+ IsWebinar : metadata .IsWebinar ,
279269 RoomID : roomID ,
280270 Participants : Participants ,
281271 })
0 commit comments