π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Move mappers inside separate pkg
Neeraj Gupta342325a56aa1
diff --git a/pkg/mappers.go b/pkg/mapper/photo.gosimilarity index 92%rename from pkg/mappers.gorename to pkg/mapper/photo.goindex 9ac99f3b3e..63617c5adf 100644--- a/pkg/mappers.go+++ b/pkg/mapper/photo.go@@ -1,4 +1,4 @@-package pkg+package mapperimport ("cli-go/internal/api"@@ -12,7 +12,7 @@ import ("log")-func (c *ClICtrl) mapCollectionToAlbum(ctx context.Context, collection api.Collection, holder *secrets.KeyHolder) (*model.RemoteAlbum, error) {+func MapCollectionToAlbum(ctx context.Context, collection api.Collection, holder *secrets.KeyHolder) (*model.RemoteAlbum, error) {var album model.RemoteAlbumuserID := ctx.Value("user_id").(int64)album.OwnerID = collection.Owner.ID@@ -70,7 +70,7 @@ func (c *ClICtrl) mapCollectionToAlbum(ctx context.Context, collection api.Collereturn &album, nil}-func (c *ClICtrl) mapApiFileToPhotoFile(ctx context.Context, album model.RemoteAlbum, file api.File, holder *secrets.KeyHolder) (*model.RemoteFile, error) {+func MapApiFileToPhotoFile(ctx context.Context, album model.RemoteAlbum, file api.File, holder *secrets.KeyHolder) (*model.RemoteFile, error) {if file.IsDeleted {return nil, errors.New("file is deleted")}diff --git a/pkg/remote_sync.go b/pkg/remote_sync.goindex fa0dc6828d..78db914508 100644--- a/pkg/remote_sync.go+++ b/pkg/remote_sync.go@@ -1,6 +1,7 @@package pkgimport (+ "cli-go/pkg/mapper""cli-go/pkg/model""cli-go/utils/encoding""context"@@ -25,7 +26,7 @@ func (c *ClICtrl) fetchRemoteCollections(ctx context.Context) error {if lastSyncTime == 0 && collection.IsDeleted {continue}- album, mapErr := c.mapCollectionToAlbum(ctx, collection, c.KeyHolder)+ album, mapErr := mapper.MapCollectionToAlbum(ctx, collection, c.KeyHolder)if mapErr != nil {return mapErr}@@ -84,7 +85,7 @@ func (c *ClICtrl) fetchRemoteFiles(ctx context.Context) error {// on first sync, no need to sync delete markerscontinue}- photoFile, err := c.mapApiFileToPhotoFile(ctx, album, file, c.KeyHolder)+ photoFile, err := mapper.MapApiFileToPhotoFile(ctx, album, file, c.KeyHolder)if err != nil {return err}