mirror of
https://github.com/mattermost/mattermost.git
synced 2026-02-03 20:40:00 -05:00
* MM-21727 add an endpoint to move a command to another team * endpoint * mock / client * unit tests * MM-21727 PR feedback, addressed nits * MM-21727 remove CommandMove base route * MM-21272 replace TeamId struct with CommandMoveRequest struct * MM-21727 fixed typo in CommandMoveRequest struct name * MM-21727 return not-found for all getCommandById calls * MM-21727 ensure no command ids leak * when calling GetCommandById with invalid id return not_found * when checking perms to manage commands for team return same not_found * update unit tests to check for not_found * MM-21727 Rename TeamIdFromCommandMoveRequestJson -> CommandMoveRequestFromJson
31 lines
590 B
Go
31 lines
590 B
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
package model
|
|
|
|
import (
|
|
"encoding/json"
|
|
"io"
|
|
)
|
|
|
|
type CommandMoveRequest struct {
|
|
TeamId string `json:"team_id"`
|
|
}
|
|
|
|
func CommandMoveRequestFromJson(data io.Reader) (*CommandMoveRequest, error) {
|
|
decoder := json.NewDecoder(data)
|
|
var cmr CommandMoveRequest
|
|
err := decoder.Decode(&cmr)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &cmr, nil
|
|
}
|
|
|
|
func (cmr *CommandMoveRequest) ToJson() string {
|
|
b, err := json.Marshal(cmr)
|
|
if err != nil {
|
|
return ""
|
|
}
|
|
return string(b)
|
|
}
|