diff --git a/backend/src/Modules/Chats/Infrastructure/Persistence/Mongo/MongoDbMapConfigurator.cs b/backend/src/Modules/Chats/Infrastructure/Persistence/Mongo/MongoDbMapConfigurator.cs index f63556b..205f73a 100644 --- a/backend/src/Modules/Chats/Infrastructure/Persistence/Mongo/MongoDbMapConfigurator.cs +++ b/backend/src/Modules/Chats/Infrastructure/Persistence/Mongo/MongoDbMapConfigurator.cs @@ -31,6 +31,7 @@ public static class MongoDbMapConfigurator cm.MapField("_deletedFor").SetElementName("DeletedFor"); cm.MapField("_readBy").SetElementName("ReadBy"); cm.MapField("_reactions").SetElementName("Reactions"); + cm.MapProperty(c => c.Content).SetSerializer(new EncryptedStringSerializer()); cm.MapProperty(c => c.Quote).SetSerializer(new EncryptedStringSerializer()); cm.SetIsRootClass(true); }); @@ -39,7 +40,6 @@ public static class MongoDbMapConfigurator { cm.AutoMap(); cm.SetDiscriminator("TextMessage"); - cm.MapProperty(c => c.Content).SetSerializer(new EncryptedStringSerializer()); }); BsonClassMap.RegisterClassMap(cm => @@ -47,14 +47,13 @@ public static class MongoDbMapConfigurator cm.AutoMap(); cm.MapField("_media").SetElementName("Media"); cm.SetDiscriminator("MediaMessage"); - cm.MapProperty(c => c.Caption).SetSerializer(new EncryptedStringSerializer()); + cm.UnmapProperty(c => c.Caption); // Avoid DB duplication, Content is already saved }); BsonClassMap.RegisterClassMap(cm => { cm.AutoMap(); cm.SetDiscriminator("StoryMessage"); - cm.MapProperty(c => c.Content).SetSerializer(new EncryptedStringSerializer()); cm.MapProperty(c => c.InternalStoryMediaUrl).SetSerializer(new EncryptedStringSerializer()); }); diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 9c0afa1..d64c4aa 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -4,7 +4,7 @@ services: container_name: knot-db restart: always env_file: - - .env + - ../.env volumes: - postgres_data:/var/lib/postgresql/data ports: @@ -17,7 +17,7 @@ services: container_name: knot-server restart: always env_file: - - .env + - ../.env depends_on: - db - minio @@ -30,7 +30,7 @@ services: container_name: knot-minio restart: always env_file: - - .env + - ../.env ports: - "9000:9000" - "9001:9001" @@ -55,7 +55,7 @@ services: ports: - "9090:80" env_file: - - .env + - ../.env depends_on: - server