Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public ImapAccountsController(EmailSyncDbContext dbContext, IMapper mapper)
[SwaggerOperation(Tags = new[] { "Users" })]
[HttpGet("{userId}/imap-accounts/{id}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ImapAccountDetailsDto>> GetAccountForUser(string userId, int id)
Expand Down Expand Up @@ -115,4 +115,4 @@ private async Task<ImapAccount> FindOrThrowNotFound(string userId, int id)

return result;
}
}
}
4 changes: 2 additions & 2 deletions plugins/OnlineSales.Plugin.EmailSync/DTOs/ImapAccountDtos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class ImapAccountUpdateDto

public string? UserName { get; set; }

public string? Password { get; set; }
public string? Password { get; set; }

public int? Port { get; set; }

Expand All @@ -47,4 +47,4 @@ public class ImapAccountDetailsDto : ImapAccountBaseDto
public DateTime CreatedAt { get; set; }

public DateTime? UpdatedAt { get; set; }
}
}
11 changes: 5 additions & 6 deletions plugins/OnlineSales.Plugin.EmailSync/Tasks/EmailSyncTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public EmailSyncTask(IConfiguration configuration, EmailSyncDbContext dbContext,
this.domainService = domainService;
this.contactsService = contactsService;

var config = configuration.GetSection(configKey)!.Get<TaskWithBatchConfig>();
var config = configuration.GetSection(configKey)!.Get<TaskWithBatchConfig>();
if (config is not null)
{
batchSize = config.BatchSize;
Expand All @@ -57,7 +57,7 @@ public EmailSyncTask(IConfiguration configuration, EmailSyncDbContext dbContext,
ignoredEmails = (ignored != null) ? ignored : new string[0];

domainService.SetDBContext(dbContext);
contactsService.SetDBContext(dbContext);
contactsService.SetDBContext(dbContext);
}

public override async Task<bool> Execute(TaskExecutionLog currentJob)
Expand Down Expand Up @@ -95,7 +95,7 @@ public override async Task<bool> Execute(TaskExecutionLog currentJob)
}
}

return true;
return true;
}

private async Task DeleteUnexistedFolders(List<ImapAccountFolder> imapAccountFolders, IList<IMailFolder> folders)
Expand Down Expand Up @@ -201,7 +201,7 @@ private async Task GetEmailLogs(string userName, ImapAccountFolder dbFolder, IMa

emailLogs.Add(emailLog);
}
}
}
}
}

Expand Down Expand Up @@ -273,5 +273,4 @@ private bool IsInternalEmails(string fromEmail, List<string> toEmails)
return IsInternalDomain(fromEmail) && toEmails.TrueForAll(email => IsInternalDomain(email));
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public SendgridController(SendgridDbContext dbContext, IContactService contactSe
this.contactService.SetDBContext(this.dbContext);
}

[HttpPost]
[HttpPost]
[Route("import")]
[Authorize(Roles = "Admin")]
[ProducesResponseType(StatusCodes.Status200OK)]
Expand Down
20 changes: 10 additions & 10 deletions plugins/OnlineSales.Plugin.SendGrid/DTOs/SuppressionDto.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// <copyright file="SuppressionDto.cs" company="WavePoint Co. Ltd.">
// Licensed under the MIT license. See LICENSE file in the samples root for full license information.
// </copyright>
using OnlineSales.Helpers;

using OnlineSales.Helpers;

namespace OnlineSales.Plugin.SendGrid.DTOs;

public class SuppressionDto
Expand All @@ -14,7 +14,7 @@ public double Created
{
return DateTimeHelper.GetTimeStamp(CreatedAt);
}

