add room settings to room recreate.

This commit is contained in:
Miroslav Šedivý
2023-09-30 22:59:28 +02:00
parent 1ede3c2c32
commit 52dc6eaea8
2 changed files with 13 additions and 0 deletions
+5
View File
@@ -218,6 +218,11 @@ paths:
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/RoomSettings'
responses:
'200':
description: OK
+8
View File
@@ -2,6 +2,8 @@ package api
import (
"encoding/json"
"errors"
"io"
"net/http"
"strings"
@@ -84,6 +86,12 @@ func (manager *ApiManagerCtx) roomRecreate(w http.ResponseWriter, r *http.Reques
return
}
// optional settings payload
if err := json.NewDecoder(r.Body).Decode(&settings); err != nil && !errors.Is(err, io.EOF) {
http.Error(w, err.Error(), 400)
return
}
if err := manager.rooms.Remove(roomId); err != nil {
http.Error(w, err.Error(), 500)
return