knowyt/server/src/game/removeQuote.go

22 lines
374 B
Go
Raw Normal View History

2021-10-15 21:07:41 +00:00
package game
import (
"fmt"
2021-10-16 14:16:37 +00:00
"sirlab.de/go/knyt/quote"
2021-10-15 21:07:41 +00:00
)
2021-10-16 14:16:37 +00:00
func (gm *Game) RemoveQuote(usrId string, quoteId string) (*quote.Quote, error) {
2021-10-15 21:07:41 +00:00
quote, err := gm.getQuoteById(quoteId)
if err != nil {
2021-10-16 14:16:37 +00:00
return nil, err
2021-10-15 21:07:41 +00:00
}
if quote.GetSourceId() != usrId {
2021-10-16 14:16:37 +00:00
return nil, fmt.Errorf("usrId does not match quote source id")
2021-10-15 21:07:41 +00:00
}
fmt.Printf("%v\n", quote)
2021-10-16 14:16:37 +00:00
return quote, nil
2021-10-15 21:07:41 +00:00
}