feat: exorcise entity framework core from most responders
This commit is contained in:
parent
33b78a7ac5
commit
5891f28f7c
32 changed files with 743 additions and 145 deletions
|
|
@ -47,18 +47,15 @@ public class MessageRepository(
|
|||
ChannelId = msg.ChannelID.ToUlong(),
|
||||
GuildId = msg.GuildID.ToUlong(),
|
||||
|
||||
EncryptedContent = await Task.Run(
|
||||
Content = await Task.Run(
|
||||
() =>
|
||||
encryptionService.Encrypt(
|
||||
string.IsNullOrWhiteSpace(msg.Content) ? "None" : msg.Content
|
||||
),
|
||||
ct
|
||||
),
|
||||
EncryptedUsername = await Task.Run(
|
||||
() => encryptionService.Encrypt(msg.Author.Tag()),
|
||||
ct
|
||||
),
|
||||
EncryptedMetadata = await Task.Run(
|
||||
Username = await Task.Run(() => encryptionService.Encrypt(msg.Author.Tag()), ct),
|
||||
Metadata = await Task.Run(
|
||||
() => encryptionService.Encrypt(JsonSerializer.Serialize(metadata)),
|
||||
ct
|
||||
),
|
||||
|
|
@ -103,18 +100,15 @@ public class MessageRepository(
|
|||
"Message was null despite HasProxyInfoAsync returning true"
|
||||
);
|
||||
|
||||
dbMsg.EncryptedContent = await Task.Run(
|
||||
dbMsg.Content = await Task.Run(
|
||||
() =>
|
||||
encryptionService.Encrypt(
|
||||
string.IsNullOrWhiteSpace(msg.Content) ? "None" : msg.Content
|
||||
),
|
||||
ct
|
||||
);
|
||||
dbMsg.EncryptedUsername = await Task.Run(
|
||||
() => encryptionService.Encrypt(msg.Author.Tag()),
|
||||
ct
|
||||
);
|
||||
dbMsg.EncryptedMetadata = await Task.Run(
|
||||
dbMsg.Username = await Task.Run(() => encryptionService.Encrypt(msg.Author.Tag()), ct);
|
||||
dbMsg.Metadata = await Task.Run(
|
||||
() => encryptionService.Encrypt(JsonSerializer.Serialize(metadata)),
|
||||
ct
|
||||
);
|
||||
|
|
@ -142,11 +136,11 @@ public class MessageRepository(
|
|||
dbMsg.GuildId,
|
||||
dbMsg.Member,
|
||||
dbMsg.System,
|
||||
Username: await Task.Run(() => encryptionService.Decrypt(dbMsg.EncryptedUsername), ct),
|
||||
Content: await Task.Run(() => encryptionService.Decrypt(dbMsg.EncryptedContent), ct),
|
||||
Metadata: dbMsg.EncryptedMetadata != null
|
||||
Username: await Task.Run(() => encryptionService.Decrypt(dbMsg.Username), ct),
|
||||
Content: await Task.Run(() => encryptionService.Decrypt(dbMsg.Content), ct),
|
||||
Metadata: dbMsg.Metadata != null
|
||||
? JsonSerializer.Deserialize<Metadata>(
|
||||
await Task.Run(() => encryptionService.Decrypt(dbMsg.EncryptedMetadata), ct)
|
||||
await Task.Run(() => encryptionService.Decrypt(dbMsg.Metadata), ct)
|
||||
)
|
||||
: null,
|
||||
dbMsg.AttachmentSize
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue