Paul Schneider 9 years ago
commit 145fcb923b
43 changed files with 3561 additions and 173 deletions

@ -55,7 +55,7 @@ namespace Yavsc.WebApi.Controllers
if (!result.Succeeded) if (!result.Succeeded)
{ {
AddErrors(result); AddErrors("NewPassword",result);
return new BadRequestObjectResult(ModelState); return new BadRequestObjectResult(ModelState);
} }
} }
@ -74,7 +74,7 @@ namespace Yavsc.WebApi.Controllers
IdentityResult result = await UserManager.AddPasswordAsync(user, model.NewPassword); IdentityResult result = await UserManager.AddPasswordAsync(user, model.NewPassword);
if (!result.Succeeded) if (!result.Succeeded)
{ {
AddErrors (result); AddErrors ("NewPassword",result);
return new BadRequestObjectResult(ModelState); return new BadRequestObjectResult(ModelState);
} }
} }
@ -96,17 +96,17 @@ namespace Yavsc.WebApi.Controllers
if (!result.Succeeded) if (!result.Succeeded)
{ {
AddErrors (result); AddErrors ("Register",result);
return new BadRequestObjectResult(ModelState); return new BadRequestObjectResult(ModelState);
} }
await _signInManager.SignInAsync(user, isPersistent: false); await _signInManager.SignInAsync(user, isPersistent: false);
return Ok(); return Ok();
} }
private void AddErrors(IdentityResult result) private void AddErrors(string key, IdentityResult result)
{ {
foreach (var error in result.Errors) foreach (var error in result.Errors)
{ {
ModelState.AddModelError(string.Empty, error.Description); ModelState.AddModelError(key, error.Description);
} }
} }
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
@ -126,19 +126,39 @@ namespace Yavsc.WebApi.Controllers
return new BadRequestObjectResult( return new BadRequestObjectResult(
new { error = "user not found" }); new { error = "user not found" });
var uid = User.GetUserId(); var uid = User.GetUserId();
if (uid == null)
return new BadRequestObjectResult(
new { error = "user not identified" });
var iduser = await UserManager.FindByIdAsync(uid); var iduser = await UserManager.FindByIdAsync(uid);
var user = new Me(iduser.Id,iduser.UserName, var user = new Me(iduser.Id,iduser.UserName,
new string [] { iduser.Email }, new string [] { iduser.Email },
await UserManager.GetRolesAsync(iduser), await UserManager.GetRolesAsync(iduser),
null // TODO better (an avatar, or Web site url) iduser.Avatar, iduser.PostalAddress?.Address
); );
return Ok(user); return Ok(user);
} }
[HttpPut("~/api/me")]
public async Task<IActionResult> UpdateMe(MyUpdate me)
{
var ko = new BadRequestObjectResult(
new { error = "Specify some valid update request." });
if (me==null) return ko;
if (me.Avatar==null && me.UserName == null) return ko;
var user = await _userManager.FindByIdAsync(User.GetUserId());
if (me.UserName !=null) {
var result = await _userManager.SetUserNameAsync(user, me.UserName);
}
if (me.Avatar!=null) {
user.Avatar = me.Avatar;
var result = await _userManager.UpdateAsync(user);
if (!result.Succeeded)
{
AddErrors("Avatar", result);
return new BadRequestObjectResult(ModelState);
}
}
return Ok();
}
} }
} }

@ -5,28 +5,53 @@ using Microsoft.AspNet.Authorization;
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.Models; using Microsoft.Extensions.Logging;
using Yavsc.Models.Booking;
namespace Yavsc.Controllers namespace Yavsc.Controllers
{ {
using System;
using Yavsc.Model;
using Yavsc.Models;
using Yavsc.Models.Booking;
[Produces("application/json")] [Produces("application/json")]
[Route("api/bookquery"),Authorize(Roles="Performer,Administrator")] [Route("api/bookquery"), Authorize(Roles = "Performer,Administrator")]
public class BookQueryApiController : Controller public class BookQueryApiController : Controller
{ {
private ApplicationDbContext _context; private ApplicationDbContext _context;
private ILogger _logger;
public BookQueryApiController(ApplicationDbContext context) public BookQueryApiController(ApplicationDbContext context, ILoggerFactory loggerFactory)
{ {
_context = context; _context = context;
_logger = loggerFactory.CreateLogger<BookQueryApiController>();
} }
// GET: api/BookQueryApi // GET: api/BookQueryApi
/// <summary>
/// Book queries, by creation order
/// </summary>
/// <param name="maxId">returned Ids must be lower than this value</param>
/// <returns>book queries</returns>
[HttpGet] [HttpGet]
public IEnumerable<BookQuery> GetCommands() public IEnumerable<BookQueryProviderView> GetCommands(long maxId=long.MaxValue)
{ {
var uid = User.GetUserId(); var uid = User.GetUserId();
return _context.Commands.Where(c=>c.ClientId == uid || c.PerformerId == uid); var now = DateTime.Now;
var result = _context.Commands.Include(c => c.Location).
Include(c => c.Client).Where(c => c.PerformerId == uid && c.Id < maxId && c.EventDate > now).
Select(c => new BookQueryProviderView
{
Client = new ClientProviderView { UserName = c.Client.UserName, UserId = c.ClientId },
Location = c.Location,
EventDate = c.EventDate,
Id = c.Id,
Previsional = c.Previsional
}).
OrderBy(c=>c.Id).
Take(25);
return result;
} }
// GET: api/BookQueryApi/5 // GET: api/BookQueryApi/5
@ -40,7 +65,7 @@ namespace Yavsc.Controllers
} }
var uid = User.GetUserId(); var uid = User.GetUserId();
BookQuery bookQuery = _context.Commands.Where(c=>c.ClientId == uid || c.PerformerId == uid).Single(m => m.Id == id); BookQuery bookQuery = _context.Commands.Where(c => c.ClientId == uid || c.PerformerId == uid).Single(m => m.Id == id);
if (bookQuery == null) if (bookQuery == null)
{ {
@ -65,7 +90,7 @@ namespace Yavsc.Controllers
} }
var uid = User.GetUserId(); var uid = User.GetUserId();
if (bookQuery.ClientId != uid) if (bookQuery.ClientId != uid)
return HttpNotFound(); return HttpNotFound();
_context.Entry(bookQuery).State = EntityState.Modified; _context.Entry(bookQuery).State = EntityState.Modified;
@ -97,8 +122,9 @@ namespace Yavsc.Controllers
return HttpBadRequest(ModelState); return HttpBadRequest(ModelState);
} }
var uid = User.GetUserId(); var uid = User.GetUserId();
if (bookQuery.ClientId != uid) { if (bookQuery.ClientId != uid)
ModelState.AddModelError("ClientId","You must be the client at creating a book query"); {
ModelState.AddModelError("ClientId", "You must be the client at creating a book query");
return new BadRequestObjectResult(ModelState); return new BadRequestObjectResult(ModelState);
} }
_context.Commands.Add(bookQuery); _context.Commands.Add(bookQuery);