set
{
CreatedAt = DateTimeHelper.GetDateTime(value);
Expand All @@ -23,8 +23,8 @@ public double Created

public DateTime CreatedAt { get; set; }

public string Email { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;

public virtual string GetReason()
{
return "Unsubsribed";
Expand All @@ -35,8 +35,8 @@ public class BlockOrBounceDto : SuppressionDto
{
public string Reason { get; set; } = string.Empty;

public string Status { get; set; } = string.Empty;
public string Status { get; set; } = string.Empty;

public override string GetReason()
{
return $"{Status} - {Reason}";
Expand All @@ -45,8 +45,8 @@ public override string GetReason()

public class SpamReportDto : SuppressionDto
{
public string Ip { get; set; } = string.Empty;
public string Ip { get; set; } = string.Empty;

public override string GetReason()
{
return $"Reported As Spam";
Expand Down
20 changes: 10 additions & 10 deletions plugins/OnlineSales.Plugin.SendGrid/SendGridPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// Licensed under the MIT license. See LICENSE file in the samples root for full license information.
// </copyright>

using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using OnlineSales.Data;
using OnlineSales.Data;
using OnlineSales.Interfaces;
using OnlineSales.Plugin.SendGrid.Configuration;
using OnlineSales.Plugin.SendGrid.Data;
using OnlineSales.Plugin.SendGrid.Tasks;
using OnlineSales.SendGrid.Tasks;
using OnlineSales.SendGrid.Tasks;

namespace OnlineSales.Plugin.SendGrid;

public class SendGridPlugin : IPlugin
Expand All @@ -24,12 +24,12 @@ public void ConfigureServices(IServiceCollection services, IConfiguration config
if (pluginConfig != null)
{
Configuration = pluginConfig;
}
}

services.AddScoped<PluginDbContextBase, SendgridDbContext>();
services.AddScoped<SendgridDbContext, SendgridDbContext>();
services.AddScoped<ITask, SyncSuppressionsTask>();
services.AddScoped<ITask, SyncActivityLogTask>();
services.AddScoped<SendgridDbContext, SendgridDbContext>();

services.AddScoped<ITask, SyncSuppressionsTask>();
services.AddScoped<ITask, SyncActivityLogTask>();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the samples root for full license information.
// </copyright>

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using OnlineSales.Exceptions;
Expand Down
14 changes: 7 additions & 7 deletions plugins/OnlineSales.Plugin.Sms/Services/SmsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the samples root for full license information.
// </copyright>

using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration;
using OnlineSales.Plugin.Sms.Configuration;
using OnlineSales.Plugin.Sms.Exceptions;

Expand Down Expand Up @@ -36,14 +36,14 @@ public Task SendAsync(string recipient, string message)
return smsService.SendAsync(recipient, message);
}

public string GetSender(string recipient)
{
var smsService = GetSmsService(recipient);
public string GetSender(string recipient)
{
var smsService = GetSmsService(recipient);

return smsService != null ? smsService.GetSender(recipient) : string.Empty;
}

private ISmsService? GetSmsService(string recipient)
private ISmsService? GetSmsService(string recipient)
{
var key = countrySmsServices.Keys.FirstOrDefault(key => recipient.StartsWith(key));

Expand All @@ -57,7 +57,7 @@ public string GetSender(string recipient)
return smsService;
}

return null;
return null;
}

private void InitGateways()
Expand All @@ -78,7 +78,7 @@ private void InitGateways()
break;
case "NotifyLk":
gatewayService = new NotifyLkService(pluginSettings.SmsGateways.NotifyLk);
break;
break;
case "Getshoutout":
gatewayService = new GetshoutoutService(pluginSettings.SmsGateways.Getshoutout);
break;
Expand Down
22 changes: 11 additions & 11 deletions plugins/OnlineSales.Plugin.Sms/SmsPlugin.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// <copyright file="SmsPlugin.cs" company="WavePoint Co. Ltd.">
// Licensed under the MIT license. See LICENSE file in the samples root for full license information.
// </copyright>

using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using OnlineSales.Data;
using OnlineSales.Data;
using OnlineSales.Plugin.Sms.Configuration;
using OnlineSales.Plugin.Sms.Data;
using OnlineSales.Plugin.Sms.Services;
using OnlineSales.Plugin.Sms.Tasks;
using OnlineSales.Plugin.Sms.Data;
using OnlineSales.Plugin.Sms.Services;
using OnlineSales.Plugin.Sms.Tasks;

namespace OnlineSales.Plugin.Sms;

public class SmsPlugin : IPlugin
Expand All @@ -27,9 +27,9 @@ public void ConfigureServices(IServiceCollection services, IConfiguration config

services.AddScoped<PluginDbContextBase, SmsDbContext>();
services.AddScoped<SmsDbContext, SmsDbContext>();
services.AddSingleton<ISmsService, SmsService>();
services.AddScoped<ITask, SyncSmsLogTask>();
}

services.AddSingleton<ISmsService, SmsService>();

services.AddScoped<ITask, SyncSmsLogTask>();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ private string FindMigration(string name)
throw new TestDbContextException($"Cannot find migration with name containig '{name}'");
}

return migration;
return migration;
}
}
52 changes: 26 additions & 26 deletions plugins/OnlineSales.Plugin.Vsto/VstoPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// Licensed under the MIT license. See LICENSE file in the samples root for full license information.
// </copyright>

using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Net.Http.Headers;
using Microsoft.Net.Http.Headers;
using OnlineSales.Data;
using OnlineSales.Plugin.Vsto.Configuration;
using OnlineSales.Plugin.Vsto.Data;
Expand All @@ -30,41 +30,41 @@ public void ConfigureServices(IServiceCollection services, IConfiguration config
if (pluginConfig != null)
{
Configuration = pluginConfig;
}
var assemblyPath = typeof(VstoDbContext).Assembly.Location;
var pluginDirectory = Path.GetDirectoryName(assemblyPath);
VstoLocalPath = Path.Combine(pluginDirectory!, Configuration.Vsto.LocalPath);
}

var assemblyPath = typeof(VstoDbContext).Assembly.Location;
var pluginDirectory = Path.GetDirectoryName(assemblyPath);

VstoLocalPath = Path.Combine(pluginDirectory!, Configuration.Vsto.LocalPath);

services.AddScoped<PluginDbContextBase, VstoDbContext>();
services.AddSingleton<IVariablesProvider, VstoVariablesProvider>();

this.services = services;
}

public void ConfigureApplication(IApplicationBuilder application)
{
var httpContextHelper = application.ApplicationServices.GetRequiredService<IHttpContextHelper>();
{
var httpContextHelper = application.ApplicationServices.GetRequiredService<IHttpContextHelper>();

application.UseStaticFiles(new StaticFileOptions
{
RequestPath = Configuration.Vsto.RequestPath,
FileProvider = new VstoFileProvider(VstoLocalPath, httpContextHelper, services!),
ServeUnknownFileTypes = true,
OnPrepareResponse = (context) =>
{
var headers = context.Context.Response.GetTypedHeaders();
headers.CacheControl = new CacheControlHeaderValue
{
Public = true,
NoCache = true,
NoStore = true,
};
OnPrepareResponse = (context) =>
{
var headers = context.Context.Response.GetTypedHeaders();
headers.CacheControl = new CacheControlHeaderValue
{
Public = true,
NoCache = true,
NoStore = true,
};
},
});
localLinksWatcher = new VstoLocalLinksWatcher(VstoLocalPath, Configuration.Vsto.RequestPath, services!);
});

localLinksWatcher = new VstoLocalLinksWatcher(VstoLocalPath, Configuration.Vsto.RequestPath, services!);
}

public void Dispose()
Expand Down
Loading
Loading