Emaıl templates.
This commit is contained in:
@@ -56,6 +56,7 @@ public class DatabaseService : IDatabaseService
|
||||
Connection.CreateTableAsync<ContactGroupMember>(),
|
||||
Connection.CreateTableAsync<CustomServerInformation>(),
|
||||
Connection.CreateTableAsync<AccountSignature>(),
|
||||
Connection.CreateTableAsync<EmailTemplate>(),
|
||||
Connection.CreateTableAsync<MergedInbox>(),
|
||||
Connection.CreateTableAsync<MailAccountPreferences>(),
|
||||
Connection.CreateTableAsync<MailAccountAlias>(),
|
||||
@@ -200,6 +201,7 @@ SET {nameof(KeyboardShortcut.Action)} =
|
||||
await Connection.ExecuteAsync("CREATE INDEX IF NOT EXISTS IX_MailAccount_Order ON MailAccount([Order])").ConfigureAwait(false);
|
||||
|
||||
await Connection.ExecuteAsync("CREATE INDEX IF NOT EXISTS IX_AccountSignature_MailAccountId ON AccountSignature(MailAccountId)").ConfigureAwait(false);
|
||||
await Connection.ExecuteAsync("CREATE INDEX IF NOT EXISTS IX_EmailTemplate_Name ON EmailTemplate(Name)").ConfigureAwait(false);
|
||||
await Connection.ExecuteAsync("CREATE INDEX IF NOT EXISTS IX_MailAccountAlias_AccountId ON MailAccountAlias(AccountId)").ConfigureAwait(false);
|
||||
await Connection.ExecuteAsync("CREATE INDEX IF NOT EXISTS IX_MailAccountAlias_AccountId_AliasAddress ON MailAccountAlias(AccountId, AliasAddress)").ConfigureAwait(false);
|
||||
await Connection.ExecuteAsync("CREATE UNIQUE INDEX IF NOT EXISTS IX_MailAccountPreferences_AccountId ON MailAccountPreferences(AccountId)").ConfigureAwait(false);
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Wino.Core.Domain.Entities.Mail;
|
||||
using Wino.Core.Domain.Interfaces;
|
||||
|
||||
namespace Wino.Services;
|
||||
|
||||
public class EmailTemplateService(IDatabaseService databaseService) : BaseDatabaseService(databaseService), IEmailTemplateService
|
||||
{
|
||||
public Task<List<EmailTemplate>> GetEmailTemplatesAsync()
|
||||
{
|
||||
return Connection.Table<EmailTemplate>()
|
||||
.OrderBy(t => t.Name)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public Task<EmailTemplate> GetEmailTemplateAsync(Guid templateId)
|
||||
{
|
||||
return Connection.Table<EmailTemplate>()
|
||||
.FirstOrDefaultAsync(t => t.Id == templateId);
|
||||
}
|
||||
|
||||
public async Task<EmailTemplate> CreateEmailTemplateAsync(EmailTemplate template)
|
||||
{
|
||||
await Connection.InsertAsync(template, typeof(EmailTemplate)).ConfigureAwait(false);
|
||||
return template;
|
||||
}
|
||||
|
||||
public async Task<EmailTemplate> UpdateEmailTemplateAsync(EmailTemplate template)
|
||||
{
|
||||
await Connection.UpdateAsync(template, typeof(EmailTemplate)).ConfigureAwait(false);
|
||||
return template;
|
||||
}
|
||||
|
||||
public async Task<EmailTemplate> DeleteEmailTemplateAsync(EmailTemplate template)
|
||||
{
|
||||
await Connection.DeleteAsync<EmailTemplate>(template.Id).ConfigureAwait(false);
|
||||
return template;
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ public static class ServicesContainerSetup
|
||||
services.AddTransient<IAccountService, AccountService>();
|
||||
services.AddTransient<IContactService, ContactService>();
|
||||
services.AddTransient<ISignatureService, SignatureService>();
|
||||
services.AddTransient<IEmailTemplateService, EmailTemplateService>();
|
||||
services.AddTransient<IContextMenuItemService, ContextMenuItemService>();
|
||||
services.AddTransient<ISpecialImapProviderConfigResolver, SpecialImapProviderConfigResolver>();
|
||||
services.AddTransient<IKeyboardShortcutService, KeyboardShortcutService>();
|
||||
|
||||
Reference in New Issue
Block a user