@ -10,7 +10,7 @@ using Yavsc.Models.Billing;
namespace Yavsc.Controllers namespace Yavsc.Controllers
{ {
[Produces("application/json")] [Produces("application/json")]
[Route("api/do"),Authorize()] [Route("api/estimate"),Authorize()]
public class EstimateApiController : Controller public class EstimateApiController : Controller
{ {
private ApplicationDbContext _context; private ApplicationDbContext _context;
@ -40,7 +40,6 @@ namespace Yavsc.Controllers
return new HttpStatusCodeResult(StatusCodes.Status403Forbidden); return new HttpStatusCodeResult(StatusCodes.Status403Forbidden);
return Ok(_context.Estimates.Where(e=>e.OwnerId == ownerId)); return Ok(_context.Estimates.Where(e=>e.OwnerId == ownerId));
} }
// GET: api/Estimate/5 // GET: api/Estimate/5
[HttpGet("{id}", Name = "GetEstimate")] [HttpGet("{id}", Name = "GetEstimate")]
public IActionResult GetEstimate([FromRoute] long id) public IActionResult GetEstimate([FromRoute] long id)

@ -0,0 +1,76 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Claims;
using Microsoft.AspNet.Authorization;
using Microsoft.AspNet.Mvc;
using Yavsc.Models;
namespace Yavsc.ApiControllers
{
[Authorize,Route("api/fs")]
public class FileSystemApiController : Controller
{
private IAuthorizationService AuthorizationService;
public FileSystemApiController(ApplicationDbContext context,
IAuthorizationService authorizationService)
{
AuthorizationService = authorizationService;
}
[HttpGet()]
public IActionResult Get()
{
return GetDir(null);
}
[HttpGet("{subdir}")]
public IActionResult GetDir(string subdir)
{
var path = User.GetUserId();
if (subdir!=null) path = Path.Combine(path,subdir);
var result = Startup.UserFilesOptions.FileProvider.GetDirectoryContents(path);
return Ok(result.Select(
c => new { Name = c.Name, IdDir = c.IsDirectory }
));
}
public class FileRecievedInfo
{
public string DestDir { get; set; }
public string ContentDisposition { get; set; }
public bool Overriden { get; set; }
}
[HttpPost]
public IEnumerable<FileRecievedInfo> Post()
{
var root = Path.Combine(Startup.UserFilesDirName, User.GetUserId());
foreach (var f in Request.Form.Files.GetFiles("Files"))
{
var item = new FileRecievedInfo();
item.ContentDisposition = f.ContentDisposition;
var fi = new FileInfo(Path.Combine(root, f.ContentDisposition));
if (fi.Exists) item.Overriden = true;
using (var dest = fi.OpenWrite())
{
using (var org = f.OpenReadStream())
{
byte[] buffer = new byte[1024];
int o = 0, c;
while ((c = org.Read(buffer, o, 1024)) > 0)
{
dest.Write(buffer, o, c);
o += 1024;
// TODO quota
}
dest.Close();
org.Close();
}
}
yield return item;
};
}
}
}

@ -7,7 +7,7 @@ using Yavsc.Models;
namespace Yavsc.Controllers namespace Yavsc.Controllers
{ {
[Produces("application/json")] [Produces("application/json")]
[Route("api/PostRateApi")] [Route("~/api/PostRateApi")]
public class PostRateApiController : Controller public class PostRateApiController : Controller
{ {
private ApplicationDbContext _context; private ApplicationDbContext _context;

@ -8,7 +8,7 @@ using Yavsc.Models;
namespace Yavsc.Controllers namespace Yavsc.Controllers
{ {
[Produces("application/json")] [Produces("application/json")]
[Route("api/PostTagsApi")] [Route("~/api/PostTagsApi")]
public class PostTagsApiController : Controller public class PostTagsApiController : Controller
{ {
private ApplicationDbContext _context; private ApplicationDbContext _context;

@ -60,7 +60,6 @@ namespace Yavsc.Controllers
.Include(x => x.PerformerProfile) .Include(x => x.PerformerProfile)
.Include(x => x.PerformerProfile.Performer) .Include(x => x.PerformerProfile.Performer)
.Include(x => x.Location) .Include(x => x.Location)
.Include(x => x.Bill)
.Where(x=> x.ClientId == uid || x.PerformerId == uid) .Where(x=> x.ClientId == uid || x.PerformerId == uid)
.ToList()); .ToList());
} }
@ -135,6 +134,7 @@ namespace Yavsc.Controllers
.FirstOrDefault( .FirstOrDefault(
x => x.PerformerId == command.PerformerId x => x.PerformerId == command.PerformerId
); );
_logger.LogDebug($"Pro: {pro}");
command.PerformerProfile = pro; command.PerformerProfile = pro;
var user = await _userManager.FindByIdAsync( var user = await _userManager.FindByIdAsync(
User.GetUserId() User.GetUserId()
@ -162,7 +162,7 @@ namespace Yavsc.Controllers
var regids = command.PerformerProfile.Performer var regids = command.PerformerProfile.Performer
.Devices.Select(d => d.GCMRegistrationId); .Devices.Select(d => d.GCMRegistrationId);
var sregids = string.Join(",",regids); var sregids = string.Join(",",regids);
grep = await _GCMSender.NotifyAsync(_googleSettings,regids,yaev); grep = await _GCMSender.NotifyBookQueryAsync(_googleSettings,regids,yaev);
} }
// TODO setup a profile choice to allow notifications // TODO setup a profile choice to allow notifications
// both on mailbox and mobile // both on mailbox and mobile
@ -174,8 +174,8 @@ namespace Yavsc.Controllers
await _emailSender.SendEmailAsync( await _emailSender.SendEmailAsync(
_siteSettings, _smtpSettings, _siteSettings, _smtpSettings,
command.PerformerProfile.Performer.Email, command.PerformerProfile.Performer.Email,
yaev.Title, yaev.Topic+" "+yaev.Client.UserName,
$"{yaev.Description}\r\n-- \r\n{yaev.Comment}\r\n" $"{yaev.Message}\r\n-- \r\n{yaev.Previsional}\r\n"
); );
} }
ViewBag.GoogleSettings = _googleSettings; ViewBag.GoogleSettings = _googleSettings;

@ -4,6 +4,10 @@ using Microsoft.AspNet.Http.Features;
using Microsoft.AspNet.Diagnostics; using Microsoft.AspNet.Diagnostics;
using Microsoft.AspNet.Authorization; using Microsoft.AspNet.Authorization;
using Microsoft.AspNet.Hosting; using Microsoft.AspNet.Hosting;
using Yavsc.Models;
using Microsoft.AspNet.Identity;
using System.Linq;
using System.Security.Claims;
namespace Yavsc.Controllers namespace Yavsc.Controllers
{ {
@ -12,12 +16,16 @@ namespace Yavsc.Controllers
{ {
public IHostingEnvironment Hosting { get; set; } public IHostingEnvironment Hosting { get; set; }
private ApplicationDbContext DbContext;
private readonly IHtmlLocalizer _localizer; private readonly IHtmlLocalizer _localizer;
public HomeController(IHtmlLocalizer<Startup> localizer, IHostingEnvironment hosting) public HomeController(IHtmlLocalizer<Startup> localizer, IHostingEnvironment hosting,
ApplicationDbContext context, UserManager<ApplicationUser> userManager)
{ {
_localizer = localizer; _localizer = localizer;
Hosting = hosting; Hosting = hosting;
DbContext = context;
} }
public IActionResult Index() public IActionResult Index()
@ -42,6 +50,11 @@ namespace Yavsc.Controllers
public ActionResult Chat() public ActionResult Chat()
{ {
if (User.Identity.IsAuthenticated) {
string uid = User.GetUserId();
ViewBag.Contacts = DbContext.Contacts.Where(c=>c.OwnerId == uid)
;
}
return View(); return View();
} }

@ -83,6 +83,7 @@ namespace Yavsc.Controllers
: message == ManageMessageId.RemovePhoneSuccess ? "Your phone number was removed." : message == ManageMessageId.RemovePhoneSuccess ? "Your phone number was removed."
: message == ManageMessageId.ChangeNameSuccess ? "Your name was updated." : message == ManageMessageId.ChangeNameSuccess ? "Your name was updated."
: message == ManageMessageId.SetActivitySuccess ? "Your activity was set." : message == ManageMessageId.SetActivitySuccess ? "Your activity was set."
: message == ManageMessageId.AvatarUpdateSuccess ? "Your avatar was updated."
: ""; : "";
var user = await GetCurrentUserAsync(); var user = await GetCurrentUserAsync();
@ -600,6 +601,7 @@ namespace Yavsc.Controllers
RemovePhoneSuccess, RemovePhoneSuccess,
SetActivitySuccess, SetActivitySuccess,
UnsetActivitySuccess, UnsetActivitySuccess,
AvatarUpdateSuccess,
Error Error
} }

@ -1,6 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Authorization; using Microsoft.AspNet.Authorization;
using Microsoft.AspNet.Hosting; using Microsoft.AspNet.Hosting;
@ -42,8 +43,11 @@ namespace Yavsc.Controllers
if (!ModelState.IsValid) if (!ModelState.IsValid)
return new BadRequestObjectResult(ModelState); return new BadRequestObjectResult(ModelState);
var results = new List<string>(); var results = new List<string>();
var uploads = Path.Combine(_environment.WebRootPath, _siteSettings.UserFiles.DirName); var uploads = Path.Combine(
uploads = Path.Combine(uploads, model.PostId.ToString()); Path.Combine(_environment.WebRootPath, _siteSettings.UserFiles.DirName),
User.GetUserId()
);
// uploads = Path.Combine(uploads, model.PostId.ToString());
var spot = new FileSpotInfo(uploads, blogEntry); var spot = new FileSpotInfo(uploads, blogEntry);
if (!await _authorizationService.AuthorizeAsync(User, spot, new EditRequirement())) if (!await _authorizationService.AuthorizeAsync(User, spot, new EditRequirement()))
{ {

@ -1,4 +1,5 @@
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;
@ -11,17 +12,14 @@ namespace Yavsc.Helpers
{ {
var yaev = new BookQueryEvent var yaev = new BookQueryEvent
{ {
Title = query.Client.UserName + " "+ SR["is asking you for a date"]+".", Client = new ClientProviderView { UserName = query.Client.UserName , UserId = query.ClientId } ,
Comment = (query.Previsional != null) ? Previsional = query.Previsional,
SR["Deposit"] + string.Format(": {0:00}", EventDate = query.EventDate,
query.Previsional) : SR["No deposit."],
Description = SR["Address"] + ": " + query.Location.Address + "\n" +
SR["Date"] + ": " + query.EventDate.ToString("D"),
StartDate = query.EventDate,
Location = query.Location, Location = query.Location,
CommandId = query.Id Id = query.Id
}; };
return yaev; return yaev;
} }
} }
} }

@ -21,11 +21,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity;
using Newtonsoft.Json.Linq;
using Yavsc.Models; using Yavsc.Models;
using Yavsc.Models.Auth; using Yavsc.Models.Auth;
using Yavsc.Models.Google.Messaging; using Yavsc.Models.Google.Messaging;
@ -37,7 +34,7 @@ namespace Yavsc.Helpers
/// </summary> /// </summary>
public static class GoogleHelpers public static class GoogleHelpers
{ {
/* WAZA
/// <summary> /// <summary>
/// Notifies the event. /// Notifies the event.
/// </summary> /// </summary>
@ -70,18 +67,17 @@ namespace Yavsc.Helpers
var payload = JObject.Parse(await response.Content.ReadAsStringAsync()); var payload = JObject.Parse(await response.Content.ReadAsStringAsync());
return payload.Value<MessageWithPayloadResponse>(); return payload.Value<MessageWithPayloadResponse>();
} }
*/
public static MessageWithPayloadResponse NotifyEvent<Event> public static MessageWithPayloadResponse NotifyEvent<Event>
(this GoogleAuthSettings googleSettings, IEnumerable<string> regids, Event ev) (this GoogleAuthSettings googleSettings, IEnumerable<string> regids, Event ev)
where Event : YaEvent where Event : IEvent
{ {
var msg = new MessageWithPayload<Event>() var msg = new MessageWithPayload<Event>()
{ {
notification = new Notification() notification = new Notification()
{ {
title = ev.Title, title = ev.Topic+" "+ev.Sender,
body = ev.Description + ev.Comment == null ? body = ev.Message,
"" : "(" + ev.Comment + ")",
icon = "icon" icon = "icon"
}, },
data = ev, data = ev,

@ -58,6 +58,16 @@ namespace Yavsc
Clients.All.addMessage("#"+name,message); Clients.All.addMessage("#"+name,message);
} }
[Authorize]
public void PV (string userId, string message)
{
var sender = Context.User.Identity.Name;
// TODO personal black|white list +
// Contact list allowed only +
// only pro
var hubCxContext = Clients.User(userId);
var cli = Clients.Client(hubCxContext.ConnectionId);
cli.addPV(sender,message);
}
} }
} }

@ -0,0 +1,14 @@
public interface IEvent {
/// <summary>
/// An acceptable topic for this event to be.
/// Should return something like the class name
/// of this object
/// </summary>
/// <returns></returns>
string Topic { get; set ; }
string Sender { get; set ; }
string Message { get; set; }
}

@ -1,7 +1,6 @@
using System; using System;
using Microsoft.Data.Entity; using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure; using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Metadata;
using Microsoft.Data.Entity.Migrations; using Microsoft.Data.Entity.Migrations;
using Yavsc.Models; using Yavsc.Models;

@ -1,5 +1,3 @@
using System;
using System.Collections.Generic;
using Microsoft.Data.Entity.Migrations; using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations namespace Yavsc.Migrations

@ -0,0 +1,747 @@
using System;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Migrations;
using Yavsc.Models;
namespace Yavsc.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20160916075415_estimateFreeFromCatalog")]
partial class estimateFreeFromCatalog
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "7.0.0-rc1-16348");
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRole", b =>
{
b.Property<string>("Id");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.HasAnnotation("Relational:Name", "RoleNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasAnnotation("Relational:TableName", "AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasAnnotation("Relational:TableName", "AspNetUserRoles");
});
modelBuilder.Entity("Yavsc.Location", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Address")
.IsRequired();
b.Property<double>("Latitude");
b.Property<double>("Longitude");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.AccountBalance", b =>
{
b.Property<string>("UserId");
b.Property<long>("ContactCredits");
b.Property<decimal>("Credits");
b.HasKey("UserId");
});
modelBuilder.Entity("Yavsc.Models.Activity", b =>
{
b.Property<string>("Code")
.HasAnnotation("MaxLength", 512);
b.Property<string>("ActorDenomination");
b.Property<string>("Description");
b.Property<string>("ModeratorGroupName");
b.Property<string>("Name")
.IsRequired()
.HasAnnotation("MaxLength", 512);
b.Property<string>("Photo");
b.HasKey("Code");
});
modelBuilder.Entity("Yavsc.Models.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("DedicatedGoogleCalendar");
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
b.Property<bool>("EmailConfirmed");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedUserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<long?>("PostalAddressId");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasAnnotation("Relational:Name", "EmailIndex");
b.HasIndex("NormalizedUserName")
.HasAnnotation("Relational:Name", "UserNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetUsers");
});
modelBuilder.Entity("Yavsc.Models.Auth.Client", b =>
{
b.Property<string>("Id");
b.Property<bool>("Active");
b.Property<string>("DisplayName");
b.Property<string>("LogoutRedirectUri")
.HasAnnotation("MaxLength", 100);
b.Property<string>("RedirectUri");
b.Property<int>("RefreshTokenLifeTime");
b.Property<string>("Secret");
b.Property<int>("Type");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Auth.RefreshToken", b =>
{
b.Property<string>("Id");
b.Property<string>("ClientId")
.IsRequired()
.HasAnnotation("MaxLength", 50);
b.Property<DateTime>("ExpiresUtc");
b.Property<DateTime>("IssuedUtc");
b.Property<string>("ProtectedTicket")
.IsRequired();
b.Property<string>("Subject")
.IsRequired()
.HasAnnotation("MaxLength", 50);
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.BalanceImpact", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("BalanceId")
.IsRequired();
b.Property<DateTime>("ExecDate");
b.Property<decimal>("Impact");
b.Property<string>("Reason")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Billing.CommandLine", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("ArticleId");
b.Property<int>("Count");
b.Property<string>("Description")
.IsRequired();
b.Property<long?>("EstimateId");
b.Property<long?>("EstimateTemplateId");
b.Property<decimal>("UnitaryCost");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Billing.Estimate", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AttachedFilesString");
b.Property<string>("AttachedGraphicsString");
b.Property<string>("ClientId")
.IsRequired();
b.Property<long?>("CommandId");
b.Property<string>("Description");
b.Property<string>("OwnerId")
.IsRequired();
b.Property<int?>("Status");
b.Property<string>("Title");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Billing.EstimateTemplate", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description");
b.Property<string>("OwnerId")
.IsRequired();
b.Property<string>("Title");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Billing.ExceptionSIREN", b =>
{
b.Property<string>("SIREN");
b.HasKey("SIREN");
});
modelBuilder.Entity("Yavsc.Models.Blog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AuthorId");
b.Property<string>("Content");
b.Property<DateTime>("Modified");
b.Property<string>("Photo");
b.Property<DateTime>("Posted")
.ValueGeneratedOnAdd()
.HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP");
b.Property<int>("Rate");
b.Property<string>("Title");
b.Property<bool>("Visible");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Booking.BookQuery", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("CreationDate")
.ValueGeneratedOnAdd()
.HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP");
b.Property<DateTime>("EventDate");
b.Property<int>("Lag");
b.Property<long?>("LocationId");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Circle", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ApplicationUserId");
b.Property<string>("Name");
b.Property<string>("OwnerId");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.CircleMember", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long>("CircleId");
b.Property<string>("MemberId")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Contact", b =>
{
b.Property<string>("OwnerId");
b.Property<string>("UserId");
b.HasKey("OwnerId", "UserId");
});
modelBuilder.Entity("Yavsc.Models.Identity.GoogleCloudMobileDeclaration", b =>
{
b.Property<string>("DeviceId");
b.Property<DateTime>("DeclarationDate")
.ValueGeneratedOnAdd()
.HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP");
b.Property<string>("DeviceOwnerId");
b.Property<string>("GCMRegistrationId")
.IsRequired();
b.Property<string>("Model");
b.Property<string>("Platform");
b.Property<string>("Version");
b.HasKey("DeviceId");
});
modelBuilder.Entity("Yavsc.Models.Market.BaseProduct", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description");
b.Property<string>("Discriminator")
.IsRequired();
b.Property<string>("Name");
b.Property<bool>("Public");
b.HasKey("Id");
b.HasAnnotation("Relational:DiscriminatorProperty", "Discriminator");
b.HasAnnotation("Relational:DiscriminatorValue", "BaseProduct");
});
modelBuilder.Entity("Yavsc.Models.Market.Service", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("BookQueryId");
b.Property<string>("ContextId");
b.Property<string>("Description");
b.Property<string>("Name");
b.Property<bool>("Public");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.OAuth.OAuth2Tokens", b =>
{
b.Property<string>("UserId");
b.Property<string>("AccessToken");
b.Property<DateTime>("Expiration");
b.Property<string>("ExpiresIn");
b.Property<string>("RefreshToken");
b.Property<string>("TokenType");
b.HasKey("UserId");
});
modelBuilder.Entity("Yavsc.Models.PostTag", b =>
{
b.Property<long>("PostId");
b.Property<long>("TagId");
b.HasKey("PostId", "TagId");
});
modelBuilder.Entity("Yavsc.Models.Skill", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<int>("Rate");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Tag", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b =>
{
b.Property<string>("PerformerId");
b.Property<bool>("AcceptGeoLocalization");
b.Property<bool>("AcceptNotifications");
b.Property<bool>("AcceptPublicContact");
b.Property<bool>("Active");
b.Property<string>("ActivityCode")
.IsRequired();
b.Property<int?>("MaxDailyCost");
b.Property<int?>("MinDailyCost");
b.Property<long?>("OfferId");
b.Property<long>("OrganizationAddressId");
b.Property<int>("Rate");
b.Property<string>("SIREN")
.IsRequired()
.HasAnnotation("MaxLength", 14);
b.Property<string>("WebSite");
b.HasKey("PerformerId");
});
modelBuilder.Entity("Yavsc.Models.Market.Product", b =>
{
b.HasBaseType("Yavsc.Models.Market.BaseProduct");
b.Property<decimal>("Depth");
b.Property<decimal>("Height");
b.Property<decimal?>("Price");
b.Property<decimal>("Weight");
b.Property<decimal>("Width");
b.HasAnnotation("Relational:DiscriminatorValue", "Product");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Yavsc.Models.AccountBalance", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithOne()
.HasForeignKey("Yavsc.Models.AccountBalance", "UserId");
});
modelBuilder.Entity("Yavsc.Models.ApplicationUser", b =>
{
b.HasOne("Yavsc.Location")
.WithMany()
.HasForeignKey("PostalAddressId");
});
modelBuilder.Entity("Yavsc.Models.BalanceImpact", b =>
{
b.HasOne("Yavsc.Models.AccountBalance")
.WithMany()
.HasForeignKey("BalanceId");
});
modelBuilder.Entity("Yavsc.Models.Billing.CommandLine", b =>
{
b.HasOne("Yavsc.Models.Market.BaseProduct")
.WithMany()
.HasForeignKey("ArticleId");
b.HasOne("Yavsc.Models.Billing.Estimate")
.WithMany()
.HasForeignKey("EstimateId");
b.HasOne("Yavsc.Models.Billing.EstimateTemplate")
.WithMany()
.HasForeignKey("EstimateTemplateId");
});
modelBuilder.Entity("Yavsc.Models.Billing.Estimate", b =>
{
b.HasOne("Yavsc.Models.Booking.BookQuery")
.WithMany()
.HasForeignKey("CommandId");
});
modelBuilder.Entity("Yavsc.Models.Blog", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("AuthorId");
});
modelBuilder.Entity("Yavsc.Models.Booking.BookQuery", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("Yavsc.Location")
.WithMany()
.HasForeignKey("LocationId");
b.HasOne("Yavsc.Models.Workflow.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("Yavsc.Models.Circle", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ApplicationUserId");
});
modelBuilder.Entity("Yavsc.Models.CircleMember", b =>
{
b.HasOne("Yavsc.Models.Circle")
.WithMany()
.HasForeignKey("CircleId");
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("MemberId");
});
modelBuilder.Entity("Yavsc.Models.Contact", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("Yavsc.Models.Identity.GoogleCloudMobileDeclaration", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("DeviceOwnerId");
});
modelBuilder.Entity("Yavsc.Models.Market.Service", b =>
{
b.HasOne("Yavsc.Models.Booking.BookQuery")
.WithMany()
.HasForeignKey("BookQueryId");
b.HasOne("Yavsc.Models.Activity")
.WithMany()
.HasForeignKey("ContextId");
});
modelBuilder.Entity("Yavsc.Models.PostTag", b =>
{
b.HasOne("Yavsc.Models.Blog")
.WithMany()
.HasForeignKey("PostId");
});
modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b =>
{
b.HasOne("Yavsc.Models.Activity")
.WithMany()
.HasForeignKey("ActivityCode");
b.HasOne("Yavsc.Models.Market.Service")
.WithMany()
.HasForeignKey("OfferId");
b.HasOne("Yavsc.Location")
.WithMany()
.HasForeignKey("OrganizationAddressId");
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("PerformerId");
});
}
}
}

