2021-01-13 00:35:30 +01:00
|
|
|
package app
|
|
|
|
|
|
|
|
import (
|
|
|
|
"database/sql"
|
2021-06-21 11:21:42 +02:00
|
|
|
"errors"
|
2021-01-13 00:35:30 +01:00
|
|
|
|
2021-01-26 23:13:46 +01:00
|
|
|
"github.com/mattermost/focalboard/server/model"
|
2021-03-26 19:01:54 +01:00
|
|
|
"github.com/mattermost/focalboard/server/services/store"
|
2021-01-13 00:35:30 +01:00
|
|
|
)
|
|
|
|
|
2021-03-26 19:01:54 +01:00
|
|
|
func (a *App) GetSharing(c store.Container, rootID string) (*model.Sharing, error) {
|
|
|
|
sharing, err := a.store.GetSharing(c, rootID)
|
2021-06-21 11:21:42 +02:00
|
|
|
if errors.Is(err, sql.ErrNoRows) {
|
2021-01-13 00:35:30 +01:00
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return sharing, nil
|
|
|
|
}
|
|
|
|
|
2021-03-26 19:01:54 +01:00
|
|
|
func (a *App) UpsertSharing(c store.Container, sharing model.Sharing) error {
|
|
|
|
return a.store.UpsertSharing(c, sharing)
|
2021-01-13 00:35:30 +01:00
|
|
|
}
|