Fix MongoDB class map hierarchy for inherited Content property
This commit is contained in:
+2
-3
@@ -31,6 +31,7 @@ public static class MongoDbMapConfigurator
|
|||||||
cm.MapField("_deletedFor").SetElementName("DeletedFor");
|
cm.MapField("_deletedFor").SetElementName("DeletedFor");
|
||||||
cm.MapField("_readBy").SetElementName("ReadBy");
|
cm.MapField("_readBy").SetElementName("ReadBy");
|
||||||
cm.MapField("_reactions").SetElementName("Reactions");
|
cm.MapField("_reactions").SetElementName("Reactions");
|
||||||
|
cm.MapProperty(c => c.Content).SetSerializer(new EncryptedStringSerializer());
|
||||||
cm.MapProperty(c => c.Quote).SetSerializer(new EncryptedStringSerializer());
|
cm.MapProperty(c => c.Quote).SetSerializer(new EncryptedStringSerializer());
|
||||||
cm.SetIsRootClass(true);
|
cm.SetIsRootClass(true);
|
||||||
});
|
});
|
||||||
@@ -39,7 +40,6 @@ public static class MongoDbMapConfigurator
|
|||||||
{
|
{
|
||||||
cm.AutoMap();
|
cm.AutoMap();
|
||||||
cm.SetDiscriminator("TextMessage");
|
cm.SetDiscriminator("TextMessage");
|
||||||
cm.MapProperty(c => c.Content).SetSerializer(new EncryptedStringSerializer());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
BsonClassMap.RegisterClassMap<MediaMessage>(cm =>
|
BsonClassMap.RegisterClassMap<MediaMessage>(cm =>
|
||||||
@@ -47,14 +47,13 @@ public static class MongoDbMapConfigurator
|
|||||||
cm.AutoMap();
|
cm.AutoMap();
|
||||||
cm.MapField("_media").SetElementName("Media");
|
cm.MapField("_media").SetElementName("Media");
|
||||||
cm.SetDiscriminator("MediaMessage");
|
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<StoryMessage>(cm =>
|
BsonClassMap.RegisterClassMap<StoryMessage>(cm =>
|
||||||
{
|
{
|
||||||
cm.AutoMap();
|
cm.AutoMap();
|
||||||
cm.SetDiscriminator("StoryMessage");
|
cm.SetDiscriminator("StoryMessage");
|
||||||
cm.MapProperty(c => c.Content).SetSerializer(new EncryptedStringSerializer());
|
|
||||||
cm.MapProperty(c => c.InternalStoryMediaUrl).SetSerializer(new EncryptedStringSerializer());
|
cm.MapProperty(c => c.InternalStoryMediaUrl).SetSerializer(new EncryptedStringSerializer());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ services:
|
|||||||
container_name: knot-db
|
container_name: knot-db
|
||||||
restart: always
|
restart: always
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- ../.env
|
||||||
volumes:
|
volumes:
|
||||||
- postgres_data:/var/lib/postgresql/data
|
- postgres_data:/var/lib/postgresql/data
|
||||||
ports:
|
ports:
|
||||||
@@ -17,7 +17,7 @@ services:
|
|||||||
container_name: knot-server
|
container_name: knot-server
|
||||||
restart: always
|
restart: always
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- ../.env
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
- minio
|
- minio
|
||||||
@@ -30,7 +30,7 @@ services:
|
|||||||
container_name: knot-minio
|
container_name: knot-minio
|
||||||
restart: always
|
restart: always
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- ../.env
|
||||||
ports:
|
ports:
|
||||||
- "9000:9000"
|
- "9000:9000"
|
||||||
- "9001:9001"
|
- "9001:9001"
|
||||||
@@ -55,7 +55,7 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "9090:80"
|
- "9090:80"
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- ../.env
|
||||||
depends_on:
|
depends_on:
|
||||||
- server
|
- server
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user