@ -0,0 +1,336 @@
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations
{
public partial class estimateFreeFromCatalog : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_CommandLine_BookQuery_BookQueryId", table: "CommandLine");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_ApplicationUser_ClientId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_PerformerProfile_PerformerId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact");
migrationBuilder.DropForeignKey(name: "FK_PostTag_Blog_PostId", table: "PostTag");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganizationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerformerId", table: "PerformerProfile");
migrationBuilder.DropColumn(name: "BookQueryId", table: "CommandLine");
migrationBuilder.DropColumn(name: "Comment", table: "CommandLine");
migrationBuilder.CreateTable(
name: "EstimateTemplate",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:Serial", true),
Description = table.Column<string>(nullable: true),
OwnerId = table.Column<string>(nullable: false),
Title = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_EstimateTemplate", x => x.Id);
});
migrationBuilder.AddColumn<long>(
name: "BookQueryId",
table: "Service",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Description",
table: "CommandLine",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<long>(
name: "EstimateTemplateId",
table: "CommandLine",
nullable: true);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CommandLine_EstimateTemplate_EstimateTemplateId",
table: "CommandLine",
column: "EstimateTemplateId",
principalTable: "EstimateTemplate",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_ApplicationUser_ClientId",
table: "BookQuery",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_PerformerProfile_PerformerId",
table: "BookQuery",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
table: "Contact",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Service_BookQuery_BookQueryId",
table: "Service",
column: "BookQueryId",
principalTable: "BookQuery",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PostTag_Blog_PostId",
table: "PostTag",
column: "PostId",
principalTable: "Blog",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganizationAddressId",
table: "PerformerProfile",
column: "OrganizationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerformerId",
table: "PerformerProfile",
column: "PerformerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_CommandLine_EstimateTemplate_EstimateTemplateId", table: "CommandLine");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_ApplicationUser_ClientId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_PerformerProfile_PerformerId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact");
migrationBuilder.DropForeignKey(name: "FK_Service_BookQuery_BookQueryId", table: "Service");
migrationBuilder.DropForeignKey(name: "FK_PostTag_Blog_PostId", table: "PostTag");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganizationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerformerId", table: "PerformerProfile");
migrationBuilder.DropColumn(name: "BookQueryId", table: "Service");
migrationBuilder.DropColumn(name: "Description", table: "CommandLine");
migrationBuilder.DropColumn(name: "EstimateTemplateId", table: "CommandLine");
migrationBuilder.DropTable("EstimateTemplate");
migrationBuilder.AddColumn<long>(
name: "BookQueryId",
table: "CommandLine",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Comment",
table: "CommandLine",
nullable: true);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CommandLine_BookQuery_BookQueryId",
table: "CommandLine",
column: "BookQueryId",
principalTable: "BookQuery",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_ApplicationUser_ClientId",
table: "BookQuery",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_PerformerProfile_PerformerId",
table: "BookQuery",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
table: "Contact",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PostTag_Blog_PostId",
table: "PostTag",
column: "PostId",
principalTable: "Blog",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganizationAddressId",
table: "PerformerProfile",
column: "OrganizationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerformerId",
table: "PerformerProfile",
column: "PerformerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}

