Commit 966ee6df authored by Benedikt Heinrichs's avatar Benedikt Heinrichs
Browse files

Merge branch 'Topic/1127-emailTemplate' into 'Product/1089-htmlEmail'

New: Included partials

See merge request coscine/api/notification!10
parents 3cc70ed3 886866fe
using Coscine.ApiCommons;
using Coscine.ApiCommons.Factories;
using Coscine.Configuration;
using Coscine.Configuration;
using Coscine.Database.DataModel;
using Coscine.Database.Models;
using Coscine.NotificationChannelBase;
using Coscine.NotificationConfiguration;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
using Stubble.Core.Builders;
using Stubble.Core.Loaders;
using System;
using System.Collections.Generic;
using System.Reflection;
......@@ -47,9 +45,9 @@ namespace Coscine.Api.NotificationBus.Controllers
}
[HttpPost("[controller]/sendAsync")]
public IActionResult SendAsync([FromBody] NotificationParameterObject notificationParameterObject)
public async Task<IActionResult> SendAsync([FromBody] NotificationParameterObject notificationParameterObject)
{
SendNotifications(notificationParameterObject);
await SendNotifications(notificationParameterObject);
return Ok();
}
......@@ -113,7 +111,11 @@ namespace Coscine.Api.NotificationBus.Controllers
}
var template = (JObject)(action.Template[channelName][language]);
var stubble = new StubbleBuilder().Build();
var stubble = new StubbleBuilder()
.Configure(settings =>
{
settings.SetPartialTemplateLoader(new DictionaryLoader(_notificationConfiguration.GetPartialsForChannel(channelName, language)));
}).Build();
var dict = new Dictionary<string, object>();
if (requestArgs["placeholder"] != null)
......@@ -129,7 +131,6 @@ namespace Coscine.Api.NotificationBus.Controllers
}
return template;
}
private List<User> GetUsers(List<string> userIds)
......
......@@ -63,8 +63,8 @@
<Reference Include="Coscine.NotificationChannelBase, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.NotificationChannelBase.1.1.0\lib\net461\Coscine.NotificationChannelBase.dll</HintPath>
</Reference>
<Reference Include="Coscine.NotificationConfiguration, Version=1.3.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.NotificationConfiguration.1.3.0\lib\net461\Coscine.NotificationConfiguration.dll</HintPath>
<Reference Include="Coscine.NotificationConfiguration, Version=1.4.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.NotificationConfiguration.1.4.0-topic-1127-email0008\lib\net461\Coscine.NotificationConfiguration.dll</HintPath>
</Reference>
<Reference Include="Costura, Version=4.1.0.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
<HintPath>..\packages\Costura.Fody.4.1.0\lib\net40\Costura.dll</HintPath>
......
using Coscine.Database.DataModel;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.NotificationBus
{
......
using Coscine.ApiCommons;
using Coscine.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.NotificationBus
{
......
using Coscine.ApiCommons;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.NotificationBus
{
......
......@@ -6,7 +6,7 @@
<package id="Coscine.Database" version="1.22.2" targetFramework="net461" />
<package id="Coscine.Logging" version="1.2.0" targetFramework="net461" />
<package id="Coscine.NotificationChannelBase" version="1.1.0" targetFramework="net461" />
<package id="Coscine.NotificationConfiguration" version="1.3.0" targetFramework="net461" />
<package id="Coscine.NotificationConfiguration" version="1.4.0-topic-1127-email0008" targetFramework="net461" />
<package id="Costura.Fody" version="4.1.0" targetFramework="net461" />
<package id="EntityFramework" version="6.2.0" targetFramework="net461" />
<package id="Fody" version="6.0.0" targetFramework="net461" developmentDependency="true" />
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment