diff --git a/app/migrator/disqus.go b/app/migrator/disqus.go index 7eeafd83..ded23bd4 100644 --- a/app/migrator/disqus.go +++ b/app/migrator/disqus.go @@ -10,12 +10,11 @@ import ( "github.com/pkg/errors" "github.com/umputun/remark/app/store" - "github.com/umputun/remark/app/store/service" ) // Disqus implements Importer from disqus xml type Disqus struct { - DataStore *service.DataStore + DataStore Store } type disqusThread struct { diff --git a/app/migrator/migrator.go b/app/migrator/migrator.go index 4ed884d7..a115cbee 100644 --- a/app/migrator/migrator.go +++ b/app/migrator/migrator.go @@ -9,8 +9,7 @@ import ( "os" "github.com/pkg/errors" - - "github.com/umputun/remark/app/store/service" + "github.com/umputun/remark/app/store" ) // Importer defines interface to convert posts from external sources @@ -23,9 +22,17 @@ type Exporter interface { Export(w io.Writer, siteID string) (int, error) } +// Store defines minimal interface needed to export and import comments +type Store interface { + Create(comment store.Comment) (commentID string, err error) + Find(locator store.Locator, sort string) ([]store.Comment, error) + List(siteID string, limit int, skip int) ([]store.PostInfo, error) + DeleteAll(siteID string) error +} + // ImportParams defines everything needed to run import type ImportParams struct { - DataStore *service.DataStore + DataStore Store InputFile string Provider string SiteID string diff --git a/app/migrator/remark.go b/app/migrator/remark.go index 33dde2b5..3410fea9 100644 --- a/app/migrator/remark.go +++ b/app/migrator/remark.go @@ -8,14 +8,12 @@ import ( "log" "github.com/pkg/errors" - "github.com/umputun/remark/app/store/service" - "github.com/umputun/remark/app/store" ) // Remark implements exporter and importer for internal store format type Remark struct { - DataStore *service.DataStore + DataStore Store } // Export all comments to writer as json strings. Each comment is one string, separated by "\n"