@ -0,0 +1,740 @@
using System;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Metadata;
using Microsoft.Data.Entity.Migrations;
using Yavsc.Models;
namespace Yavsc.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20160917010249_yaev")]
partial class yaev
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "7.0.0-rc1-16348");
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRole", b =>
{
b.Property<string>("Id");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.HasAnnotation("Relational:Name", "RoleNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasAnnotation("Relational:TableName", "AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasAnnotation("Relational:TableName", "AspNetUserRoles");
});
modelBuilder.Entity("Yavsc.Location", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Address")
.IsRequired();
b.Property<double>("Latitude");
b.Property<double>("Longitude");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.AccountBalance", b =>
{
b.Property<string>("UserId");
b.Property<long>("ContactCredits");
b.Property<decimal>("Credits");
b.HasKey("UserId");
});
modelBuilder.Entity("Yavsc.Models.Activity", b =>
{
b.Property<string>("Code")
.HasAnnotation("MaxLength", 512);
b.Property<string>("ActorDenomination");
b.Property<string>("Description");
b.Property<string>("ModeratorGroupName");
b.Property<string>("Name")
.IsRequired()
.HasAnnotation("MaxLength", 512);
b.Property<string>("Photo");
b.HasKey("Code");
});
modelBuilder.Entity("Yavsc.Models.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("DedicatedGoogleCalendar");
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
b.Property<bool>("EmailConfirmed");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedUserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<long?>("PostalAddressId");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasAnnotation("Relational:Name", "EmailIndex");
b.HasIndex("NormalizedUserName")
.HasAnnotation("Relational:Name", "UserNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetUsers");
});
modelBuilder.Entity("Yavsc.Models.Auth.Client", b =>
{
b.Property<string>("Id");
b.Property<bool>("Active");
b.Property<string>("DisplayName");
b.Property<string>("LogoutRedirectUri")
.HasAnnotation("MaxLength", 100);
b.Property<string>("RedirectUri");
b.Property<int>("RefreshTokenLifeTime");
b.Property<string>("Secret");
b.Property<int>("Type");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Auth.RefreshToken", b =>
{
b.Property<string>("Id");
b.Property<string>("ClientId")
.IsRequired()
.HasAnnotation("MaxLength", 50);
b.Property<DateTime>("ExpiresUtc");
b.Property<DateTime>("IssuedUtc");
b.Property<string>("ProtectedTicket")
.IsRequired();
b.Property<string>("Subject")
.IsRequired()
.HasAnnotation("MaxLength", 50);
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.BalanceImpact", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("BalanceId")
.IsRequired();
b.Property<DateTime>("ExecDate");
b.Property<decimal>("Impact");
b.Property<string>("Reason")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Billing.CommandLine", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("ArticleId");
b.Property<int>("Count");
b.Property<string>("Description")
.IsRequired();
b.Property<long?>("EstimateId");
b.Property<long?>("EstimateTemplateId");
b.Property<decimal>("UnitaryCost");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Billing.Estimate", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AttachedFilesString");
b.Property<string>("AttachedGraphicsString");
b.Property<string>("ClientId")
.IsRequired();
b.Property<long?>("CommandId");
b.Property<string>("Description");
b.Property<string>("OwnerId")
.IsRequired();
b.Property<int?>("Status");
b.Property<string>("Title");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Billing.EstimateTemplate", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description");
b.Property<string>("OwnerId")
.IsRequired();
b.Property<string>("Title");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Billing.ExceptionSIREN", b =>
{
b.Property<string>("SIREN");
b.HasKey("SIREN");
});
modelBuilder.Entity("Yavsc.Models.Blog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AuthorId");
b.Property<string>("Content");
b.Property<DateTime>("Modified");
b.Property<string>("Photo");
b.Property<DateTime>("Posted")
.ValueGeneratedOnAdd()
.HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP");
b.Property<int>("Rate");
b.Property<string>("Title");
b.Property<bool>("Visible");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Booking.BookQuery", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("CreationDate")
.ValueGeneratedOnAdd()
.HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP");
b.Property<DateTime>("EventDate");
b.Property<long?>("LocationId");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Circle", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ApplicationUserId");
b.Property<string>("Name");
b.Property<string>("OwnerId");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.CircleMember", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long>("CircleId");
b.Property<string>("MemberId")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Contact", b =>
{
b.Property<string>("OwnerId");
b.Property<string>("UserId");
b.HasKey("OwnerId", "UserId");
});
modelBuilder.Entity("Yavsc.Models.Identity.GoogleCloudMobileDeclaration", b =>
{
b.Property<string>("DeviceId");
b.Property<DateTime>("DeclarationDate")
.ValueGeneratedOnAdd()
.HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP");
b.Property<string>("DeviceOwnerId");
b.Property<string>("GCMRegistrationId")
.IsRequired();
b.Property<string>("Model");
b.Property<string>("Platform");
b.Property<string>("Version");
b.HasKey("DeviceId");
});
modelBuilder.Entity("Yavsc.Models.Market.BaseProduct", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description");
b.Property<string>("Discriminator")
.IsRequired();
b.Property<string>("Name");
b.Property<bool>("Public");
b.HasKey("Id");
b.HasAnnotation("Relational:DiscriminatorProperty", "Discriminator");
b.HasAnnotation("Relational:DiscriminatorValue", "BaseProduct");
});
modelBuilder.Entity("Yavsc.Models.Market.Service", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ContextId");
b.Property<string>("Description");
b.Property<string>("Name");
b.Property<bool>("Public");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.OAuth.OAuth2Tokens", b =>
{
b.Property<string>("UserId");
b.Property<string>("AccessToken");
b.Property<DateTime>("Expiration");
b.Property<string>("ExpiresIn");
b.Property<string>("RefreshToken");
b.Property<string>("TokenType");
b.HasKey("UserId");
});
modelBuilder.Entity("Yavsc.Models.PostTag", b =>
{
b.Property<long>("PostId");
b.Property<long>("TagId");
b.HasKey("PostId", "TagId");
});
modelBuilder.Entity("Yavsc.Models.Skill", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<int>("Rate");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Tag", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b =>
{
b.Property<string>("PerformerId");
b.Property<bool>("AcceptGeoLocalization");
b.Property<bool>("AcceptNotifications");
b.Property<bool>("AcceptPublicContact");
b.Property<bool>("Active");
b.Property<string>("ActivityCode")
.IsRequired();
b.Property<int?>("MaxDailyCost");
b.Property<int?>("MinDailyCost");
b.Property<long?>("OfferId");
b.Property<long>("OrganizationAddressId");
b.Property<int>("Rate");
b.Property<string>("SIREN")
.IsRequired()
.HasAnnotation("MaxLength", 14);
b.Property<string>("WebSite");
b.HasKey("PerformerId");
});
modelBuilder.Entity("Yavsc.Models.Market.Product", b =>
{
b.HasBaseType("Yavsc.Models.Market.BaseProduct");
b.Property<decimal>("Depth");
b.Property<decimal>("Height");
b.Property<decimal?>("Price");
b.Property<decimal>("Weight");
b.Property<decimal>("Width");
b.HasAnnotation("Relational:DiscriminatorValue", "Product");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Yavsc.Models.AccountBalance", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithOne()
.HasForeignKey("Yavsc.Models.AccountBalance", "UserId");
});
modelBuilder.Entity("Yavsc.Models.ApplicationUser", b =>
{
b.HasOne("Yavsc.Location")
.WithMany()
.HasForeignKey("PostalAddressId");
});
modelBuilder.Entity("Yavsc.Models.BalanceImpact", b =>
{
b.HasOne("Yavsc.Models.AccountBalance")
.WithMany()
.HasForeignKey("BalanceId");
});
modelBuilder.Entity("Yavsc.Models.Billing.CommandLine", b =>
{
b.HasOne("Yavsc.Models.Market.BaseProduct")
.WithMany()
.HasForeignKey("ArticleId");
b.HasOne("Yavsc.Models.Billing.Estimate")
.WithMany()
.HasForeignKey("EstimateId");
b.HasOne("Yavsc.Models.Billing.EstimateTemplate")
.WithMany()
.HasForeignKey("EstimateTemplateId");
});
modelBuilder.Entity("Yavsc.Models.Billing.Estimate", b =>
{
b.HasOne("Yavsc.Models.Booking.BookQuery")
.WithMany()
.HasForeignKey("CommandId");
});
modelBuilder.Entity("Yavsc.Models.Blog", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("AuthorId");
});
modelBuilder.Entity("Yavsc.Models.Booking.BookQuery", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("Yavsc.Location")
.WithMany()
.HasForeignKey("LocationId");
b.HasOne("Yavsc.Models.Workflow.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("Yavsc.Models.Circle", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ApplicationUserId");
});
modelBuilder.Entity("Yavsc.Models.CircleMember", b =>
{
b.HasOne("Yavsc.Models.Circle")
.WithMany()
.HasForeignKey("CircleId");
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("MemberId");
});
modelBuilder.Entity("Yavsc.Models.Contact", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("Yavsc.Models.Identity.GoogleCloudMobileDeclaration", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("DeviceOwnerId");
});
modelBuilder.Entity("Yavsc.Models.Market.Service", b =>
{
b.HasOne("Yavsc.Models.Activity")
.WithMany()
.HasForeignKey("ContextId");
});
modelBuilder.Entity("Yavsc.Models.PostTag", b =>
{
b.HasOne("Yavsc.Models.Blog")
.WithMany()
.HasForeignKey("PostId");
});
modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b =>
{
b.HasOne("Yavsc.Models.Activity")
.WithMany()
.HasForeignKey("ActivityCode");
b.HasOne("Yavsc.Models.Market.Service")
.WithMany()
.HasForeignKey("OfferId");
b.HasOne("Yavsc.Location")
.WithMany()
.HasForeignKey("OrganizationAddressId");
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("PerformerId");
});
}
}
}

