mattermost/model/command_request.go
Doug Lauder 40b7790318
MM-21727 add an endpoint to move a command to another team (#13624)
* 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
2020-01-29 11:56:21 -05:00

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)
}