mongodb/adapter: implement DestroyTable

This commit is contained in:
Iris Lightshard 2022-11-11 20:59:56 -07:00
parent 11d6463f62
commit 07d797e1df
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398

View file

@ -99,6 +99,26 @@ func (self *DbEngine) CreateTable(table models.TableKey) error {
}
func (self *DbEngine) DestroyTable(table models.TableKey) error {
tables := self.db.Collection("tables")
if tables != nil {
_, err := tables.DeleteOne(self.mkCtx(10), bson.D{
{"name", table.Name},
{"passcode", table.Passcode},
})
return err
}
return errors.New(fmt.Sprintf(errNoCollection, "tables"))
}
func (self *DbEngine) InsertDiceRoll(table models.TableKey, diceRoll models.DiceRoll) error {
return errors.New(fmt.Sprintf(errNoCollections, "tables"))
}
func (self *DbEngine) GetDiceRolls(table models.TableKey) ([]models.DiceRoll, error) {
return []models.DiceRoll{}, nil
}
func (self *DbEngine) SetMapImageUrl(table models.TableKey, url string) error {
tables := self.db.Collection("tables")
if tables != nil {
@ -142,3 +162,18 @@ func (self *DbEngine) GetMapImageUrl(table models.TableKey) (string, error) {
return "", errors.New(fmt.Sprintf(errNoCollection, "tables"))
}
func (self *DbEngine) AddToken(table models.TableKey, token models.Token) error {
return nil
}
func (self *DbEngine) RemoveToken(table models.TableKey, tokenId string) error {
return nil
}
func (self *DbEngine) ModifyToken(table models.TableKey, token models.Token) error {
return nil
}
func (self *DbEngine) GetTokens(table models.TableKey) ([]models.Token, error) {
return []models.Token{}, nil
}