@ -0,0 +1,292 @@
using System;
using System.Collections.Generic;
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations
{
public partial class yaev : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_ApplicationUser_ClientId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_PerformerProfile_PerformerId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact");
migrationBuilder.DropForeignKey(name: "FK_Service_BookQuery_BookQueryId", table: "Service");
migrationBuilder.DropForeignKey(name: "FK_PostTag_Blog_PostId", table: "PostTag");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganizationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerformerId", table: "PerformerProfile");
migrationBuilder.DropColumn(name: "BookQueryId", table: "Service");
migrationBuilder.DropColumn(name: "Lag", table: "BookQuery");
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_ApplicationUser_ClientId",
table: "BookQuery",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_PerformerProfile_PerformerId",
table: "BookQuery",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
table: "Contact",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PostTag_Blog_PostId",
table: "PostTag",
column: "PostId",
principalTable: "Blog",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganizationAddressId",
table: "PerformerProfile",
column: "OrganizationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerformerId",
table: "PerformerProfile",
column: "PerformerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_ApplicationUser_ClientId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_PerformerProfile_PerformerId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact");
migrationBuilder.DropForeignKey(name: "FK_PostTag_Blog_PostId", table: "PostTag");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganizationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerformerId", table: "PerformerProfile");
migrationBuilder.AddColumn<long>(
name: "BookQueryId",
table: "Service",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "Lag",
table: "BookQuery",
nullable: false,
defaultValue: 0);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_ApplicationUser_ClientId",
table: "BookQuery",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_PerformerProfile_PerformerId",
table: "BookQuery",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
table: "Contact",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Service_BookQuery_BookQueryId",
table: "Service",
column: "BookQueryId",
principalTable: "BookQuery",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PostTag_Blog_PostId",
table: "PostTag",
column: "PostId",
principalTable: "Blog",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganizationAddressId",
table: "PerformerProfile",
column: "OrganizationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerformerId",
table: "PerformerProfile",
column: "PerformerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}

