Skip to content

Commit

Permalink
add room settings to room recreate.
Browse files Browse the repository at this point in the history
  • Loading branch information
m1k1o committed Sep 30, 2023
1 parent 1ede3c2 commit 52dc6ea
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions OpenApi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ paths:
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/RoomSettings'
responses:
'200':
description: OK
Expand Down
8 changes: 8 additions & 0 deletions internal/api/rooms.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package api

import (
"encoding/json"
"errors"
"io"
"net/http"
"strings"

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 52dc6ea

Please sign in to comment.