feat: impl release hand & next speaker selection
This commit is contained in:
@@ -6,18 +6,20 @@ import (
|
||||
"log"
|
||||
"math/rand"
|
||||
|
||||
"sunshine.industries/some-automoderation/rooms"
|
||||
|
||||
"github.com/redis/go-redis/v9"
|
||||
)
|
||||
|
||||
type SessionData struct {
|
||||
SessionId int `redis:"session_id"`
|
||||
RoomId string `redis:"room_id"`
|
||||
PersonId int `redis:"person_id"`
|
||||
SessionId int `redis:"session_id"`
|
||||
RoomId string `redis:"room_id"`
|
||||
PersonId rooms.PersonId `redis:"person_id"`
|
||||
}
|
||||
|
||||
type SessionManagement interface {
|
||||
Get(sessionId int) SessionData
|
||||
Save(roomName string, personId int) (int, error)
|
||||
Save(roomName string, personId rooms.PersonId) (int, error)
|
||||
}
|
||||
|
||||
var ctx = context.Background()
|
||||
@@ -43,7 +45,7 @@ func (redisSM RedisSM) Get(sessionId int) SessionData {
|
||||
log.Printf("> successfully found %d %+v", sessionId, foundSession)
|
||||
return foundSession
|
||||
}
|
||||
func (redisSM RedisSM) Save(roomName string, personId int) (int, error) {
|
||||
func (redisSM RedisSM) Save(roomName string, personId rooms.PersonId) (int, error) {
|
||||
randId := rand.Int()
|
||||
newSession := SessionData{
|
||||
SessionId: randId,
|
||||
@@ -64,7 +66,7 @@ func (d DummySM) Get(sessionId int) SessionData {
|
||||
log.Printf("get dummy session by %d", sessionId)
|
||||
return SessionData{}
|
||||
}
|
||||
func (d DummySM) Save(roomName string, personId int) (int, error) {
|
||||
func (d DummySM) Save(roomName string, personId rooms.PersonId) (int, error) {
|
||||
log.Printf("save dummy session with %s %d", roomName, personId)
|
||||
return 1, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user