@ -0,0 +1,742 @@
using System;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Metadata;
using Microsoft.Data.Entity.Migrations;
using Yavsc.Models;
namespace Yavsc.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20160920215459_avatar")]
partial class avatar
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "7.0.0-rc1-16348");
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRole", b =>
{
b.Property<string>("Id");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.HasAnnotation("Relational:Name", "RoleNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasAnnotation("Relational:TableName", "AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasAnnotation("Relational:TableName", "AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasAnnotation("Relational:TableName", "AspNetUserRoles");
});
modelBuilder.Entity("Yavsc.Location", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Address")
.IsRequired();
b.Property<double>("Latitude");
b.Property<double>("Longitude");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.AccountBalance", b =>
{
b.Property<string>("UserId");
b.Property<long>("ContactCredits");
b.Property<decimal>("Credits");
b.HasKey("UserId");
});
modelBuilder.Entity("Yavsc.Models.Activity", b =>
{
b.Property<string>("Code")
.HasAnnotation("MaxLength", 512);
b.Property<string>("ActorDenomination");
b.Property<string>("Description");
b.Property<string>("ModeratorGroupName");
b.Property<string>("Name")
.IsRequired()
.HasAnnotation("MaxLength", 512);
b.Property<string>("Photo");
b.HasKey("Code");
});
modelBuilder.Entity("Yavsc.Models.ApplicationUser", b =>
{
b.Property<string>("Id");
b.Property<int>("AccessFailedCount");
b.Property<string>("Avatar");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("DedicatedGoogleCalendar");
b.Property<string>("Email")
.HasAnnotation("MaxLength", 256);
b.Property<bool>("EmailConfirmed");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasAnnotation("MaxLength", 256);
b.Property<string>("NormalizedUserName")
.HasAnnotation("MaxLength", 256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<long?>("PostalAddressId");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasAnnotation("MaxLength", 256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasAnnotation("Relational:Name", "EmailIndex");
b.HasIndex("NormalizedUserName")
.HasAnnotation("Relational:Name", "UserNameIndex");
b.HasAnnotation("Relational:TableName", "AspNetUsers");
});
modelBuilder.Entity("Yavsc.Models.Auth.Client", b =>
{
b.Property<string>("Id");
b.Property<bool>("Active");
b.Property<string>("DisplayName");
b.Property<string>("LogoutRedirectUri")
.HasAnnotation("MaxLength", 100);
b.Property<string>("RedirectUri");
b.Property<int>("RefreshTokenLifeTime");
b.Property<string>("Secret");
b.Property<int>("Type");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Auth.RefreshToken", b =>
{
b.Property<string>("Id");
b.Property<string>("ClientId")
.IsRequired()
.HasAnnotation("MaxLength", 50);
b.Property<DateTime>("ExpiresUtc");
b.Property<DateTime>("IssuedUtc");
b.Property<string>("ProtectedTicket")
.IsRequired();
b.Property<string>("Subject")
.IsRequired()
.HasAnnotation("MaxLength", 50);
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.BalanceImpact", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("BalanceId")
.IsRequired();
b.Property<DateTime>("ExecDate");
b.Property<decimal>("Impact");
b.Property<string>("Reason")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Billing.CommandLine", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("ArticleId");
b.Property<int>("Count");
b.Property<string>("Description")
.IsRequired();
b.Property<long?>("EstimateId");
b.Property<long?>("EstimateTemplateId");
b.Property<decimal>("UnitaryCost");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Billing.Estimate", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AttachedFilesString");
b.Property<string>("AttachedGraphicsString");
b.Property<string>("ClientId")
.IsRequired();
b.Property<long?>("CommandId");
b.Property<string>("Description");
b.Property<string>("OwnerId")
.IsRequired();
b.Property<int?>("Status");
b.Property<string>("Title");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Billing.EstimateTemplate", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description");
b.Property<string>("OwnerId")
.IsRequired();
b.Property<string>("Title");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Billing.ExceptionSIREN", b =>
{
b.Property<string>("SIREN");
b.HasKey("SIREN");
});
modelBuilder.Entity("Yavsc.Models.Blog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AuthorId");
b.Property<string>("Content");
b.Property<DateTime>("Modified");
b.Property<string>("Photo");
b.Property<DateTime>("Posted")
.ValueGeneratedOnAdd()
.HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP");
b.Property<int>("Rate");
b.Property<string>("Title");
b.Property<bool>("Visible");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Booking.BookQuery", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClientId")
.IsRequired();
b.Property<DateTime>("CreationDate")
.ValueGeneratedOnAdd()
.HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP");
b.Property<DateTime>("EventDate");
b.Property<long?>("LocationId");
b.Property<string>("PerformerId")
.IsRequired();
b.Property<decimal?>("Previsional");
b.Property<DateTime?>("ValidationDate");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Circle", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ApplicationUserId");
b.Property<string>("Name");
b.Property<string>("OwnerId");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.CircleMember", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long>("CircleId");
b.Property<string>("MemberId")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Contact", b =>
{
b.Property<string>("OwnerId");
b.Property<string>("UserId");
b.HasKey("OwnerId", "UserId");
});
modelBuilder.Entity("Yavsc.Models.Identity.GoogleCloudMobileDeclaration", b =>
{
b.Property<string>("DeviceId");
b.Property<DateTime>("DeclarationDate")
.ValueGeneratedOnAdd()
.HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP");
b.Property<string>("DeviceOwnerId");
b.Property<string>("GCMRegistrationId")
.IsRequired();
b.Property<string>("Model");
b.Property<string>("Platform");
b.Property<string>("Version");
b.HasKey("DeviceId");
});
modelBuilder.Entity("Yavsc.Models.Market.BaseProduct", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description");
b.Property<string>("Discriminator")
.IsRequired();
b.Property<string>("Name");
b.Property<bool>("Public");
b.HasKey("Id");
b.HasAnnotation("Relational:DiscriminatorProperty", "Discriminator");
b.HasAnnotation("Relational:DiscriminatorValue", "BaseProduct");
});
modelBuilder.Entity("Yavsc.Models.Market.Service", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ContextId");
b.Property<string>("Description");
b.Property<string>("Name");
b.Property<bool>("Public");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.OAuth.OAuth2Tokens", b =>
{
b.Property<string>("UserId");
b.Property<string>("AccessToken");
b.Property<DateTime>("Expiration");
b.Property<string>("ExpiresIn");
b.Property<string>("RefreshToken");
b.Property<string>("TokenType");
b.HasKey("UserId");
});
modelBuilder.Entity("Yavsc.Models.PostTag", b =>
{
b.Property<long>("PostId");
b.Property<long>("TagId");
b.HasKey("PostId", "TagId");
});
modelBuilder.Entity("Yavsc.Models.Skill", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name");
b.Property<int>("Rate");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Tag", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name")
.IsRequired();
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b =>
{
b.Property<string>("PerformerId");
b.Property<bool>("AcceptGeoLocalization");
b.Property<bool>("AcceptNotifications");
b.Property<bool>("AcceptPublicContact");
b.Property<bool>("Active");
b.Property<string>("ActivityCode")
.IsRequired();
b.Property<int?>("MaxDailyCost");
b.Property<int?>("MinDailyCost");
b.Property<long?>("OfferId");
b.Property<long>("OrganizationAddressId");
b.Property<int>("Rate");
b.Property<string>("SIREN")
.IsRequired()
.HasAnnotation("MaxLength", 14);
b.Property<string>("WebSite");
b.HasKey("PerformerId");
});
modelBuilder.Entity("Yavsc.Models.Market.Product", b =>
{
b.HasBaseType("Yavsc.Models.Market.BaseProduct");
b.Property<decimal>("Depth");
b.Property<decimal>("Height");
b.Property<decimal?>("Price");
b.Property<decimal>("Weight");
b.Property<decimal>("Width");
b.HasAnnotation("Relational:DiscriminatorValue", "Product");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<string>", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<string>", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole")
.WithMany()
.HasForeignKey("RoleId");
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("Yavsc.Models.AccountBalance", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithOne()
.HasForeignKey("Yavsc.Models.AccountBalance", "UserId");
});
modelBuilder.Entity("Yavsc.Models.ApplicationUser", b =>
{
b.HasOne("Yavsc.Location")
.WithMany()
.HasForeignKey("PostalAddressId");
});
modelBuilder.Entity("Yavsc.Models.BalanceImpact", b =>
{
b.HasOne("Yavsc.Models.AccountBalance")
.WithMany()
.HasForeignKey("BalanceId");
});
modelBuilder.Entity("Yavsc.Models.Billing.CommandLine", b =>
{
b.HasOne("Yavsc.Models.Market.BaseProduct")
.WithMany()
.HasForeignKey("ArticleId");
b.HasOne("Yavsc.Models.Billing.Estimate")
.WithMany()
.HasForeignKey("EstimateId");
b.HasOne("Yavsc.Models.Billing.EstimateTemplate")
.WithMany()
.HasForeignKey("EstimateTemplateId");
});
modelBuilder.Entity("Yavsc.Models.Billing.Estimate", b =>
{
b.HasOne("Yavsc.Models.Booking.BookQuery")
.WithMany()
.HasForeignKey("CommandId");
});
modelBuilder.Entity("Yavsc.Models.Blog", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("AuthorId");
});
modelBuilder.Entity("Yavsc.Models.Booking.BookQuery", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ClientId");
b.HasOne("Yavsc.Location")
.WithMany()
.HasForeignKey("LocationId");
b.HasOne("Yavsc.Models.Workflow.PerformerProfile")
.WithMany()
.HasForeignKey("PerformerId");
});
modelBuilder.Entity("Yavsc.Models.Circle", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("ApplicationUserId");
});
modelBuilder.Entity("Yavsc.Models.CircleMember", b =>
{
b.HasOne("Yavsc.Models.Circle")
.WithMany()
.HasForeignKey("CircleId");
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("MemberId");
});
modelBuilder.Entity("Yavsc.Models.Contact", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("OwnerId");
});
modelBuilder.Entity("Yavsc.Models.Identity.GoogleCloudMobileDeclaration", b =>
{
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("DeviceOwnerId");
});
modelBuilder.Entity("Yavsc.Models.Market.Service", b =>
{
b.HasOne("Yavsc.Models.Activity")
.WithMany()
.HasForeignKey("ContextId");
});
modelBuilder.Entity("Yavsc.Models.PostTag", b =>
{
b.HasOne("Yavsc.Models.Blog")
.WithMany()
.HasForeignKey("PostId");
});
modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b =>
{
b.HasOne("Yavsc.Models.Activity")
.WithMany()
.HasForeignKey("ActivityCode");
b.HasOne("Yavsc.Models.Market.Service")
.WithMany()
.HasForeignKey("OfferId");
b.HasOne("Yavsc.Location")
.WithMany()
.HasForeignKey("OrganizationAddressId");
b.HasOne("Yavsc.Models.ApplicationUser")
.WithMany()
.HasForeignKey("PerformerId");
});
}
}
}

@ -0,0 +1,278 @@
using System;
using System.Collections.Generic;
using Microsoft.Data.Entity.Migrations;
namespace Yavsc.Migrations
{
public partial class avatar : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_ApplicationUser_ClientId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_PerformerProfile_PerformerId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact");
migrationBuilder.DropForeignKey(name: "FK_PostTag_Blog_PostId", table: "PostTag");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganizationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerformerId", table: "PerformerProfile");
migrationBuilder.AddColumn<string>(
name: "Avatar",
table: "AspNetUsers",
nullable: true);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_ApplicationUser_ClientId",
table: "BookQuery",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_PerformerProfile_PerformerId",
table: "BookQuery",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
table: "Contact",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PostTag_Blog_PostId",
table: "PostTag",
column: "PostId",
principalTable: "Blog",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganizationAddressId",
table: "PerformerProfile",
column: "OrganizationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerformerId",
table: "PerformerProfile",
column: "PerformerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance");
migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_ApplicationUser_ClientId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_BookQuery_PerformerProfile_PerformerId", table: "BookQuery");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember");
migrationBuilder.DropForeignKey(name: "FK_Contact_ApplicationUser_OwnerId", table: "Contact");
migrationBuilder.DropForeignKey(name: "FK_PostTag_Blog_PostId", table: "PostTag");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Activity_ActivityCode", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganizationAddressId", table: "PerformerProfile");
migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerformerId", table: "PerformerProfile");
migrationBuilder.DropColumn(name: "Avatar", table: "AspNetUsers");
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_AccountBalance_ApplicationUser_UserId",
table: "AccountBalance",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BalanceImpact_AccountBalance_BalanceId",
table: "BalanceImpact",
column: "BalanceId",
principalTable: "AccountBalance",
principalColumn: "UserId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_ApplicationUser_ClientId",
table: "BookQuery",
column: "ClientId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_BookQuery_PerformerProfile_PerformerId",
table: "BookQuery",
column: "PerformerId",
principalTable: "PerformerProfile",
principalColumn: "PerformerId",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_Circle_CircleId",
table: "CircleMember",
column: "CircleId",
principalTable: "Circle",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_CircleMember_ApplicationUser_MemberId",
table: "CircleMember",
column: "MemberId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Contact_ApplicationUser_OwnerId",
table: "Contact",
column: "OwnerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PostTag_Blog_PostId",
table: "PostTag",
column: "PostId",
principalTable: "Blog",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Activity_ActivityCode",
table: "PerformerProfile",
column: "ActivityCode",
principalTable: "Activity",
principalColumn: "Code",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_Location_OrganizationAddressId",
table: "PerformerProfile",
column: "OrganizationAddressId",
principalTable: "Location",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_PerformerProfile_ApplicationUser_PerformerId",
table: "PerformerProfile",
column: "PerformerId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}

