Merge branch 'vnext' of https://github.com/pazof/yavsc.git
This commit is contained in:
commit
0a374b2e75
34 changed files with 396 additions and 67 deletions
165
Yavsc/ApiControllers/BlackListApiController.cs
Normal file
165
Yavsc/ApiControllers/BlackListApiController.cs
Normal file
|
|
@ -0,0 +1,165 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Security.Claims;
|
||||||
|
using Microsoft.AspNet.Authorization;
|
||||||
|
using Microsoft.AspNet.Http;
|
||||||
|
using Microsoft.AspNet.Mvc;
|
||||||
|
using Microsoft.Data.Entity;
|
||||||
|
using Yavsc.Models;
|
||||||
|
using Yavsc.Models.Access;
|
||||||
|
|
||||||
|
namespace Yavsc.Controllers
|
||||||
|
{
|
||||||
|
[Produces("application/json")]
|
||||||
|
[Route("api/blacklist"), Authorize]
|
||||||
|
public class BlackListApiController : Controller
|
||||||
|
{
|
||||||
|
private ApplicationDbContext _context;
|
||||||
|
|
||||||
|
public BlackListApiController(ApplicationDbContext context)
|
||||||
|
{
|
||||||
|
_context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET: api/BlackListApi
|
||||||
|
[HttpGet]
|
||||||
|
public IEnumerable<BlackListed> GetBlackListed()
|
||||||
|
{
|
||||||
|
return _context.BlackListed;
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET: api/BlackListApi/5
|
||||||
|
[HttpGet("{id}", Name = "GetBlackListed")]
|
||||||
|
public IActionResult GetBlackListed([FromRoute] long id)
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return HttpBadRequest(ModelState);
|
||||||
|
}
|
||||||
|
BlackListed blackListed = _context.BlackListed.Single(m => m.Id == id);
|
||||||
|
if (blackListed == null)
|
||||||
|
{
|
||||||
|
return HttpNotFound();
|
||||||
|
}
|
||||||
|
if (!CheckPermission(blackListed))
|
||||||
|
return HttpBadRequest();
|
||||||
|
|
||||||
|
return Ok(blackListed);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool CheckPermission(BlackListed blackListed)
|
||||||
|
{
|
||||||
|
var uid = User.GetUserId();
|
||||||
|
if (uid != blackListed.OwnerId)
|
||||||
|
if (!User.IsInRole(Constants.AdminGroupName))
|
||||||
|
if (!User.IsInRole(Constants.FrontOfficeGroupName))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// PUT: api/BlackListApi/5
|
||||||
|
[HttpPut("{id}")]
|
||||||
|
public IActionResult PutBlackListed(long id, [FromBody] BlackListed blackListed)
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return HttpBadRequest(ModelState);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (id != blackListed.Id)
|
||||||
|
{
|
||||||
|
return HttpBadRequest();
|
||||||
|
}
|
||||||
|
if (!CheckPermission(blackListed))
|
||||||
|
return HttpBadRequest();
|
||||||
|
_context.Entry(blackListed).State = EntityState.Modified;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_context.SaveChanges();
|
||||||
|
}
|
||||||
|
catch (DbUpdateConcurrencyException)
|
||||||
|
{
|
||||||
|
if (!BlackListedExists(id))
|
||||||
|
{
|
||||||
|
return HttpNotFound();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new HttpStatusCodeResult(StatusCodes.Status204NoContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
// POST: api/BlackListApi
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult PostBlackListed([FromBody] BlackListed blackListed)
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return HttpBadRequest(ModelState);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!CheckPermission(blackListed))
|
||||||
|
return HttpBadRequest();
|
||||||
|
|
||||||
|
_context.BlackListed.Add(blackListed);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_context.SaveChanges();
|
||||||
|
}
|
||||||
|
catch (DbUpdateException)
|
||||||
|
{
|
||||||
|
if (BlackListedExists(blackListed.Id))
|
||||||
|
{
|
||||||
|
return new HttpStatusCodeResult(StatusCodes.Status409Conflict);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return CreatedAtRoute("GetBlackListed", new { id = blackListed.Id }, blackListed);
|
||||||
|
}
|
||||||
|
|
||||||
|
// DELETE: api/BlackListApi/5
|
||||||
|
[HttpDelete("{id}")]
|
||||||
|
public IActionResult DeleteBlackListed(long id)
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return HttpBadRequest(ModelState);
|
||||||
|
}
|
||||||
|
|
||||||
|
BlackListed blackListed = _context.BlackListed.Single(m => m.Id == id);
|
||||||
|
if (blackListed == null)
|
||||||
|
{
|
||||||
|
return HttpNotFound();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!CheckPermission(blackListed))
|
||||||
|
return HttpBadRequest();
|
||||||
|
|
||||||
|
_context.BlackListed.Remove(blackListed);
|
||||||
|
_context.SaveChanges();
|
||||||
|
|
||||||
|
return Ok(blackListed);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing)
|
||||||
|
{
|
||||||
|
_context.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool BlackListedExists(long id)
|
||||||
|
{
|
||||||
|
return _context.BlackListed.Count(e => e.Id == id) > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -11,6 +11,7 @@ namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
using System;
|
using System;
|
||||||
using Yavsc.Model;
|
using Yavsc.Model;
|
||||||
|
using Yavsc.Models.Messaging;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Booking;
|
using Yavsc.Models.Booking;
|
||||||
|
|
||||||
|
|
@ -40,10 +41,14 @@ namespace Yavsc.Controllers
|
||||||
var now = DateTime.Now;
|
var now = DateTime.Now;
|
||||||
|
|
||||||
var result = _context.Commands.Include(c => c.Location).
|
var result = _context.Commands.Include(c => c.Location).
|
||||||
Include(c => c.Client).Where(c => c.PerformerId == uid && c.Id < maxId && c.EventDate > now).
|
Include(c => c.Client).Where(c => c.PerformerId == uid && c.Id < maxId && c.EventDate > now
|
||||||
|
&& c.ValidationDate == null).
|
||||||
Select(c => new BookQueryProviderInfo
|
Select(c => new BookQueryProviderInfo
|
||||||
{
|
{
|
||||||
Client = new ClientProviderInfo { UserName = c.Client.UserName, UserId = c.ClientId },
|
Client = new ClientProviderInfo {
|
||||||
|
UserName = c.Client.UserName,
|
||||||
|
UserId = c.ClientId,
|
||||||
|
Avatar = c.Client.Avatar },
|
||||||
Location = c.Location,
|
Location = c.Location,
|
||||||
EventDate = c.EventDate,
|
EventDate = c.EventDate,
|
||||||
Id = c.Id,
|
Id = c.Id,
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.AspNet.Http;
|
using Microsoft.AspNet.Http;
|
||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNet.Mvc;
|
||||||
using Microsoft.Data.Entity;
|
using Microsoft.Data.Entity;
|
||||||
using Yavsc.Model;
|
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
|
using Yavsc.Models.Messaging;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
|
@ -20,29 +19,10 @@ namespace Yavsc.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: api/ContactsApi
|
// GET: api/ContactsApi
|
||||||
[HttpGet]
|
[HttpGet("{id}")]
|
||||||
public IEnumerable<ClientProviderInfo> GetClientProviderInfo()
|
public ClientProviderInfo GetClientProviderInfo(string id)
|
||||||
{
|
{
|
||||||
return _context.ClientProviderInfo;
|
return _context.ClientProviderInfo.FirstOrDefault(c=>c.UserId == id);
|
||||||
}
|
|
||||||
|
|
||||||
// GET: api/ContactsApi/5
|
|
||||||
[HttpGet("{id}", Name = "GetClientProviderInfo")]
|
|
||||||
public IActionResult GetClientProviderInfo([FromRoute] string id)
|
|
||||||
{
|
|
||||||
if (!ModelState.IsValid)
|
|
||||||
{
|
|
||||||
return HttpBadRequest(ModelState);
|
|
||||||
}
|
|
||||||
|
|
||||||
ClientProviderInfo clientProviderInfo = _context.ClientProviderInfo.Single(m => m.UserId == id);
|
|
||||||
|
|
||||||
if (clientProviderInfo == null)
|
|
||||||
{
|
|
||||||
return HttpNotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Ok(clientProviderInfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// PUT: api/ContactsApi/5
|
// PUT: api/ContactsApi/5
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using Microsoft.AspNet.Authorization;
|
using Microsoft.AspNet.Authorization;
|
||||||
|
|
@ -124,8 +125,15 @@ namespace Yavsc.Controllers
|
||||||
return HttpBadRequest(ModelState);
|
return HttpBadRequest(ModelState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (estimate.CommandId!=null) {
|
||||||
|
var query = _context.BookQueries.FirstOrDefault(q => q.Id == estimate.CommandId);
|
||||||
|
if (query == null || query.PerformerId!= uid)
|
||||||
|
throw new InvalidOperationException();
|
||||||
|
query.ValidationDate = DateTime.Now;
|
||||||
|
}
|
||||||
_context.Estimates.Add(estimate);
|
_context.Estimates.Add(estimate);
|
||||||
|
|
||||||
|
|
||||||
/* _context.AttachRange(estimate.Bill);
|
/* _context.AttachRange(estimate.Bill);
|
||||||
_context.Attach(estimate);
|
_context.Attach(estimate);
|
||||||
_context.Entry(estimate).State = EntityState.Added;
|
_context.Entry(estimate).State = EntityState.Added;
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ namespace Yavsc.Controllers
|
||||||
_siteSettings, _smtpSettings,
|
_siteSettings, _smtpSettings,
|
||||||
command.PerformerProfile.Performer.Email,
|
command.PerformerProfile.Performer.Email,
|
||||||
yaev.Topic+" "+yaev.Client.UserName,
|
yaev.Topic+" "+yaev.Client.UserName,
|
||||||
$"{yaev.Message}\r\n-- \r\n{yaev.Previsional}\r\n"
|
$"{yaev.Message}\r\n-- \r\n{yaev.Previsional}\r\n{yaev.EventDate}\r\n"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
ViewBag.GoogleSettings = _googleSettings;
|
ViewBag.GoogleSettings = _googleSettings;
|
||||||
|
|
|
||||||
16
Yavsc/Helpers/EstimateHelpers.cs
Normal file
16
Yavsc/Helpers/EstimateHelpers.cs
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
|
||||||
|
using Yavsc.Models.Billing;
|
||||||
|
|
||||||
|
namespace Yavsc.Helpers
|
||||||
|
{
|
||||||
|
public static class EstimateHelpers {
|
||||||
|
public static decimal GetTotal(this Estimate estimate)
|
||||||
|
{
|
||||||
|
decimal result = 0;
|
||||||
|
foreach (var l in estimate.Bill)
|
||||||
|
result += l.Count*l.UnitaryCost;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
using Microsoft.Extensions.Localization;
|
using Microsoft.Extensions.Localization;
|
||||||
using Yavsc.Model;
|
|
||||||
using Yavsc.Models.Booking;
|
using Yavsc.Models.Booking;
|
||||||
using Yavsc.Models.Messaging;
|
using Yavsc.Models.Messaging;
|
||||||
|
|
||||||
|
|
@ -12,11 +11,15 @@ namespace Yavsc.Helpers
|
||||||
{
|
{
|
||||||
var yaev = new BookQueryEvent
|
var yaev = new BookQueryEvent
|
||||||
{
|
{
|
||||||
Client = new ClientProviderInfo { UserName = query.Client.UserName , UserId = query.ClientId } ,
|
Client = new ClientProviderInfo {
|
||||||
|
UserName = query.Client.UserName ,
|
||||||
|
UserId = query.ClientId,
|
||||||
|
Avatar = query.Client.Avatar } ,
|
||||||
Previsional = query.Previsional,
|
Previsional = query.Previsional,
|
||||||
EventDate = query.EventDate,
|
EventDate = query.EventDate,
|
||||||
Location = query.Location,
|
Location = query.Location,
|
||||||
Id = query.Id
|
Id = query.Id,
|
||||||
|
Reason = query.Reason
|
||||||
};
|
};
|
||||||
return yaev;
|
return yaev;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ namespace Yavsc.Helpers
|
||||||
|
|
||||||
return di;
|
return di;
|
||||||
}
|
}
|
||||||
static char[] ValidChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_~.".ToCharArray();
|
static char[] ValidChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_~. ".ToCharArray();
|
||||||
|
|
||||||
public static bool IsValidDirectoryName(this string name)
|
public static bool IsValidDirectoryName(this string name)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using Yavsc.Model;
|
|
||||||
|
|
||||||
namespace Yavsc.Interfaces
|
namespace Yavsc.Interfaces
|
||||||
{
|
{
|
||||||
|
using Yavsc.Models.Messaging;
|
||||||
public interface IBookQueryData
|
public interface IBookQueryData
|
||||||
{
|
{
|
||||||
ClientProviderInfo Client { get; set; }
|
ClientProviderInfo Client { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,18 @@
|
||||||
|
|
||||||
public interface IEvent {
|
public interface IEvent {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An acceptable topic for this event to be.
|
/// <c>/topic/(bookquery|estimate)</c>
|
||||||
/// Should return something like the class name
|
|
||||||
/// of this object
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
string Topic { get; set ; }
|
string Topic { get; set ; }
|
||||||
|
/// <summary>
|
||||||
|
/// Should be the user's name
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
string Sender { get; set ; }
|
string Sender { get; set ; }
|
||||||
|
/// <summary>
|
||||||
|
/// The message
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
string Message { get; set; }
|
string Message { get; set; }
|
||||||
}
|
}
|
||||||
18
Yavsc/Models/Access/BlackList.cs
Normal file
18
Yavsc/Models/Access/BlackList.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using YavscLib;
|
||||||
|
|
||||||
|
namespace Yavsc.Models.Access
|
||||||
|
{
|
||||||
|
public class BlackListed: IBlackListed
|
||||||
|
{
|
||||||
|
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
|
public long Id { get; set; }
|
||||||
|
public string UserId { get; set; }
|
||||||
|
public string OwnerId { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey("OwnerId")]
|
||||||
|
public virtual ApplicationUser Owner { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -12,8 +12,9 @@ using Yavsc.Models.OAuth;
|
||||||
using Yavsc.Models.Workflow;
|
using Yavsc.Models.Workflow;
|
||||||
using Yavsc.Models.Identity;
|
using Yavsc.Models.Identity;
|
||||||
using Yavsc.Models.Market;
|
using Yavsc.Models.Market;
|
||||||
using Yavsc.Model;
|
|
||||||
using Yavsc.Model.Chat;
|
using Yavsc.Model.Chat;
|
||||||
|
using Yavsc.Models.Messaging;
|
||||||
|
using Yavsc.Models.Access;
|
||||||
|
|
||||||
namespace Yavsc.Models
|
namespace Yavsc.Models
|
||||||
{
|
{
|
||||||
|
|
@ -189,6 +190,8 @@ namespace Yavsc.Models
|
||||||
public DbSet<ClientProviderInfo> ClientProviderInfo { get; set; }
|
public DbSet<ClientProviderInfo> ClientProviderInfo { get; set; }
|
||||||
|
|
||||||
public DbSet<Connection> Connections { get; set; }
|
public DbSet<Connection> Connections { get; set; }
|
||||||
|
|
||||||
|
public DbSet<BlackListed> BlackListed { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace Yavsc.Models
|
namespace Yavsc.Models
|
||||||
{
|
{
|
||||||
using Interfaces;
|
|
||||||
|
|
||||||
public partial class AccountBalance: IAccountBalance {
|
public partial class AccountBalance: IAccountBalance {
|
||||||
[Key]
|
[Key]
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ using System;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Yavsc.Interfaces;
|
|
||||||
|
|
||||||
namespace Yavsc.Models
|
namespace Yavsc.Models
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using Yavsc.Models.Identity;
|
using Yavsc.Models.Identity;
|
||||||
using Yavsc.Model.Chat;
|
using Yavsc.Model.Chat;
|
||||||
using Yavsc.Model.Bank;
|
using Yavsc.Model.Bank;
|
||||||
|
using Yavsc.Models.Access;
|
||||||
|
|
||||||
namespace Yavsc.Models
|
namespace Yavsc.Models
|
||||||
{
|
{
|
||||||
|
|
@ -87,5 +88,7 @@ namespace Yavsc.Models
|
||||||
|
|
||||||
public long DiskQuota { get; set; } = 512*1024*1024;
|
public long DiskQuota { get; set; } = 512*1024*1024;
|
||||||
public long DiskUsage { get; set; } = 0;
|
public long DiskUsage { get; set; } = 0;
|
||||||
|
|
||||||
|
public virtual List<BlackListed> BlackList { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ using System;
|
||||||
|
|
||||||
namespace Yavsc.Model
|
namespace Yavsc.Model
|
||||||
{
|
{
|
||||||
|
using Models.Messaging;
|
||||||
|
|
||||||
public class BookQueryProviderInfo
|
public class BookQueryProviderInfo
|
||||||
{
|
{
|
||||||
|
|
@ -15,4 +16,5 @@ namespace Yavsc.Model
|
||||||
|
|
||||||
public string Reason { get; set; }
|
public string Reason { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
namespace Yavsc.Model
|
namespace Yavsc.Models.Messaging
|
||||||
{
|
{
|
||||||
public class ClientProviderInfo
|
public class ClientProviderInfo
|
||||||
{
|
{
|
||||||
|
|
@ -8,10 +8,8 @@ namespace Yavsc.Model
|
||||||
public string Avatar { get; set; }
|
public string Avatar { get; set; }
|
||||||
[Key]
|
[Key]
|
||||||
public string UserId { get; set; }
|
public string UserId { get; set; }
|
||||||
public int Rate { get; set; }
|
|
||||||
public string EMail { get; set; }
|
public string EMail { get; set; }
|
||||||
public string Phone { get; set; }
|
public string Phone { get; set; }
|
||||||
public Location BillingAddress { get; set; }
|
public Location BillingAddress { get; set; }
|
||||||
public string ChatHubConnectionId { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
54
Yavsc/Models/Messaging/EstimationEvent.cs
Normal file
54
Yavsc/Models/Messaging/EstimationEvent.cs
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
using System.Linq;
|
||||||
|
using Microsoft.Extensions.Localization;
|
||||||
|
using Yavsc.Helpers;
|
||||||
|
using Yavsc.Models.Billing;
|
||||||
|
|
||||||
|
namespace Yavsc.Models.Messaging
|
||||||
|
{
|
||||||
|
public class EstimationEvent: IEvent
|
||||||
|
{
|
||||||
|
public EstimationEvent(ApplicationDbContext context, Estimate estimate, IStringLocalizer SR)
|
||||||
|
{
|
||||||
|
Estimation = estimate;
|
||||||
|
var perfer = context.Performers.FirstOrDefault(
|
||||||
|
p => p.PerformerId == estimate.OwnerId
|
||||||
|
);
|
||||||
|
// Use estimate.OwnerId;
|
||||||
|
ProviderInfo = new ProviderClientInfo {
|
||||||
|
Rate = perfer.Rate,
|
||||||
|
UserName = perfer.Performer.UserName,
|
||||||
|
Avatar = perfer.Performer.Avatar,
|
||||||
|
UserId = perfer.PerformerId
|
||||||
|
};
|
||||||
|
((IEvent)this).Sender = perfer.Performer.UserName;
|
||||||
|
((IEvent)this).Message = string.Format(SR["EstimationMessageToClient"],perfer.Performer.UserName,
|
||||||
|
estimate.Title,estimate.GetTotal());
|
||||||
|
}
|
||||||
|
ProviderClientInfo ProviderInfo { get; set; }
|
||||||
|
Estimate Estimation { get; set; }
|
||||||
|
|
||||||
|
private string subtopic = null;
|
||||||
|
string IEvent.Topic
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return "/topic/estimate"+subtopic!=null?"/"+subtopic:"";
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
subtopic = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string IEvent.Sender
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
string IEvent.Message
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
8
Yavsc/Models/Messaging/ProviderClientInfo.cs
Normal file
8
Yavsc/Models/Messaging/ProviderClientInfo.cs
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
namespace Yavsc.Models.Messaging
|
||||||
|
{
|
||||||
|
public class ProviderClientInfo : ClientProviderInfo
|
||||||
|
{
|
||||||
|
public int Rate { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -203,6 +203,8 @@
|
||||||
<data name="entries"><value>entrées</value></data>
|
<data name="entries"><value>entrées</value></data>
|
||||||
<data name="Estimate"><value>Estimer</value></data>
|
<data name="Estimate"><value>Estimer</value></data>
|
||||||
<data name="Estimate_not_found"><value>Devis non trouvé</value></data>
|
<data name="Estimate_not_found"><value>Devis non trouvé</value></data>
|
||||||
|
<data name="EstimationMessageToClient"><value>{0} a validé un devis pour vous : {1}\nAu total : {2} €
|
||||||
|
Il attend maintenant votre signature.</value></data>
|
||||||
<data name="EstimateWanted"><value>Demande de devis</value></data>
|
<data name="EstimateWanted"><value>Demande de devis</value></data>
|
||||||
<data name="Event date"><value>Date de l'évennement</value></data>
|
<data name="Event date"><value>Date de l'évennement</value></data>
|
||||||
<data name="EventWebPage"><value>Page web de l'événement</value></data>
|
<data name="EventWebPage"><value>Page web de l'événement</value></data>
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,15 @@ namespace Yavsc.Services
|
||||||
{
|
{
|
||||||
public interface IGoogleCloudMessageSender
|
public interface IGoogleCloudMessageSender
|
||||||
{
|
{
|
||||||
Task<MessageWithPayloadResponse> NotifyBookQueryAsync(GoogleAuthSettings googlesettings, IEnumerable<string> registrationId, BookQueryEvent ev);
|
Task<MessageWithPayloadResponse> NotifyBookQueryAsync(
|
||||||
|
GoogleAuthSettings googlesettings,
|
||||||
|
IEnumerable<string> registrationId,
|
||||||
|
BookQueryEvent ev);
|
||||||
|
|
||||||
|
Task<MessageWithPayloadResponse> NotifyEstimateAsync(
|
||||||
|
GoogleAuthSettings googlesettings,
|
||||||
|
IEnumerable<string> registrationId,
|
||||||
|
EstimationEvent ev);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,7 @@ namespace Yavsc.Services
|
||||||
/// <returns>a MessageWithPayloadResponse,
|
/// <returns>a MessageWithPayloadResponse,
|
||||||
/// <c>bool somethingsent = (response.failure == 0 && response.success > 0)</c>
|
/// <c>bool somethingsent = (response.failure == 0 && response.success > 0)</c>
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public async Task<MessageWithPayloadResponse>
|
public async Task<MessageWithPayloadResponse> NotifyBookQueryAsync(GoogleAuthSettings googleSettings, IEnumerable<string> registrationIds, BookQueryEvent ev)
|
||||||
NotifyBookQueryAsync(GoogleAuthSettings googleSettings, IEnumerable<string> registrationIds, BookQueryEvent ev)
|
|
||||||
{
|
{
|
||||||
MessageWithPayloadResponse response = null;
|
MessageWithPayloadResponse response = null;
|
||||||
await Task.Run(()=>{
|
await Task.Run(()=>{
|
||||||
|
|
@ -37,6 +36,15 @@ namespace Yavsc.Services
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<MessageWithPayloadResponse> NotifyEstimateAsync(GoogleAuthSettings googleSettings, IEnumerable<string> registrationIds, EstimationEvent ev)
|
||||||
|
{
|
||||||
|
MessageWithPayloadResponse response = null;
|
||||||
|
await Task.Run(()=>{
|
||||||
|
response = googleSettings.NotifyEvent<EstimationEvent>(registrationIds, ev);
|
||||||
|
});
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
public Task<bool> SendEmailAsync(SiteSettings siteSettings, SmtpSettings smtpSettings, string email, string subject, string message)
|
public Task<bool> SendEmailAsync(SiteSettings siteSettings, SmtpSettings smtpSettings, string email, string subject, string message)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ namespace Yavsc.ViewModels.UserFiles
|
||||||
var finalPath = (path==null) ? username : username + Path.DirectorySeparatorChar + path;
|
var finalPath = (path==null) ? username : username + Path.DirectorySeparatorChar + path;
|
||||||
if ( !finalPath.IsValidPath() )
|
if ( !finalPath.IsValidPath() )
|
||||||
throw new InvalidOperationException(
|
throw new InvalidOperationException(
|
||||||
$"File name contains invalid chars, using path {SubPath}");
|
$"File name contains invalid chars, using path {finalPath}");
|
||||||
|
|
||||||
dInfo = new DirectoryInfo(
|
dInfo = new DirectoryInfo(
|
||||||
Path.Combine(Startup.UserFilesDirName,finalPath));
|
Path.Combine(Startup.UserFilesDirName,finalPath));
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,8 @@
|
||||||
"Microsoft.AspNet.Authentication.OAuth": "1.0.0-rc1-final",
|
"Microsoft.AspNet.Authentication.OAuth": "1.0.0-rc1-final",
|
||||||
"Microsoft.AspNet.Mvc.Formatters.Json": "6.0.0-rc1-final",
|
"Microsoft.AspNet.Mvc.Formatters.Json": "6.0.0-rc1-final",
|
||||||
"Microsoft.AspNet.OWin": "1.0.0-rc1-final",
|
"Microsoft.AspNet.OWin": "1.0.0-rc1-final",
|
||||||
"System.Json": "4.0.20126.16343"
|
"System.Json": "4.0.20126.16343",
|
||||||
|
"YavscLib": "1.0.0-*"
|
||||||
},
|
},
|
||||||
"commands": {
|
"commands": {
|
||||||
"web": "Microsoft.AspNet.Server.Kestrel --server.urls http://*:5000",
|
"web": "Microsoft.AspNet.Server.Kestrel --server.urls http://*:5000",
|
||||||
|
|
|
||||||
|
|
@ -2809,6 +2809,10 @@
|
||||||
"lib/WebGrease.dll": {}
|
"lib/WebGrease.dll": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"YavscLib/1.0.0": {
|
||||||
|
"type": "project",
|
||||||
|
"framework": ".NETFramework,Version=v4.5.1"
|
||||||
|
},
|
||||||
"Zlib.Portable.Signed/1.11.0": {
|
"Zlib.Portable.Signed/1.11.0": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
"compile": {
|
"compile": {
|
||||||
|
|
@ -5626,6 +5630,10 @@
|
||||||
"lib/WebGrease.dll": {}
|
"lib/WebGrease.dll": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"YavscLib/1.0.0": {
|
||||||
|
"type": "project",
|
||||||
|
"framework": ".NETFramework,Version=v4.5.1"
|
||||||
|
},
|
||||||
"Zlib.Portable.Signed/1.11.0": {
|
"Zlib.Portable.Signed/1.11.0": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
"compile": {
|
"compile": {
|
||||||
|
|
@ -8443,6 +8451,10 @@
|
||||||
"lib/WebGrease.dll": {}
|
"lib/WebGrease.dll": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"YavscLib/1.0.0": {
|
||||||
|
"type": "project",
|
||||||
|
"framework": ".NETFramework,Version=v4.5.1"
|
||||||
|
},
|
||||||
"Zlib.Portable.Signed/1.11.0": {
|
"Zlib.Portable.Signed/1.11.0": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
"compile": {
|
"compile": {
|
||||||
|
|
@ -8455,6 +8467,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"libraries": {
|
"libraries": {
|
||||||
|
"YavscLib/1.0.0": {
|
||||||
|
"type": "project",
|
||||||
|
"path": "../YavscLib/project.json"
|
||||||
|
},
|
||||||
"Antlr/3.4.1.9004": {
|
"Antlr/3.4.1.9004": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
"sha512": "c1S+HBE+KYA5EBxtn25LEK02hHPH/tDQ6RviUTTCJpZIPoputtn8ArsQJy9lVJWZOnw37ufByO2Fmf1M8wpr8Q==",
|
"sha512": "c1S+HBE+KYA5EBxtn25LEK02hHPH/tDQ6RviUTTCJpZIPoputtn8ArsQJy9lVJWZOnw37ufByO2Fmf1M8wpr8Q==",
|
||||||
|
|
@ -11421,7 +11437,8 @@
|
||||||
"Microsoft.AspNet.Authentication.OAuth >= 1.0.0-rc1-final",
|
"Microsoft.AspNet.Authentication.OAuth >= 1.0.0-rc1-final",
|
||||||
"Microsoft.AspNet.Mvc.Formatters.Json >= 6.0.0-rc1-final",
|
"Microsoft.AspNet.Mvc.Formatters.Json >= 6.0.0-rc1-final",
|
||||||
"Microsoft.AspNet.OWin >= 1.0.0-rc1-final",
|
"Microsoft.AspNet.OWin >= 1.0.0-rc1-final",
|
||||||
"System.Json >= 4.0.20126.16343"
|
"System.Json >= 4.0.20126.16343",
|
||||||
|
"YavscLib >= 1.0.0-*"
|
||||||
],
|
],
|
||||||
"DNX,Version=v4.5.1": [
|
"DNX,Version=v4.5.1": [
|
||||||
"fx/System.Drawing >= 4.0.0"
|
"fx/System.Drawing >= 4.0.0"
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,12 @@ Ceci est une grosse liste de fonctionnalités, existantes, ou à implémenter, o
|
||||||
☐ Podcasts.
|
☐ Podcasts.
|
||||||
☐ Personalisation des blogs.
|
☐ Personalisation des blogs.
|
||||||
☐ Monétarisations.
|
☐ Monétarisations.
|
||||||
|
☐ Distribution de gold card (illimité), de carte vertes (à durée fixe),
|
||||||
|
de la part d'un prestataire, donnant accès au destinataire au chat privé.
|
||||||
|
☐ La carte blanche: en la confiant, le prestataire délègue la gestion de son agenda à un autre utilisateur,
|
||||||
|
elle implique le droit au chat privé
|
||||||
|
☐ de badges temporaires, donnant accès à un téléchargement unique et limité dans le temps, d'un seul fichier,
|
||||||
|
sans autre forme d'autorisation.
|
||||||
|
|
||||||
### Réécritures prévues :
|
### Réécritures prévues :
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
{
|
{
|
||||||
long ContactCredits { get; set; }
|
long ContactCredits { get; set; }
|
||||||
decimal Credits { get; set; }
|
decimal Credits { get; set; }
|
||||||
IApplicationUser Owner { get; set; }
|
|
||||||
string UserId { get; set; }
|
string UserId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
9
YavscLib/IBlackListed.cs
Normal file
9
YavscLib/IBlackListed.cs
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
namespace YavscLib
|
||||||
|
{
|
||||||
|
public interface IBlackListed
|
||||||
|
{
|
||||||
|
long Id { get; set; }
|
||||||
|
string UserId { get; set; }
|
||||||
|
string OwnerId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,15 +4,14 @@ namespace Yavsc.Models
|
||||||
{
|
{
|
||||||
public interface IBlog
|
public interface IBlog
|
||||||
{
|
{
|
||||||
IApplicationUser Author { get; set; }
|
|
||||||
string AuthorId { get; set; }
|
string AuthorId { get; set; }
|
||||||
string bcontent { get; set; }
|
string Content { get; set; }
|
||||||
long Id { get; set; }
|
long Id { get; set; }
|
||||||
DateTime modified { get; set; }
|
DateTime Modified { get; set; }
|
||||||
string photo { get; set; }
|
string Photo { get; set; }
|
||||||
DateTime posted { get; set; }
|
DateTime Posted { get; set; }
|
||||||
int rate { get; set; }
|
int Rate { get; set; }
|
||||||
string title { get; set; }
|
string Title { get; set; }
|
||||||
bool visible { get; set; }
|
bool Visible { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
using System.Resources;
|
using System.Resources;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="project.json" />
|
<Content Include="project.json" />
|
||||||
|
<Content Include="IBlackListed.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 2012
|
# Visual Studio 2012
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yavsc.Client", "Yavsc.Client.csproj", "{67F9D3A8-F71E-4428-913F-C37AE82CDB24}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YavscLib", "YavscLib.csproj", "{67F9D3A8-F71E-4428-913F-C37AE82CDB24}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,13 @@
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"net451": {},
|
"net451": {},
|
||||||
".NETPortable,Version=v4.5,Profile=Profile111": {}
|
".NETPortable,Version=v4.5,Profile=Profile111": {
|
||||||
|
"frameworkAssemblies": {
|
||||||
|
"System.Runtime": "4.0.0",
|
||||||
|
"System.Globalization": "4.0.0",
|
||||||
|
"System.Resources.ResourceManager": "4.0.0",
|
||||||
|
"System.Resources.Reader": "4.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3,14 +3,21 @@
|
||||||
"version": 2,
|
"version": 2,
|
||||||
"targets": {
|
"targets": {
|
||||||
".NETFramework,Version=v4.5.1": {},
|
".NETFramework,Version=v4.5.1": {},
|
||||||
".NETPortable,Version=v4.5,Profile=Profile111": {}
|
".NETPortable,Version=v4.5,Profile=Profile111": {},
|
||||||
|
".NETFramework,Version=v4.5.1/debian.8-x86": {},
|
||||||
|
".NETFramework,Version=v4.5.1/debian.8-x64": {},
|
||||||
|
".NETPortable,Version=v4.5,Profile=Profile111/debian.8-x86": {},
|
||||||
|
".NETPortable,Version=v4.5,Profile=Profile111/debian.8-x64": {}
|
||||||
},
|
},
|
||||||
"libraries": {},
|
"libraries": {},
|
||||||
"projectFileDependencyGroups": {
|
"projectFileDependencyGroups": {
|
||||||
"": [],
|
"": [],
|
||||||
".NETFramework,Version=v4.5.1": [],
|
".NETFramework,Version=v4.5.1": [],
|
||||||
".NETPortable,Version=v4.5,Profile=Profile111": []
|
".NETPortable,Version=v4.5,Profile=Profile111": [
|
||||||
},
|
"fx/System.Runtime >= 4.0.0",
|
||||||
"tools": {},
|
"fx/System.Globalization >= 4.0.0",
|
||||||
"projectFileToolGroups": {}
|
"fx/System.Resources.ResourceManager >= 4.0.0",
|
||||||
|
"fx/System.Resources.Reader >= 4.0.0"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue