Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

move refactor

Neeraj Guptab9b239c2074c
diff --git a/server/cmd/museum/main.go b/server/cmd/museum/main.go
index 7070b8af61..45a37be1e2 100644
--- a/server/cmd/museum/main.go
+++ b/server/cmd/museum/main.go
@@ -6,6 +6,7 @@ import (
b64 "encoding/base64"
"fmt"
"github.com/ente-io/museum/pkg/controller/collections"
+ "github.com/ente-io/museum/pkg/repo/public"
"net/http"
"os"
"os/signal"
@@ -176,7 +177,7 @@ func main() {
fileDataRepo := &fileDataRepo.Repository{DB: db, ObjectCleanupRepo: objectCleanupRepo}
familyRepo := &repo.FamilyRepository{DB: db}
trashRepo := &repo.TrashRepository{DB: db, ObjectRepo: objectRepo, FileRepo: fileRepo, QueueRepo: queueRepo}
- publicCollectionRepo := repo.NewPublicCollectionRepository(db, viper.GetString("apps.public-albums"))
+ publicCollectionRepo := public.NewPublicCollectionRepository(db, viper.GetString("apps.public-albums"))
collectionRepo := &repo.CollectionRepository{DB: db, FileRepo: fileRepo, PublicCollectionRepo: publicCollectionRepo,
TrashRepo: trashRepo, SecretEncryptionKey: secretEncryptionKeyBytes, QueueRepo: queueRepo, LatencyLogger: latencyLogger}
pushRepo := &repo.PushTokenRepository{DB: db}
@@ -898,7 +899,7 @@ func setupAndStartBackgroundJobs(
objectCleanupController.StartClearingOrphanObjects()
}
-func setupAndStartCrons(userAuthRepo *repo.UserAuthRepository, publicCollectionRepo *repo.PublicCollectionRepository,
+func setupAndStartCrons(userAuthRepo *repo.UserAuthRepository, publicCollectionRepo *public.PublicCollectionRepository,
twoFactorRepo *repo.TwoFactorRepository, passkeysRepo *passkey.Repository, fileController *controller.FileController,
taskRepo *repo.TaskLockRepository, emailNotificationCtrl *email.EmailNotificationController,
trashController *controller.TrashController, pushController *controller.PushController,
diff --git a/server/migrations/99_single_file_url.down.sql b/server/migrations/99_single_file_url.down.sql
index 30e2211701..f2955333c7 100644
--- a/server/migrations/99_single_file_url.down.sql
+++ b/server/migrations/99_single_file_url.down.sql
@@ -9,6 +9,7 @@ DROP INDEX IF EXISTS unique_report_public_collection_id_ip_ua;
DROP INDEX IF EXISTS unique_report_public_file_id_ip_ua;
ALTER TABLE public_abuse_report DROP CONSTRAINT IF EXISTS fk_public_abuse_report_file_token_id;
+ALTER TABLE public_abuse_report DROP CONSTRAINT IF EXISTS unique_report_public_file_id_ip_ua;
ALTER TABLE public_abuse_report DROP COLUMN IF EXISTS file_share_id;
diff --git a/server/pkg/controller/public_collection.go b/server/pkg/controller/public_collection.go
index 022a08812e..7f51a46330 100644
--- a/server/pkg/controller/public_collection.go
+++ b/server/pkg/controller/public_collection.go
@@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
+ "github.com/ente-io/museum/pkg/repo/public"
"github.com/ente-io/museum/ente"
enteJWT "github.com/ente-io/museum/ente/jwt"
@@ -53,7 +54,7 @@ const (
type PublicCollectionController struct {
FileController *FileController
EmailNotificationCtrl *emailCtrl.EmailNotificationController
- PublicCollectionRepo *repo.PublicCollectionRepository
+ PublicCollectionRepo *public.PublicCollectionRepository
CollectionRepo *repo.CollectionRepository
UserRepo *repo.UserRepository
JwtSecret []byte
diff --git a/server/pkg/middleware/access_token.go b/server/pkg/middleware/access_token.go
index 702af77db8..05ba354580 100644
--- a/server/pkg/middleware/access_token.go
+++ b/server/pkg/middleware/access_token.go
@@ -5,6 +5,7 @@ import (
"context"
"crypto/sha256"
"fmt"
+ "github.com/ente-io/museum/pkg/repo/public"
"net/http"
"github.com/ente-io/museum/ente"
@@ -26,7 +27,7 @@ var whitelistedCollectionShareIDs = []int64{111}
// AccessTokenMiddleware intercepts and authenticates incoming requests
type AccessTokenMiddleware struct {
- PublicCollectionRepo *repo.PublicCollectionRepository
+ PublicCollectionRepo *public.PublicCollectionRepository
PublicCollectionCtrl *controller.PublicCollectionController
CollectionRepo *repo.CollectionRepository
Cache *cache.Cache
diff --git a/server/pkg/repo/collection.go b/server/pkg/repo/collection.go
index 3f9af70268..40acc98b8a 100644
--- a/server/pkg/repo/collection.go
+++ b/server/pkg/repo/collection.go
@@ -4,6 +4,7 @@ import (
"context"
"database/sql"
"fmt"
+ "github.com/ente-io/museum/pkg/repo/public"
"strconv"
t "time"
@@ -24,7 +25,7 @@ import (
type CollectionRepository struct {
DB *sql.DB
FileRepo *FileRepository
- PublicCollectionRepo *PublicCollectionRepository
+ PublicCollectionRepo *public.PublicCollectionRepository
TrashRepo *TrashRepository
SecretEncryptionKey []byte
QueueRepo *QueueRepository
diff --git a/server/pkg/repo/public_collection.go b/server/pkg/repo/public/public_collection.go
similarity index 99%
rename from server/pkg/repo/public_collection.go
rename to server/pkg/repo/public/public_collection.go
index f5ae8f2d72..600c213c11 100644
--- a/server/pkg/repo/public_collection.go
+++ b/server/pkg/repo/public/public_collection.go
@@ -1,4 +1,4 @@
-package repo
+package public
import (
"context"