@ -149,6 +149,8 @@ namespace Yavsc.Migrations
b.Property<int>("AccessFailedCount"); b.Property<int>("AccessFailedCount");
b.Property<string>("Avatar");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken(); .IsConcurrencyToken();
@ -264,14 +266,15 @@ namespace Yavsc.Migrations
b.Property<long?>("ArticleId"); b.Property<long?>("ArticleId");
b.Property<long?>("BookQueryId");
b.Property<string>("Comment");
b.Property<int>("Count"); b.Property<int>("Count");
b.Property<string>("Description")
.IsRequired();
b.Property<long?>("EstimateId"); b.Property<long?>("EstimateId");
b.Property<long?>("EstimateTemplateId");
b.Property<decimal>("UnitaryCost"); b.Property<decimal>("UnitaryCost");
b.HasKey("Id"); b.HasKey("Id");
@ -303,6 +306,21 @@ namespace Yavsc.Migrations
b.HasKey("Id"); b.HasKey("Id");
}); });
modelBuilder.Entity("Yavsc.Models.Billing.EstimateTemplate", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description");
b.Property<string>("OwnerId")
.IsRequired();
b.Property<string>("Title");
b.HasKey("Id");
});
modelBuilder.Entity("Yavsc.Models.Billing.ExceptionSIREN", b => modelBuilder.Entity("Yavsc.Models.Billing.ExceptionSIREN", b =>
{ {
b.Property<string>("SIREN"); b.Property<string>("SIREN");
@ -350,8 +368,6 @@ namespace Yavsc.Migrations
b.Property<DateTime>("EventDate"); b.Property<DateTime>("EventDate");
b.Property<int>("Lag");
b.Property<long?>("LocationId"); b.Property<long?>("LocationId");
b.Property<string>("PerformerId") b.Property<string>("PerformerId")
@ -618,13 +634,13 @@ namespace Yavsc.Migrations
.WithMany() .WithMany()
.HasForeignKey("ArticleId"); .HasForeignKey("ArticleId");
b.HasOne("Yavsc.Models.Booking.BookQuery")
.WithMany()
.HasForeignKey("BookQueryId");
b.HasOne("Yavsc.Models.Billing.Estimate") b.HasOne("Yavsc.Models.Billing.Estimate")
.WithMany() .WithMany()
.HasForeignKey("EstimateId"); .HasForeignKey("EstimateId");
b.HasOne("Yavsc.Models.Billing.EstimateTemplate")
.WithMany()
.HasForeignKey("EstimateTemplateId");
}); });
modelBuilder.Entity("Yavsc.Models.Billing.Estimate", b => modelBuilder.Entity("Yavsc.Models.Billing.Estimate", b =>

@ -181,6 +181,6 @@ namespace Yavsc.Models
public DbSet<EstimateTemplate> EstimateTemplates { get; set; } public DbSet<EstimateTemplate> EstimateTemplates { get; set; }
public DbSet<Contact> Contacts { get; set; }
} }
} }

@ -10,7 +10,9 @@ namespace Yavsc.Models.Billing
[Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)] [Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id { get; set; } public long Id { get; set; }
public string Comment { get; set; }
[Required]
public string Description { get; set; }
public BaseProduct Article { get; set; } public BaseProduct Article { get; set; }
public int Count { get; set; } public int Count { get; set; }
public decimal UnitaryCost { get; set; } public decimal UnitaryCost { get; set; }

@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using Yavsc.Models.Market; using Yavsc.Models.Market;
@ -40,12 +39,7 @@ namespace Yavsc.Models.Billing
/// The bill /// The bill
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public List<Service> Bill { get; set; } = new List<Service>();
///<summary>
/// Time span in seconds in which
/// Validation will be considered as definitive
///</summary>
public int Lag { get; set; }
} }
} }

@ -18,29 +18,22 @@ namespace Yavsc.Models.Booking
[Display(Name="Event date")] [Display(Name="Event date")]
public DateTime EventDate{ public DateTime EventDate{
get get;
{ return ((RendezVous)Bill[0]).EventDate; } set;
set { ((RendezVous)Bill[0]).EventDate = value; }
} }
public Location Location { public Location Location {
get get;
{ return ((RendezVous)Bill[0]).Location; } set;
set { ((RendezVous)Bill[0]).Location = value; }} }
public BookQuery() public BookQuery()
{ {
this.Bill.Add(new RendezVous());
} }
public BookQuery(Location eventLocation, DateTime eventDate) public BookQuery(Location eventLocation, DateTime eventDate)
{ {
this.Bill.Add(new RendezVous{ Location = eventLocation;
Location = eventLocation, EventDate = eventDate;
EventDate = eventDate
});
}
public string GetDescription() {
return $"{Location?.Address} {EventDate.ToString()}";
} }
} }
} }

