Feat: add example config

This commit is contained in:
Grail Finder
2025-05-22 07:23:18 +03:00
parent ad8f1aaee2
commit 6b750cd34b
8 changed files with 66 additions and 52 deletions

View File

@ -56,10 +56,6 @@ func removeRoom(roomID string) {
}
// context
func getRoomIDFromCtx(ctx context.Context) string {
id, _ := ctx.Value(models.CtxRoomIDKey).(string)
return id
}
func getStateByCtx(ctx context.Context) (*models.UserState, error) {
username, ok := ctx.Value(models.CtxUsernameKey).(string)
@ -74,15 +70,6 @@ func getStateByCtx(ctx context.Context) (*models.UserState, error) {
return us, nil
}
func saveStateByCtx(ctx context.Context, state *models.UserState) error {
username, ok := ctx.Value(models.CtxUsernameKey).(string)
if !ok {
log.Debug("no username in ctx")
return errors.New("no username in ctx")
}
return saveState(username, state)
}
func saveFullInfo(fi *models.FullInfo) error {
// INFO: unfortunately working no transactions; so case are possible where first object is updated but the second is not
if err := saveState(fi.State.Username, fi.State); err != nil {