still refactoring
This commit is contained in:
@ -1,2 +1,5 @@
|
||||
include ../common.mk
|
||||
include ../versioning.mk
|
||||
include ../dnx.mk
|
||||
|
||||
all: $(BINTARGETPATH)
|
||||
|
||||
|
@ -5,6 +5,6 @@ namespace Yavsc.Services
|
||||
{
|
||||
public interface IEmailSender
|
||||
{
|
||||
Task<bool> SendEmailAsync(SiteSettings siteSettings, SmtpSettings smtpSettings, string username, string email, string subject, string message);
|
||||
Task<bool> SendEmailAsync(string username, string email, string subject, string message);
|
||||
}
|
||||
}
|
||||
|
@ -11,21 +11,17 @@ namespace Yavsc.Services
|
||||
public interface IGoogleCloudMessageSender
|
||||
{
|
||||
Task<MessageWithPayloadResponse> NotifyBookQueryAsync(
|
||||
GoogleAuthSettings googlesettings,
|
||||
IEnumerable<string> registrationId,
|
||||
RdvQueryEvent ev);
|
||||
|
||||
Task<MessageWithPayloadResponse> NotifyEstimateAsync(
|
||||
GoogleAuthSettings googlesettings,
|
||||
IEnumerable<string> registrationId,
|
||||
EstimationEvent ev);
|
||||
|
||||
Task<MessageWithPayloadResponse> NotifyHairCutQueryAsync(
|
||||
GoogleAuthSettings googlesettings,
|
||||
IEnumerable<string> registrationId,
|
||||
HairCutQueryEvent ev);
|
||||
Task<MessageWithPayloadResponse> NotifyAsync(
|
||||
GoogleAuthSettings _googleSettings,
|
||||
IEnumerable<string> regids,
|
||||
IEvent yaev);
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ using System.Linq;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Yavsc.Server.Helpers;
|
||||
using Microsoft.Extensions.OptionsModel;
|
||||
|
||||
namespace Yavsc.Services
|
||||
{
|
||||
@ -24,13 +25,25 @@ namespace Yavsc.Services
|
||||
public class MessageSender : IEmailSender, IGoogleCloudMessageSender
|
||||
{
|
||||
private ILogger _logger;
|
||||
SiteSettings siteSettings;
|
||||
SmtpSettings smtpSettings;
|
||||
GoogleAuthSettings googleSettings;
|
||||
|
||||
public MessageSender(ILoggerFactory loggerFactory)
|
||||
public MessageSender(
|
||||
ILoggerFactory loggerFactory,
|
||||
IOptions<SiteSettings> sitesOptions,
|
||||
IOptions<SmtpSettings> smtpOptions,
|
||||
IOptions<GoogleAuthSettings> googleOptions
|
||||
)
|
||||
{
|
||||
_logger = loggerFactory.CreateLogger<MessageSender>();
|
||||
siteSettings = sitesOptions.Value;
|
||||
smtpSettings = smtpOptions.Value;
|
||||
googleSettings = googleOptions.Value;
|
||||
}
|
||||
|
||||
public async Task <MessageWithPayloadResponse> NotifyEvent<Event>
|
||||
( GoogleAuthSettings googleSettings, IEnumerable<string> regids, Event ev)
|
||||
( IEnumerable<string> regids, Event ev)
|
||||
where Event : IEvent
|
||||
{
|
||||
if (ev == null)
|
||||
@ -69,23 +82,23 @@ namespace Yavsc.Services
|
||||
/// <returns>a MessageWithPayloadResponse,
|
||||
/// <c>bool somethingsent = (response.failure == 0 && response.success > 0)</c>
|
||||
/// </returns>
|
||||
public async Task<MessageWithPayloadResponse> NotifyBookQueryAsync(GoogleAuthSettings googleSettings, IEnumerable<string> registrationIds, RdvQueryEvent ev)
|
||||
public async Task<MessageWithPayloadResponse> NotifyBookQueryAsync( IEnumerable<string> registrationIds, RdvQueryEvent ev)
|
||||
{
|
||||
return await NotifyEvent<RdvQueryEvent>(googleSettings,registrationIds, ev);
|
||||
return await NotifyEvent<RdvQueryEvent>(registrationIds, ev);
|
||||
}
|
||||
|
||||
public async Task<MessageWithPayloadResponse> NotifyEstimateAsync(GoogleAuthSettings googleSettings, IEnumerable<string> registrationIds, EstimationEvent ev)
|
||||
public async Task<MessageWithPayloadResponse> NotifyEstimateAsync(IEnumerable<string> registrationIds, EstimationEvent ev)
|
||||
{
|
||||
return await NotifyEvent<EstimationEvent>(googleSettings,registrationIds, ev);
|
||||
return await NotifyEvent<EstimationEvent>(registrationIds, ev);
|
||||
}
|
||||
|
||||
public async Task<MessageWithPayloadResponse> NotifyHairCutQueryAsync(GoogleAuthSettings googleSettings,
|
||||
public async Task<MessageWithPayloadResponse> NotifyHairCutQueryAsync(
|
||||
IEnumerable<string> registrationIds, HairCutQueryEvent ev)
|
||||
{
|
||||
return await NotifyEvent<HairCutQueryEvent>(googleSettings, registrationIds, ev);
|
||||
return await NotifyEvent<HairCutQueryEvent>(registrationIds, ev);
|
||||
}
|
||||
|
||||
public Task<bool> SendEmailAsync(SiteSettings siteSettings, SmtpSettings smtpSettings, string username, string email, string subject, string message)
|
||||
public Task<bool> SendEmailAsync(string username, string email, string subject, string message)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -120,7 +133,8 @@ namespace Yavsc.Services
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<MessageWithPayloadResponse> NotifyAsync(GoogleAuthSettings _googleSettings, IEnumerable<string> regids, IEvent yaev)
|
||||
public Task<MessageWithPayloadResponse> NotifyAsync(
|
||||
IEnumerable<string> regids, IEvent yaev)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
12
Yavsc.Server/Templates/UserOrientedTemplate.cs
Normal file
12
Yavsc.Server/Templates/UserOrientedTemplate.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using Yavsc.Abstract.Templates;
|
||||
using Yavsc.Models;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yavsc.Templates
|
||||
{
|
||||
public abstract class UserOrientedTemplate: Template
|
||||
{
|
||||
public ApplicationUser User { get; set; }
|
||||
|
||||
}
|
||||
}
|
@ -25,6 +25,7 @@
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="bin/$config$/dnx451/Yavsc.Server.dll" target="lib/dnx451" />
|
||||
<file src="bin/$config$/net451/Yavsc.Server.dll" target="lib/portable-net45+win8+wp8+wpa81+Xamarin.Mac+MonoAndroid10+MonoTouch10+Xamarin.iOS10" />
|
||||
</files>
|
||||
</package>
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "1.0.0-*",
|
||||
"version": "1.0.5-*",
|
||||
"description": "Yavsc server common library",
|
||||
"authors": [
|
||||
"Paul Schneider <paul@pschneider.fr>"
|
||||
@ -63,10 +63,7 @@
|
||||
"EntityFramework7.Npgsql": "3.1.0-rc1-3",
|
||||
"EntityFramework7.Npgsql.Design": "3.1.0-rc1-5",
|
||||
"Microsoft.CodeAnalysis.CSharp": "1.1.0-rc1-20151109-01",
|
||||
"Yavsc.Abstract": {
|
||||
"target": "project",
|
||||
"type": "build"
|
||||
}
|
||||
"Yavsc.Abstract": "1.0.5-rc17"
|
||||
},
|
||||
"frameworks": {
|
||||
"dnx451": {
|
||||
@ -79,9 +76,9 @@
|
||||
"System.ComponentModel.DataAnnotations": "4.0.0",
|
||||
"System.Json": "4.0.0",
|
||||
"System.Net": "4.0.0.0",
|
||||
"System.Net.Http": "4.0.0.0",
|
||||
"System.Xml": "4.0.0.0",
|
||||
"System": "4.0.0.0"
|
||||
"System.Net.Http": "4.0.0",
|
||||
"System.Xml": "4.0.0",
|
||||
"System": "4.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -12816,15 +12816,16 @@
|
||||
},
|
||||
"projectFileDependencyGroups": {
|
||||
"": [
|
||||
"Newtonsoft.Json >= 9.0.1",
|
||||
"Yavsc.Abstract ",
|
||||
"Microsoft.AspNet.Identity >= 3.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Identity.EntityFramework >= 3.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Authentication.Facebook >= 1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Authentication.Twitter >= 1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Authentication.OAuth >= 1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Authentication.Cookies >= 1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Hosting >= 1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Http.Extensions >= 1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Identity >= 3.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Identity.EntityFramework >= 3.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Mvc.TagHelpers >= 6.0.0-rc1-final",
|
||||
"Newtonsoft.Json >= 9.0.1",
|
||||
"Gapi.net45 >= 1.0.0",
|
||||
"PayPalMerchant-net451 >= 2.7.109",
|
||||
"MailKit >= 1.12.0",
|
||||
@ -12832,9 +12833,8 @@
|
||||
"Microsoft.AspNet.Localization >= 1.0.0-rc1-final",
|
||||
"EntityFramework7.Npgsql >= 3.1.0-rc1-3",
|
||||
"EntityFramework7.Npgsql.Design >= 3.1.0-rc1-5",
|
||||
"Microsoft.AspNet.Mvc.TagHelpers >= 6.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Http.Extensions >= 1.0.0-rc1-final",
|
||||
"Microsoft.CodeAnalysis.CSharp >= 1.1.0-rc1-20151109-01"
|
||||
"Microsoft.CodeAnalysis.CSharp >= 1.1.0-rc1-20151109-01",
|
||||
"Yavsc.Abstract >= 1.0.5-rc17"
|
||||
],
|
||||
"DNX,Version=v4.5.1": [
|
||||
"fx/System.Json >= 4.0.0"
|
||||
|
@ -1 +0,0 @@
|
||||
15
|
Reference in New Issue
Block a user