@ -30,13 +30,6 @@ namespace Yavsc.Models.Calendar
/// Provided event. /// Provided event.
/// </summary> /// </summary>
public class ProvidedEvent : YaEvent { public class ProvidedEvent : YaEvent {
public ProvidedEvent(string topic) : base(topic)
{
}
/// <summary> /// <summary>
/// The privacy. /// The privacy.
/// </summary> /// </summary>

@ -9,24 +9,62 @@ namespace Yavsc.Models
{ {
public class ApplicationUser : IdentityUser public class ApplicationUser : IdentityUser
{ {
/// <summary>
[Display(Name="AccountBalance")] /// Another me, as a byte array.
/// This value points a picture that may be used
/// to sign documents.
/// </summary>
/// <returns>the path to an user's image, relative to it's dir<summary>
/// <see>Startup.UserFilesOptions</see>
/// </summary>
/// <returns></returns>
public string Avatar { get; set; }
/// <summary>
/// WIP Paypal
/// </summary>
/// <returns></returns>
[Display(Name="Account balance")]
public virtual AccountBalance AccountBalance { get; set; } public virtual AccountBalance AccountBalance { get; set; }
/// <summary>
/// User's posts
/// </summary>
/// <returns></returns>
[InverseProperty("Author")] [InverseProperty("Author")]
public virtual List<Blog> Posts { get; set; } public virtual List<Blog> Posts { get; set; }
/// <summary>
/// User's contact list
/// </summary>
/// <returns></returns>
[InverseProperty("Owner")] [InverseProperty("Owner")]
public virtual List<Contact> Book { get; set; } public virtual List<Contact> Book { get; set; }
/// <summary>
/// External devices using the API
/// </summary>
/// <returns></returns>
[InverseProperty("DeviceOwner")] [InverseProperty("DeviceOwner")]
public virtual List<GoogleCloudMobileDeclaration> Devices { get; set; } public virtual List<GoogleCloudMobileDeclaration> Devices { get; set; }
/// <summary>
/// User's circles
/// </summary>
/// <returns></returns>
[InverseProperty("Owner")] [InverseProperty("Owner")]
public virtual List<Circle> Circles { get; set; } public virtual List<Circle> Circles { get; set; }
/// <summary>
/// Billing postal address
/// </summary>
/// <returns></returns>
public virtual Location PostalAddress { get; set; } public virtual Location PostalAddress { get; set; }
/// <summary>
/// User's Google calendar
/// </summary>
/// <returns></returns>
public string DedicatedGoogleCalendar { get; set; } public string DedicatedGoogleCalendar { get; set; }
public override string ToString() { public override string ToString() {

@ -27,7 +27,23 @@ namespace Yavsc.Models.Messaging
/// <summary> /// <summary>
/// Base event. /// Base event.
/// </summary> /// </summary>
public class BaseEvent: ITitle
public class BaseEvent : IEvent {
public BaseEvent()
{
Topic = GetType().Name;
}
public BaseEvent(string topic)
{
Topic = topic;
}
public string Topic { get; set; }
public string Sender { get; set; }
public string Message { get; set; }
}
public class GeneralEvent: BaseEvent, ITitle
{ {
/// <summary> /// <summary>
/// The title. /// The title.

@ -1,8 +1,7 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.Models.Messaging namespace Yavsc.Models.Messaging
{ {
using Yavsc.Model;
// //
// BookQueryEvent.cs // BookQueryEvent.cs
@ -25,31 +24,27 @@ namespace Yavsc.Models.Messaging
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
public class BookQueryEvent: YaEvent public class BookQueryEvent: BookQueryProviderView, IEvent
{ {
public BookQueryEvent() : base("BookQuery") public BookQueryEvent()
{ {
Topic = "BookQuery";
}
public string Message
{
get; set;
} }
/// <summary>
/// The location.
/// </summary>
[Display(Name="Location")]
public Location Location { get; set; }
/// <summary>
/// The start date.
/// </summary>
[Display(Name="StartDate")]
public DateTime StartDate { get; set; }
/// <summary> public string Sender
/// Gets or sets the end date. {
/// </summary> get; set;
/// <value>The end date.</value> }
[Display(Name="EndDate")]
public DateTime EndDate { get; set; }
public long CommandId { get; set; } public string Topic
} {
get; set;
}
}
} }

@ -29,11 +29,6 @@ namespace Yavsc.Models.Messaging
/// </summary> /// </summary>
public class CircleEvent: YaEvent public class CircleEvent: YaEvent
{ {
public CircleEvent(string topic) : base(topic)
{
}
/// <summary> /// <summary>
/// Gets or sets the circles. /// Gets or sets the circles.
/// </summary> /// </summary>

@ -0,0 +1,21 @@
using System;
namespace Yavsc.Model
{
public class BookQueryProviderView { 
public ClientProviderView Client { get; set; }
public Location Location { get; set; }
public long Id { get; set; }
public DateTime EventDate { get ; set; }
public decimal? Previsional { get; set; }
}
public class ClientProviderView { 
public string UserName { get; set; }
public string UserId { get; set; }
public int Rate { get; set; }
}
}

@ -28,24 +28,12 @@ namespace Yavsc.Models.Messaging
/// </summary> /// </summary>
public class YaEvent : BaseEvent public class YaEvent : BaseEvent
{ {
public YaEvent(string topic)
{
Topic = topic;
}
/// <summary>
/// The topic.
/// </summary>
public string Topic { get; set; }
/// <summary> /// <summary>
/// The NF provider identifier. /// The NF provider identifier.
/// </summary> /// </summary>
[Display(Name="ProviderId")] [Display(Name="From")]
public string ProviderId { get; set; } public string FromUserName { get; set; }
/// <summary>
/// The promotion code.
/// </summary>
[Display(Name="Comment")]
public string Comment { get; set; }
/// <summary> /// <summary>
/// The event web page. /// The event web page.
/// </summary> /// </summary>

@ -12,7 +12,10 @@ namespace Yavsc.Models
[Required()] [Required()]
public string OwnerId { get; set; } public string OwnerId { get; set; }
[ForeignKeyAttribute("OwnerId"),JsonIgnore] [ForeignKeyAttribute("OwnerId"),NotMapped]
public virtual ApplicationUser Owner { get; set; } public virtual ApplicationUser Owner { get; set; }
[ForeignKeyAttribute("UserId"),NotMapped]
public virtual ApplicationUser User { get; set; }
} }
} }

@ -8,6 +8,6 @@ namespace Yavsc.Services
{ {
public interface IGoogleCloudMessageSender public interface IGoogleCloudMessageSender
{ {
Task<MessageWithPayloadResponse> NotifyAsync(GoogleAuthSettings googlesettings, IEnumerable<string> registrationId, YaEvent ev); Task<MessageWithPayloadResponse> NotifyBookQueryAsync(GoogleAuthSettings googlesettings, IEnumerable<string> registrationId, BookQueryEvent ev);
} }
} }

@ -28,11 +28,11 @@ namespace Yavsc.Services
/// <c>bool somethingsent = (response.failure == 0 &amp;&amp; response.success > 0)</c> /// <c>bool somethingsent = (response.failure == 0 &amp;&amp; response.success > 0)</c>
/// </returns> /// </returns>
public async Task<MessageWithPayloadResponse> public async Task<MessageWithPayloadResponse>
NotifyAsync(GoogleAuthSettings googleSettings, IEnumerable<string> registrationIds, YaEvent ev) NotifyBookQueryAsync(GoogleAuthSettings googleSettings, IEnumerable<string> registrationIds, BookQueryEvent ev)
{ {
MessageWithPayloadResponse response = null; MessageWithPayloadResponse response = null;
await Task.Run(()=>{ await Task.Run(()=>{
response = googleSettings.NotifyEvent(registrationIds, ev); response = googleSettings.NotifyEvent<BookQueryEvent>(registrationIds, ev);
}); });
return response; return response;
} }

@ -11,26 +11,24 @@ namespace Yavsc
public partial class Startup public partial class Startup
{ {
public static string UserFilesDirName { get; private set; } public static string UserFilesDirName { get; private set; }
public static FileServerOptions UserFilesOptions { get; private set; }
public void ConfigureFileServerApp(IApplicationBuilder app, public void ConfigureFileServerApp(IApplicationBuilder app,
SiteSettings siteSettings, IHostingEnvironment env) SiteSettings siteSettings, IHostingEnvironment env)
{ {
var rootPath = Path.Combine( UserFilesDirName = Path.Combine(
env.WebRootPath, env.WebRootPath,
// TODO: add a ressource serveur id here, siteSettings.UserFiles.DirName);
// or remove the blog entry id usage, to use the userid instead
// and an user defined optional subdir.
siteSettings.UserFiles.DirName
);
var rootInfo = new DirectoryInfo(rootPath);
if (!rootInfo.Exists) rootInfo.Create();
var rootInfo = new DirectoryInfo(UserFilesDirName);
if (!rootInfo.Exists) rootInfo.Create();
app.UseFileServer(new FileServerOptions() UserFilesOptions = new FileServerOptions()
{ {
FileProvider = new PhysicalFileProvider(rootPath), FileProvider = new PhysicalFileProvider(UserFilesDirName),
RequestPath = new PathString("/" + siteSettings.UserFiles.DirName), RequestPath = new PathString("/" + siteSettings.UserFiles.DirName),
EnableDirectoryBrowsing = env.IsDevelopment() EnableDirectoryBrowsing = env.IsDevelopment()
}); };
app.UseFileServer(UserFilesOptions);
app.UseStaticFiles(); app.UseStaticFiles();
} }
} }

@ -8,13 +8,15 @@ namespace Yavsc.Models.Auth
string username, string username,
IEnumerable<string> emails, IEnumerable<string> emails,
IEnumerable<string> roles, IEnumerable<string> roles,
string avatar) string avatar,
string address)
{ {
Id = useruserid; Id = useruserid;
UserName = username; UserName = username;
EMails = emails.ToArray(); EMails = emails.ToArray();
Roles = roles.ToArray(); Roles = roles.ToArray();
Avatar = avatar; Avatar = avatar;
Address = address;
} }
public string Id { get; set; } public string Id { get; set; }
public string UserName { get; set; } public string UserName { get; set; }
@ -25,7 +27,11 @@ namespace Yavsc.Models.Auth
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public string Avatar { get; set; } public string Avatar { get; set; }
public string Address { get; set; }
} }
public class MyUpdate {
public string UserName { get; set; }
public string Avatar { get; set; }
}
} }

@ -136,8 +136,6 @@ editorcontenu.on('text-change',function(delta,source){
<div markdown="@Model.Content" base="~/@Model.Id" site="SiteSettings.Value" id="contentcnt" ></div> <div markdown="@Model.Content" base="~/@Model.Id" site="SiteSettings.Value" id="contentcnt" ></div>
<hr> <hr>
<form asp-action="Edit" > <form asp-action="Edit" >
<div class="form-horizontal"> <div class="form-horizontal">

@ -5,9 +5,18 @@
<div class="container"> <div class="container">
<input type="text" id="message" /> <input type="text" id="message" />
<input type="button" id="sendmessage" value="Send" /> <input type="button" id="sendmessage" value="Send" />
<input type="hidden" id="displayname" /> <input type="hidden" id="displayname" />
<select id="to" >
@foreach (var contact in ViewBag.Contacts) {
<option>@contact.UserName</option>
}
</select>
<ul id="discussion"> <ul id="discussion">
</ul> </ul>
<ul id="private">
</ul>
</div> </div>
@section scripts { @section scripts {
<!--Script references. --> <!--Script references. -->
@ -27,6 +36,11 @@
$('#discussion').append('<li><strong>' + htmlEncode(name) $('#discussion').append('<li><strong>' + htmlEncode(name)
+ '</strong>: ' + htmlEncode(message) + '</li>'); + '</strong>: ' + htmlEncode(message) + '</li>');
}; };
chat.client.PV = function (name, message) {
// Add the pv to the page.
$('#private').append('<li><strong>' + htmlEncode(name)
+ '</strong>: ' + htmlEncode(message) + '</li>');
};
// Get the user name and store it to prepend to messages. // Get the user name and store it to prepend to messages.
$('#displayname').val(prompt('Enter your name:', '')); $('#displayname').val(prompt('Enter your name:', ''));
// Set initial focus to message input box. // Set initial focus to message input box.
@ -39,6 +53,12 @@
// Clear text box and reset focus for next comment. // Clear text box and reset focus for next comment.
$('#message').val('').focus(); $('#message').val('').focus();
}); });
$('#sendpv').click(function () {
// Call the Send method on the hub.
chat.server.sendPV($('#to').val(), $('#message').val());
// Clear text box and reset focus for next comment.
$('#message').val('').focus();
});
}); });
}); });
// This optional function html-encodes messages for display in the page. // This optional function html-encodes messages for display in the page.

@ -0,0 +1,6 @@
SELECT version();
CREATE EXTENSION "cube"; -- you will not be able install "earthdistance" w/o "cube" extension
CREATE EXTENSION "earthdistance"; --or any other extension you need
create extension earthdistance;
select earth();
select earth_distance(ll_to_earth(12.4,2.0),ll_to_earth(12.456,2.8043)); -- 87km

@ -4,23 +4,39 @@ Da road to the hell
## Jalon 1 ## Jalon 1
✔ Acces (publique) aux Blogs @done (August 13th 2016, 0:51) ✔ Acces (publique) aux Blogs @done (August 13th 2016, 0:51)
✔ Accès aux profiles des intervenants @done (August 13th 2016, 0:57) ✔ Accès aux profiles des intervenants @done (August 13th 2016, 0:57)
✔ Demande de devis, spécifiant une date et un lieu, envers un pro (ou "BookQuery", ou "demande de rendez-vous") @done (August 13th 2016, 0:57) ✔ Demande de devis, spécifiant une date et un lieu, envers un pro (ou "BookQuery", ou "demande de rendez-vous") @done (August 13th 2016, 0:57)
☐ Proposition de devis sur BookQuery ✔ Notifications commande @done (September 15th 2016, 15:00)
☐ Signature de contrat ☐ Proposition de devis sur BookQuery
☐ Signature de contrat
## Jalon 2 ## Jalon 2
☐ Paiement client ☐ Paiement client d'un approvisionnement pour une demande de prestation définie
☐ Login Twitter ☐ Login Twitter
☐ Notifications commande ☐ Notifications et Twits de blogs, d'entées d'artiste, de success stories
☐ Saisie du devis sur commande générique
## Jalon 3 ## Jalon 3
☐ Aide à la rencontre ☐ Saisie du devis sur commande générique
☐ activités secondaires ☐ Saisie d'un devis à destination d'un invité [email]
☐ Paiement d'Arrhes
☐ Arrhes ## Jalon 4
☐ conciliation
☐ Aide à la rencontre
☐ Activités secondaires
## Jalon 5
☐ Conciliation
---------------------------
Hotkeys
Alt-Enter: add a new todo item below the current
Alt-Shift-Enter: add a new todo item above the current
Alt-D: toggle completion for current task
Alt-A: cancel current task
Alt-C: convert current task

Loading…