diff --git a/Yavsc/ApiControllers/AccountController.cs b/Yavsc/ApiControllers/AccountController.cs index 26ae4101..5bc4b946 100644 --- a/Yavsc/ApiControllers/AccountController.cs +++ b/Yavsc/ApiControllers/AccountController.cs @@ -55,7 +55,7 @@ namespace Yavsc.WebApi.Controllers if (!result.Succeeded) { - AddErrors(result); + AddErrors("NewPassword",result); return new BadRequestObjectResult(ModelState); } } @@ -74,7 +74,7 @@ namespace Yavsc.WebApi.Controllers IdentityResult result = await UserManager.AddPasswordAsync(user, model.NewPassword); if (!result.Succeeded) { - AddErrors (result); + AddErrors ("NewPassword",result); return new BadRequestObjectResult(ModelState); } } @@ -96,17 +96,17 @@ namespace Yavsc.WebApi.Controllers if (!result.Succeeded) { - AddErrors (result); + AddErrors ("Register",result); return new BadRequestObjectResult(ModelState); } await _signInManager.SignInAsync(user, isPersistent: false); return Ok(); } - private void AddErrors(IdentityResult result) + private void AddErrors(string key, IdentityResult result) { foreach (var error in result.Errors) { - ModelState.AddModelError(string.Empty, error.Description); + ModelState.AddModelError(key, error.Description); } } protected override void Dispose(bool disposing) @@ -126,19 +126,39 @@ namespace Yavsc.WebApi.Controllers return new BadRequestObjectResult( new { error = "user not found" }); var uid = User.GetUserId(); - if (uid == null) - return new BadRequestObjectResult( - new { error = "user not identified" }); var iduser = await UserManager.FindByIdAsync(uid); var user = new Me(iduser.Id,iduser.UserName, new string [] { iduser.Email }, await UserManager.GetRolesAsync(iduser), - null // TODO better (an avatar, or Web site url) + iduser.Avatar, iduser.PostalAddress?.Address ); return Ok(user); } + [HttpPut("~/api/me")] + public async Task 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(); + } } } diff --git a/Yavsc/ApiControllers/BookQueryApiController.cs b/Yavsc/ApiControllers/BookQueryApiController.cs index 4b648b6f..7819434d 100644 --- a/Yavsc/ApiControllers/BookQueryApiController.cs +++ b/Yavsc/ApiControllers/BookQueryApiController.cs @@ -5,42 +5,67 @@ using Microsoft.AspNet.Authorization; using Microsoft.AspNet.Http; using Microsoft.AspNet.Mvc; using Microsoft.Data.Entity; -using Yavsc.Models; -using Yavsc.Models.Booking; +using Microsoft.Extensions.Logging; namespace Yavsc.Controllers { + using System; + using Yavsc.Model; + using Yavsc.Models; + using Yavsc.Models.Booking; + [Produces("application/json")] - [Route("api/bookquery"),Authorize(Roles="Performer,Administrator")] + [Route("api/bookquery"), Authorize(Roles = "Performer,Administrator")] public class BookQueryApiController : Controller { private ApplicationDbContext _context; + private ILogger _logger; - public BookQueryApiController(ApplicationDbContext context) + public BookQueryApiController(ApplicationDbContext context, ILoggerFactory loggerFactory) { _context = context; + _logger = loggerFactory.CreateLogger(); } - // GET: api/BookQueryApi - [HttpGet] - public IEnumerable GetCommands() + // GET: api/BookQueryApi + /// + /// Book queries, by creation order + /// + /// returned Ids must be lower than this value + /// book queries + [HttpGet] + public IEnumerable GetCommands(long maxId=long.MaxValue) { 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 [HttpGet("{id}", Name = "GetBookQuery")] public IActionResult GetBookQuery([FromRoute] long id) { - + if (!ModelState.IsValid) { return HttpBadRequest(ModelState); } 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) { @@ -65,7 +90,7 @@ namespace Yavsc.Controllers } var uid = User.GetUserId(); if (bookQuery.ClientId != uid) - return HttpNotFound(); + return HttpNotFound(); _context.Entry(bookQuery).State = EntityState.Modified; @@ -97,8 +122,9 @@ namespace Yavsc.Controllers return HttpBadRequest(ModelState); } var uid = User.GetUserId(); - if (bookQuery.ClientId != uid) { - ModelState.AddModelError("ClientId","You must be the client at creating a book query"); + if (bookQuery.ClientId != uid) + { + ModelState.AddModelError("ClientId", "You must be the client at creating a book query"); return new BadRequestObjectResult(ModelState); } _context.Commands.Add(bookQuery); diff --git a/Yavsc/ApiControllers/EstimateApiController.cs b/Yavsc/ApiControllers/EstimateApiController.cs index 3949ab72..6e8e3363 100644 --- a/Yavsc/ApiControllers/EstimateApiController.cs +++ b/Yavsc/ApiControllers/EstimateApiController.cs @@ -10,7 +10,7 @@ using Yavsc.Models.Billing; namespace Yavsc.Controllers { [Produces("application/json")] - [Route("api/do"),Authorize()] + [Route("api/estimate"),Authorize()] public class EstimateApiController : Controller { private ApplicationDbContext _context; @@ -40,7 +40,6 @@ namespace Yavsc.Controllers return new HttpStatusCodeResult(StatusCodes.Status403Forbidden); return Ok(_context.Estimates.Where(e=>e.OwnerId == ownerId)); } - // GET: api/Estimate/5 [HttpGet("{id}", Name = "GetEstimate")] public IActionResult GetEstimate([FromRoute] long id) diff --git a/Yavsc/ApiControllers/FileSystemApiController.cs b/Yavsc/ApiControllers/FileSystemApiController.cs new file mode 100644 index 00000000..b9530e8d --- /dev/null +++ b/Yavsc/ApiControllers/FileSystemApiController.cs @@ -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 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; + }; + } + } +} \ No newline at end of file diff --git a/Yavsc/ApiControllers/PostRateApiController.cs b/Yavsc/ApiControllers/PostRateApiController.cs index 8639a97d..42cc6e44 100644 --- a/Yavsc/ApiControllers/PostRateApiController.cs +++ b/Yavsc/ApiControllers/PostRateApiController.cs @@ -7,7 +7,7 @@ using Yavsc.Models; namespace Yavsc.Controllers { [Produces("application/json")] - [Route("api/PostRateApi")] + [Route("~/api/PostRateApi")] public class PostRateApiController : Controller { private ApplicationDbContext _context; diff --git a/Yavsc/ApiControllers/PostTagsApiController.cs b/Yavsc/ApiControllers/PostTagsApiController.cs index 97fb0282..b3eb9290 100644 --- a/Yavsc/ApiControllers/PostTagsApiController.cs +++ b/Yavsc/ApiControllers/PostTagsApiController.cs @@ -8,7 +8,7 @@ using Yavsc.Models; namespace Yavsc.Controllers { [Produces("application/json")] - [Route("api/PostTagsApi")] + [Route("~/api/PostTagsApi")] public class PostTagsApiController : Controller { private ApplicationDbContext _context; diff --git a/Yavsc/Controllers/CommandController.cs b/Yavsc/Controllers/CommandController.cs index fe2a4277..23f93442 100644 --- a/Yavsc/Controllers/CommandController.cs +++ b/Yavsc/Controllers/CommandController.cs @@ -60,7 +60,6 @@ namespace Yavsc.Controllers .Include(x => x.PerformerProfile) .Include(x => x.PerformerProfile.Performer) .Include(x => x.Location) - .Include(x => x.Bill) .Where(x=> x.ClientId == uid || x.PerformerId == uid) .ToList()); } @@ -135,6 +134,7 @@ namespace Yavsc.Controllers .FirstOrDefault( x => x.PerformerId == command.PerformerId ); + _logger.LogDebug($"Pro: {pro}"); command.PerformerProfile = pro; var user = await _userManager.FindByIdAsync( User.GetUserId() @@ -162,7 +162,7 @@ namespace Yavsc.Controllers var regids = command.PerformerProfile.Performer .Devices.Select(d => d.GCMRegistrationId); 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 // both on mailbox and mobile @@ -174,8 +174,8 @@ namespace Yavsc.Controllers await _emailSender.SendEmailAsync( _siteSettings, _smtpSettings, command.PerformerProfile.Performer.Email, - yaev.Title, - $"{yaev.Description}\r\n-- \r\n{yaev.Comment}\r\n" + yaev.Topic+" "+yaev.Client.UserName, + $"{yaev.Message}\r\n-- \r\n{yaev.Previsional}\r\n" ); } ViewBag.GoogleSettings = _googleSettings; diff --git a/Yavsc/Controllers/HomeController.cs b/Yavsc/Controllers/HomeController.cs index b97cb1ce..7563992a 100644 --- a/Yavsc/Controllers/HomeController.cs +++ b/Yavsc/Controllers/HomeController.cs @@ -4,6 +4,10 @@ using Microsoft.AspNet.Http.Features; using Microsoft.AspNet.Diagnostics; using Microsoft.AspNet.Authorization; using Microsoft.AspNet.Hosting; +using Yavsc.Models; +using Microsoft.AspNet.Identity; +using System.Linq; +using System.Security.Claims; namespace Yavsc.Controllers { @@ -12,12 +16,16 @@ namespace Yavsc.Controllers { public IHostingEnvironment Hosting { get; set; } + private ApplicationDbContext DbContext; + private readonly IHtmlLocalizer _localizer; - public HomeController(IHtmlLocalizer localizer, IHostingEnvironment hosting) + public HomeController(IHtmlLocalizer localizer, IHostingEnvironment hosting, + ApplicationDbContext context, UserManager userManager) { _localizer = localizer; Hosting = hosting; + DbContext = context; } public IActionResult Index() @@ -42,6 +50,11 @@ namespace Yavsc.Controllers public ActionResult Chat() { + if (User.Identity.IsAuthenticated) { + string uid = User.GetUserId(); + ViewBag.Contacts = DbContext.Contacts.Where(c=>c.OwnerId == uid) + ; + } return View(); } diff --git a/Yavsc/Controllers/ManageController.cs b/Yavsc/Controllers/ManageController.cs index 4bca4f77..8d3068e8 100644 --- a/Yavsc/Controllers/ManageController.cs +++ b/Yavsc/Controllers/ManageController.cs @@ -83,6 +83,7 @@ namespace Yavsc.Controllers : message == ManageMessageId.RemovePhoneSuccess ? "Your phone number was removed." : message == ManageMessageId.ChangeNameSuccess ? "Your name was updated." : message == ManageMessageId.SetActivitySuccess ? "Your activity was set." + : message == ManageMessageId.AvatarUpdateSuccess ? "Your avatar was updated." : ""; var user = await GetCurrentUserAsync(); @@ -600,6 +601,7 @@ namespace Yavsc.Controllers RemovePhoneSuccess, SetActivitySuccess, UnsetActivitySuccess, + AvatarUpdateSuccess, Error } diff --git a/Yavsc/Controllers/UserFilesController.cs b/Yavsc/Controllers/UserFilesController.cs index 8b8e444f..52a60f03 100644 --- a/Yavsc/Controllers/UserFilesController.cs +++ b/Yavsc/Controllers/UserFilesController.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Security.Claims; using System.Threading.Tasks; using Microsoft.AspNet.Authorization; using Microsoft.AspNet.Hosting; @@ -42,8 +43,11 @@ namespace Yavsc.Controllers if (!ModelState.IsValid) return new BadRequestObjectResult(ModelState); var results = new List(); - var uploads = Path.Combine(_environment.WebRootPath, _siteSettings.UserFiles.DirName); - uploads = Path.Combine(uploads, model.PostId.ToString()); + var uploads = Path.Combine( + Path.Combine(_environment.WebRootPath, _siteSettings.UserFiles.DirName), + User.GetUserId() + ); + // uploads = Path.Combine(uploads, model.PostId.ToString()); var spot = new FileSpotInfo(uploads, blogEntry); if (!await _authorizationService.AuthorizeAsync(User, spot, new EditRequirement())) { diff --git a/Yavsc/Helpers/EventHelpers.cs b/Yavsc/Helpers/EventHelpers.cs index 5277706d..fbdb614a 100644 --- a/Yavsc/Helpers/EventHelpers.cs +++ b/Yavsc/Helpers/EventHelpers.cs @@ -1,4 +1,5 @@ using Microsoft.Extensions.Localization; +using Yavsc.Model; using Yavsc.Models.Booking; using Yavsc.Models.Messaging; @@ -11,17 +12,14 @@ namespace Yavsc.Helpers { var yaev = new BookQueryEvent { - Title = query.Client.UserName + " "+ SR["is asking you for a date"]+".", - Comment = (query.Previsional != null) ? - SR["Deposit"] + string.Format(": {0:00}", - query.Previsional) : SR["No deposit."], - Description = SR["Address"] + ": " + query.Location.Address + "\n" + - SR["Date"] + ": " + query.EventDate.ToString("D"), - StartDate = query.EventDate, + Client = new ClientProviderView { UserName = query.Client.UserName , UserId = query.ClientId } , + Previsional = query.Previsional, + EventDate = query.EventDate, Location = query.Location, - CommandId = query.Id + Id = query.Id }; return yaev; } + } } diff --git a/Yavsc/Helpers/GoogleHelpers.cs b/Yavsc/Helpers/GoogleHelpers.cs index efcaab23..dc82df0b 100644 --- a/Yavsc/Helpers/GoogleHelpers.cs +++ b/Yavsc/Helpers/GoogleHelpers.cs @@ -21,11 +21,8 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Net.Http; -using System.Net.Http.Headers; using System.Threading.Tasks; using Microsoft.AspNet.Identity; -using Newtonsoft.Json.Linq; using Yavsc.Models; using Yavsc.Models.Auth; using Yavsc.Models.Google.Messaging; @@ -37,7 +34,7 @@ namespace Yavsc.Helpers /// public static class GoogleHelpers { - +/* WAZA /// /// Notifies the event. /// @@ -70,18 +67,17 @@ namespace Yavsc.Helpers var payload = JObject.Parse(await response.Content.ReadAsStringAsync()); return payload.Value(); } - +*/ public static MessageWithPayloadResponse NotifyEvent (this GoogleAuthSettings googleSettings, IEnumerable regids, Event ev) - where Event : YaEvent + where Event : IEvent { var msg = new MessageWithPayload() { notification = new Notification() { - title = ev.Title, - body = ev.Description + ev.Comment == null ? - "" : "(" + ev.Comment + ")", + title = ev.Topic+" "+ev.Sender, + body = ev.Message, icon = "icon" }, data = ev, diff --git a/Yavsc/Hubs/ChatHub.cs b/Yavsc/Hubs/ChatHub.cs index 9279e99b..9c98d3a8 100644 --- a/Yavsc/Hubs/ChatHub.cs +++ b/Yavsc/Hubs/ChatHub.cs @@ -58,6 +58,16 @@ namespace Yavsc 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); + } } } diff --git a/Yavsc/Interfaces/IEvent.cs b/Yavsc/Interfaces/IEvent.cs new file mode 100644 index 00000000..6ee109e7 --- /dev/null +++ b/Yavsc/Interfaces/IEvent.cs @@ -0,0 +1,14 @@ + + +public interface IEvent { + /// + /// An acceptable topic for this event to be. + /// Should return something like the class name + /// of this object + /// + /// + string Topic { get; set ; } + string Sender { get; set ; } + + string Message { get; set; } +} \ No newline at end of file diff --git a/Yavsc/Migrations/20160905095708_tags.Designer.cs b/Yavsc/Migrations/20160905095708_tags.Designer.cs index 1f1d3588..df99f552 100644 --- a/Yavsc/Migrations/20160905095708_tags.Designer.cs +++ b/Yavsc/Migrations/20160905095708_tags.Designer.cs @@ -1,7 +1,6 @@ using System; using Microsoft.Data.Entity; using Microsoft.Data.Entity.Infrastructure; -using Microsoft.Data.Entity.Metadata; using Microsoft.Data.Entity.Migrations; using Yavsc.Models; diff --git a/Yavsc/Migrations/20160905095708_tags.cs b/Yavsc/Migrations/20160905095708_tags.cs index 6a29f033..ec6f1b22 100644 --- a/Yavsc/Migrations/20160905095708_tags.cs +++ b/Yavsc/Migrations/20160905095708_tags.cs @@ -1,5 +1,3 @@ -using System; -using System.Collections.Generic; using Microsoft.Data.Entity.Migrations; namespace Yavsc.Migrations diff --git a/Yavsc/Migrations/20160916075415_estimateFreeFromCatalog.Designer.cs b/Yavsc/Migrations/20160916075415_estimateFreeFromCatalog.Designer.cs new file mode 100644 index 00000000..193ceeaa --- /dev/null +++ b/Yavsc/Migrations/20160916075415_estimateFreeFromCatalog.Designer.cs @@ -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("Id"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken(); + + b.Property("Name") + .HasAnnotation("MaxLength", 256); + + b.Property("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", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClaimType"); + + b.Property("ClaimValue"); + + b.Property("RoleId") + .IsRequired(); + + b.HasKey("Id"); + + b.HasAnnotation("Relational:TableName", "AspNetRoleClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClaimType"); + + b.Property("ClaimValue"); + + b.Property("UserId") + .IsRequired(); + + b.HasKey("Id"); + + b.HasAnnotation("Relational:TableName", "AspNetUserClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin", b => + { + b.Property("LoginProvider"); + + b.Property("ProviderKey"); + + b.Property("ProviderDisplayName"); + + b.Property("UserId") + .IsRequired(); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasAnnotation("Relational:TableName", "AspNetUserLogins"); + }); + + modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole", b => + { + b.Property("UserId"); + + b.Property("RoleId"); + + b.HasKey("UserId", "RoleId"); + + b.HasAnnotation("Relational:TableName", "AspNetUserRoles"); + }); + + modelBuilder.Entity("Yavsc.Location", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Address") + .IsRequired(); + + b.Property("Latitude"); + + b.Property("Longitude"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.AccountBalance", b => + { + b.Property("UserId"); + + b.Property("ContactCredits"); + + b.Property("Credits"); + + b.HasKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Activity", b => + { + b.Property("Code") + .HasAnnotation("MaxLength", 512); + + b.Property("ActorDenomination"); + + b.Property("Description"); + + b.Property("ModeratorGroupName"); + + b.Property("Name") + .IsRequired() + .HasAnnotation("MaxLength", 512); + + b.Property("Photo"); + + b.HasKey("Code"); + }); + + modelBuilder.Entity("Yavsc.Models.ApplicationUser", b => + { + b.Property("Id"); + + b.Property("AccessFailedCount"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken(); + + b.Property("DedicatedGoogleCalendar"); + + b.Property("Email") + .HasAnnotation("MaxLength", 256); + + b.Property("EmailConfirmed"); + + b.Property("LockoutEnabled"); + + b.Property("LockoutEnd"); + + b.Property("NormalizedEmail") + .HasAnnotation("MaxLength", 256); + + b.Property("NormalizedUserName") + .HasAnnotation("MaxLength", 256); + + b.Property("PasswordHash"); + + b.Property("PhoneNumber"); + + b.Property("PhoneNumberConfirmed"); + + b.Property("PostalAddressId"); + + b.Property("SecurityStamp"); + + b.Property("TwoFactorEnabled"); + + b.Property("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("Id"); + + b.Property("Active"); + + b.Property("DisplayName"); + + b.Property("LogoutRedirectUri") + .HasAnnotation("MaxLength", 100); + + b.Property("RedirectUri"); + + b.Property("RefreshTokenLifeTime"); + + b.Property("Secret"); + + b.Property("Type"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Auth.RefreshToken", b => + { + b.Property("Id"); + + b.Property("ClientId") + .IsRequired() + .HasAnnotation("MaxLength", 50); + + b.Property("ExpiresUtc"); + + b.Property("IssuedUtc"); + + b.Property("ProtectedTicket") + .IsRequired(); + + b.Property("Subject") + .IsRequired() + .HasAnnotation("MaxLength", 50); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.BalanceImpact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("BalanceId") + .IsRequired(); + + b.Property("ExecDate"); + + b.Property("Impact"); + + b.Property("Reason") + .IsRequired(); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.CommandLine", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ArticleId"); + + b.Property("Count"); + + b.Property("Description") + .IsRequired(); + + b.Property("EstimateId"); + + b.Property("EstimateTemplateId"); + + b.Property("UnitaryCost"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.Estimate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AttachedFilesString"); + + b.Property("AttachedGraphicsString"); + + b.Property("ClientId") + .IsRequired(); + + b.Property("CommandId"); + + b.Property("Description"); + + b.Property("OwnerId") + .IsRequired(); + + b.Property("Status"); + + b.Property("Title"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.EstimateTemplate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Description"); + + b.Property("OwnerId") + .IsRequired(); + + b.Property("Title"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.ExceptionSIREN", b => + { + b.Property("SIREN"); + + b.HasKey("SIREN"); + }); + + modelBuilder.Entity("Yavsc.Models.Blog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AuthorId"); + + b.Property("Content"); + + b.Property("Modified"); + + b.Property("Photo"); + + b.Property("Posted") + .ValueGeneratedOnAdd() + .HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP"); + + b.Property("Rate"); + + b.Property("Title"); + + b.Property("Visible"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Booking.BookQuery", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClientId") + .IsRequired(); + + b.Property("CreationDate") + .ValueGeneratedOnAdd() + .HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP"); + + b.Property("EventDate"); + + b.Property("Lag"); + + b.Property("LocationId"); + + b.Property("PerformerId") + .IsRequired(); + + b.Property("Previsional"); + + b.Property("ValidationDate"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Circle", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ApplicationUserId"); + + b.Property("Name"); + + b.Property("OwnerId"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.CircleMember", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("CircleId"); + + b.Property("MemberId") + .IsRequired(); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Contact", b => + { + b.Property("OwnerId"); + + b.Property("UserId"); + + b.HasKey("OwnerId", "UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Identity.GoogleCloudMobileDeclaration", b => + { + b.Property("DeviceId"); + + b.Property("DeclarationDate") + .ValueGeneratedOnAdd() + .HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP"); + + b.Property("DeviceOwnerId"); + + b.Property("GCMRegistrationId") + .IsRequired(); + + b.Property("Model"); + + b.Property("Platform"); + + b.Property("Version"); + + b.HasKey("DeviceId"); + }); + + modelBuilder.Entity("Yavsc.Models.Market.BaseProduct", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Description"); + + b.Property("Discriminator") + .IsRequired(); + + b.Property("Name"); + + b.Property("Public"); + + b.HasKey("Id"); + + b.HasAnnotation("Relational:DiscriminatorProperty", "Discriminator"); + + b.HasAnnotation("Relational:DiscriminatorValue", "BaseProduct"); + }); + + modelBuilder.Entity("Yavsc.Models.Market.Service", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("BookQueryId"); + + b.Property("ContextId"); + + b.Property("Description"); + + b.Property("Name"); + + b.Property("Public"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.OAuth.OAuth2Tokens", b => + { + b.Property("UserId"); + + b.Property("AccessToken"); + + b.Property("Expiration"); + + b.Property("ExpiresIn"); + + b.Property("RefreshToken"); + + b.Property("TokenType"); + + b.HasKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.PostTag", b => + { + b.Property("PostId"); + + b.Property("TagId"); + + b.HasKey("PostId", "TagId"); + }); + + modelBuilder.Entity("Yavsc.Models.Skill", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name"); + + b.Property("Rate"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name") + .IsRequired(); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b => + { + b.Property("PerformerId"); + + b.Property("AcceptGeoLocalization"); + + b.Property("AcceptNotifications"); + + b.Property("AcceptPublicContact"); + + b.Property("Active"); + + b.Property("ActivityCode") + .IsRequired(); + + b.Property("MaxDailyCost"); + + b.Property("MinDailyCost"); + + b.Property("OfferId"); + + b.Property("OrganizationAddressId"); + + b.Property("Rate"); + + b.Property("SIREN") + .IsRequired() + .HasAnnotation("MaxLength", 14); + + b.Property("WebSite"); + + b.HasKey("PerformerId"); + }); + + modelBuilder.Entity("Yavsc.Models.Market.Product", b => + { + b.HasBaseType("Yavsc.Models.Market.BaseProduct"); + + b.Property("Depth"); + + b.Property("Height"); + + b.Property("Price"); + + b.Property("Weight"); + + b.Property("Width"); + + b.HasAnnotation("Relational:DiscriminatorValue", "Product"); + }); + + modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole") + .WithMany() + .HasForeignKey("RoleId"); + }); + + modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole", 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"); + }); + } + } +} diff --git a/Yavsc/Migrations/20160916075415_estimateFreeFromCatalog.cs b/Yavsc/Migrations/20160916075415_estimateFreeFromCatalog.cs new file mode 100644 index 00000000..1ad19655 --- /dev/null +++ b/Yavsc/Migrations/20160916075415_estimateFreeFromCatalog.cs @@ -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_IdentityRole_RoleId", table: "AspNetRoleClaims"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim_ApplicationUser_UserId", table: "AspNetUserClaims"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin_ApplicationUser_UserId", table: "AspNetUserLogins"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole_IdentityRole_RoleId", table: "AspNetUserRoles"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole_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(nullable: false) + .Annotation("Npgsql:Serial", true), + Description = table.Column(nullable: true), + OwnerId = table.Column(nullable: false), + Title = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_EstimateTemplate", x => x.Id); + }); + migrationBuilder.AddColumn( + name: "BookQueryId", + table: "Service", + nullable: true); + migrationBuilder.AddColumn( + name: "Description", + table: "CommandLine", + nullable: false, + defaultValue: ""); + migrationBuilder.AddColumn( + name: "EstimateTemplateId", + table: "CommandLine", + nullable: true); + migrationBuilder.AddForeignKey( + name: "FK_IdentityRoleClaim_IdentityRole_RoleId", + table: "AspNetRoleClaims", + column: "RoleId", + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserClaim_ApplicationUser_UserId", + table: "AspNetUserClaims", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserLogin_ApplicationUser_UserId", + table: "AspNetUserLogins", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserRole_IdentityRole_RoleId", + table: "AspNetUserRoles", + column: "RoleId", + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserRole_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_IdentityRole_RoleId", table: "AspNetRoleClaims"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim_ApplicationUser_UserId", table: "AspNetUserClaims"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin_ApplicationUser_UserId", table: "AspNetUserLogins"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole_IdentityRole_RoleId", table: "AspNetUserRoles"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole_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( + name: "BookQueryId", + table: "CommandLine", + nullable: true); + migrationBuilder.AddColumn( + name: "Comment", + table: "CommandLine", + nullable: true); + migrationBuilder.AddForeignKey( + name: "FK_IdentityRoleClaim_IdentityRole_RoleId", + table: "AspNetRoleClaims", + column: "RoleId", + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserClaim_ApplicationUser_UserId", + table: "AspNetUserClaims", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserLogin_ApplicationUser_UserId", + table: "AspNetUserLogins", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserRole_IdentityRole_RoleId", + table: "AspNetUserRoles", + column: "RoleId", + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserRole_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); + } + } +} diff --git a/Yavsc/Migrations/20160917010249_yaev.Designer.cs b/Yavsc/Migrations/20160917010249_yaev.Designer.cs new file mode 100644 index 00000000..1a023d4c --- /dev/null +++ b/Yavsc/Migrations/20160917010249_yaev.Designer.cs @@ -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("Id"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken(); + + b.Property("Name") + .HasAnnotation("MaxLength", 256); + + b.Property("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", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClaimType"); + + b.Property("ClaimValue"); + + b.Property("RoleId") + .IsRequired(); + + b.HasKey("Id"); + + b.HasAnnotation("Relational:TableName", "AspNetRoleClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClaimType"); + + b.Property("ClaimValue"); + + b.Property("UserId") + .IsRequired(); + + b.HasKey("Id"); + + b.HasAnnotation("Relational:TableName", "AspNetUserClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin", b => + { + b.Property("LoginProvider"); + + b.Property("ProviderKey"); + + b.Property("ProviderDisplayName"); + + b.Property("UserId") + .IsRequired(); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasAnnotation("Relational:TableName", "AspNetUserLogins"); + }); + + modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole", b => + { + b.Property("UserId"); + + b.Property("RoleId"); + + b.HasKey("UserId", "RoleId"); + + b.HasAnnotation("Relational:TableName", "AspNetUserRoles"); + }); + + modelBuilder.Entity("Yavsc.Location", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Address") + .IsRequired(); + + b.Property("Latitude"); + + b.Property("Longitude"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.AccountBalance", b => + { + b.Property("UserId"); + + b.Property("ContactCredits"); + + b.Property("Credits"); + + b.HasKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Activity", b => + { + b.Property("Code") + .HasAnnotation("MaxLength", 512); + + b.Property("ActorDenomination"); + + b.Property("Description"); + + b.Property("ModeratorGroupName"); + + b.Property("Name") + .IsRequired() + .HasAnnotation("MaxLength", 512); + + b.Property("Photo"); + + b.HasKey("Code"); + }); + + modelBuilder.Entity("Yavsc.Models.ApplicationUser", b => + { + b.Property("Id"); + + b.Property("AccessFailedCount"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken(); + + b.Property("DedicatedGoogleCalendar"); + + b.Property("Email") + .HasAnnotation("MaxLength", 256); + + b.Property("EmailConfirmed"); + + b.Property("LockoutEnabled"); + + b.Property("LockoutEnd"); + + b.Property("NormalizedEmail") + .HasAnnotation("MaxLength", 256); + + b.Property("NormalizedUserName") + .HasAnnotation("MaxLength", 256); + + b.Property("PasswordHash"); + + b.Property("PhoneNumber"); + + b.Property("PhoneNumberConfirmed"); + + b.Property("PostalAddressId"); + + b.Property("SecurityStamp"); + + b.Property("TwoFactorEnabled"); + + b.Property("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("Id"); + + b.Property("Active"); + + b.Property("DisplayName"); + + b.Property("LogoutRedirectUri") + .HasAnnotation("MaxLength", 100); + + b.Property("RedirectUri"); + + b.Property("RefreshTokenLifeTime"); + + b.Property("Secret"); + + b.Property("Type"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Auth.RefreshToken", b => + { + b.Property("Id"); + + b.Property("ClientId") + .IsRequired() + .HasAnnotation("MaxLength", 50); + + b.Property("ExpiresUtc"); + + b.Property("IssuedUtc"); + + b.Property("ProtectedTicket") + .IsRequired(); + + b.Property("Subject") + .IsRequired() + .HasAnnotation("MaxLength", 50); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.BalanceImpact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("BalanceId") + .IsRequired(); + + b.Property("ExecDate"); + + b.Property("Impact"); + + b.Property("Reason") + .IsRequired(); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.CommandLine", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ArticleId"); + + b.Property("Count"); + + b.Property("Description") + .IsRequired(); + + b.Property("EstimateId"); + + b.Property("EstimateTemplateId"); + + b.Property("UnitaryCost"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.Estimate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AttachedFilesString"); + + b.Property("AttachedGraphicsString"); + + b.Property("ClientId") + .IsRequired(); + + b.Property("CommandId"); + + b.Property("Description"); + + b.Property("OwnerId") + .IsRequired(); + + b.Property("Status"); + + b.Property("Title"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.EstimateTemplate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Description"); + + b.Property("OwnerId") + .IsRequired(); + + b.Property("Title"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.ExceptionSIREN", b => + { + b.Property("SIREN"); + + b.HasKey("SIREN"); + }); + + modelBuilder.Entity("Yavsc.Models.Blog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AuthorId"); + + b.Property("Content"); + + b.Property("Modified"); + + b.Property("Photo"); + + b.Property("Posted") + .ValueGeneratedOnAdd() + .HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP"); + + b.Property("Rate"); + + b.Property("Title"); + + b.Property("Visible"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Booking.BookQuery", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClientId") + .IsRequired(); + + b.Property("CreationDate") + .ValueGeneratedOnAdd() + .HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP"); + + b.Property("EventDate"); + + b.Property("LocationId"); + + b.Property("PerformerId") + .IsRequired(); + + b.Property("Previsional"); + + b.Property("ValidationDate"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Circle", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ApplicationUserId"); + + b.Property("Name"); + + b.Property("OwnerId"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.CircleMember", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("CircleId"); + + b.Property("MemberId") + .IsRequired(); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Contact", b => + { + b.Property("OwnerId"); + + b.Property("UserId"); + + b.HasKey("OwnerId", "UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Identity.GoogleCloudMobileDeclaration", b => + { + b.Property("DeviceId"); + + b.Property("DeclarationDate") + .ValueGeneratedOnAdd() + .HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP"); + + b.Property("DeviceOwnerId"); + + b.Property("GCMRegistrationId") + .IsRequired(); + + b.Property("Model"); + + b.Property("Platform"); + + b.Property("Version"); + + b.HasKey("DeviceId"); + }); + + modelBuilder.Entity("Yavsc.Models.Market.BaseProduct", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Description"); + + b.Property("Discriminator") + .IsRequired(); + + b.Property("Name"); + + b.Property("Public"); + + b.HasKey("Id"); + + b.HasAnnotation("Relational:DiscriminatorProperty", "Discriminator"); + + b.HasAnnotation("Relational:DiscriminatorValue", "BaseProduct"); + }); + + modelBuilder.Entity("Yavsc.Models.Market.Service", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ContextId"); + + b.Property("Description"); + + b.Property("Name"); + + b.Property("Public"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.OAuth.OAuth2Tokens", b => + { + b.Property("UserId"); + + b.Property("AccessToken"); + + b.Property("Expiration"); + + b.Property("ExpiresIn"); + + b.Property("RefreshToken"); + + b.Property("TokenType"); + + b.HasKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.PostTag", b => + { + b.Property("PostId"); + + b.Property("TagId"); + + b.HasKey("PostId", "TagId"); + }); + + modelBuilder.Entity("Yavsc.Models.Skill", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name"); + + b.Property("Rate"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name") + .IsRequired(); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b => + { + b.Property("PerformerId"); + + b.Property("AcceptGeoLocalization"); + + b.Property("AcceptNotifications"); + + b.Property("AcceptPublicContact"); + + b.Property("Active"); + + b.Property("ActivityCode") + .IsRequired(); + + b.Property("MaxDailyCost"); + + b.Property("MinDailyCost"); + + b.Property("OfferId"); + + b.Property("OrganizationAddressId"); + + b.Property("Rate"); + + b.Property("SIREN") + .IsRequired() + .HasAnnotation("MaxLength", 14); + + b.Property("WebSite"); + + b.HasKey("PerformerId"); + }); + + modelBuilder.Entity("Yavsc.Models.Market.Product", b => + { + b.HasBaseType("Yavsc.Models.Market.BaseProduct"); + + b.Property("Depth"); + + b.Property("Height"); + + b.Property("Price"); + + b.Property("Weight"); + + b.Property("Width"); + + b.HasAnnotation("Relational:DiscriminatorValue", "Product"); + }); + + modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole") + .WithMany() + .HasForeignKey("RoleId"); + }); + + modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole", 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"); + }); + } + } +} diff --git a/Yavsc/Migrations/20160917010249_yaev.cs b/Yavsc/Migrations/20160917010249_yaev.cs new file mode 100644 index 00000000..de480dae --- /dev/null +++ b/Yavsc/Migrations/20160917010249_yaev.cs @@ -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_IdentityRole_RoleId", table: "AspNetRoleClaims"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim_ApplicationUser_UserId", table: "AspNetUserClaims"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin_ApplicationUser_UserId", table: "AspNetUserLogins"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole_IdentityRole_RoleId", table: "AspNetUserRoles"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole_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_IdentityRole_RoleId", + table: "AspNetRoleClaims", + column: "RoleId", + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserClaim_ApplicationUser_UserId", + table: "AspNetUserClaims", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserLogin_ApplicationUser_UserId", + table: "AspNetUserLogins", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserRole_IdentityRole_RoleId", + table: "AspNetUserRoles", + column: "RoleId", + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserRole_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_IdentityRole_RoleId", table: "AspNetRoleClaims"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim_ApplicationUser_UserId", table: "AspNetUserClaims"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin_ApplicationUser_UserId", table: "AspNetUserLogins"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole_IdentityRole_RoleId", table: "AspNetUserRoles"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole_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( + name: "BookQueryId", + table: "Service", + nullable: true); + migrationBuilder.AddColumn( + name: "Lag", + table: "BookQuery", + nullable: false, + defaultValue: 0); + migrationBuilder.AddForeignKey( + name: "FK_IdentityRoleClaim_IdentityRole_RoleId", + table: "AspNetRoleClaims", + column: "RoleId", + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserClaim_ApplicationUser_UserId", + table: "AspNetUserClaims", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserLogin_ApplicationUser_UserId", + table: "AspNetUserLogins", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserRole_IdentityRole_RoleId", + table: "AspNetUserRoles", + column: "RoleId", + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserRole_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); + } + } +} diff --git a/Yavsc/Migrations/20160920215459_avatar.Designer.cs b/Yavsc/Migrations/20160920215459_avatar.Designer.cs new file mode 100644 index 00000000..1ec560ff --- /dev/null +++ b/Yavsc/Migrations/20160920215459_avatar.Designer.cs @@ -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("Id"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken(); + + b.Property("Name") + .HasAnnotation("MaxLength", 256); + + b.Property("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", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClaimType"); + + b.Property("ClaimValue"); + + b.Property("RoleId") + .IsRequired(); + + b.HasKey("Id"); + + b.HasAnnotation("Relational:TableName", "AspNetRoleClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClaimType"); + + b.Property("ClaimValue"); + + b.Property("UserId") + .IsRequired(); + + b.HasKey("Id"); + + b.HasAnnotation("Relational:TableName", "AspNetUserClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin", b => + { + b.Property("LoginProvider"); + + b.Property("ProviderKey"); + + b.Property("ProviderDisplayName"); + + b.Property("UserId") + .IsRequired(); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasAnnotation("Relational:TableName", "AspNetUserLogins"); + }); + + modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole", b => + { + b.Property("UserId"); + + b.Property("RoleId"); + + b.HasKey("UserId", "RoleId"); + + b.HasAnnotation("Relational:TableName", "AspNetUserRoles"); + }); + + modelBuilder.Entity("Yavsc.Location", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Address") + .IsRequired(); + + b.Property("Latitude"); + + b.Property("Longitude"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.AccountBalance", b => + { + b.Property("UserId"); + + b.Property("ContactCredits"); + + b.Property("Credits"); + + b.HasKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Activity", b => + { + b.Property("Code") + .HasAnnotation("MaxLength", 512); + + b.Property("ActorDenomination"); + + b.Property("Description"); + + b.Property("ModeratorGroupName"); + + b.Property("Name") + .IsRequired() + .HasAnnotation("MaxLength", 512); + + b.Property("Photo"); + + b.HasKey("Code"); + }); + + modelBuilder.Entity("Yavsc.Models.ApplicationUser", b => + { + b.Property("Id"); + + b.Property("AccessFailedCount"); + + b.Property("Avatar"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken(); + + b.Property("DedicatedGoogleCalendar"); + + b.Property("Email") + .HasAnnotation("MaxLength", 256); + + b.Property("EmailConfirmed"); + + b.Property("LockoutEnabled"); + + b.Property("LockoutEnd"); + + b.Property("NormalizedEmail") + .HasAnnotation("MaxLength", 256); + + b.Property("NormalizedUserName") + .HasAnnotation("MaxLength", 256); + + b.Property("PasswordHash"); + + b.Property("PhoneNumber"); + + b.Property("PhoneNumberConfirmed"); + + b.Property("PostalAddressId"); + + b.Property("SecurityStamp"); + + b.Property("TwoFactorEnabled"); + + b.Property("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("Id"); + + b.Property("Active"); + + b.Property("DisplayName"); + + b.Property("LogoutRedirectUri") + .HasAnnotation("MaxLength", 100); + + b.Property("RedirectUri"); + + b.Property("RefreshTokenLifeTime"); + + b.Property("Secret"); + + b.Property("Type"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Auth.RefreshToken", b => + { + b.Property("Id"); + + b.Property("ClientId") + .IsRequired() + .HasAnnotation("MaxLength", 50); + + b.Property("ExpiresUtc"); + + b.Property("IssuedUtc"); + + b.Property("ProtectedTicket") + .IsRequired(); + + b.Property("Subject") + .IsRequired() + .HasAnnotation("MaxLength", 50); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.BalanceImpact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("BalanceId") + .IsRequired(); + + b.Property("ExecDate"); + + b.Property("Impact"); + + b.Property("Reason") + .IsRequired(); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.CommandLine", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ArticleId"); + + b.Property("Count"); + + b.Property("Description") + .IsRequired(); + + b.Property("EstimateId"); + + b.Property("EstimateTemplateId"); + + b.Property("UnitaryCost"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.Estimate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AttachedFilesString"); + + b.Property("AttachedGraphicsString"); + + b.Property("ClientId") + .IsRequired(); + + b.Property("CommandId"); + + b.Property("Description"); + + b.Property("OwnerId") + .IsRequired(); + + b.Property("Status"); + + b.Property("Title"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.EstimateTemplate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Description"); + + b.Property("OwnerId") + .IsRequired(); + + b.Property("Title"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.ExceptionSIREN", b => + { + b.Property("SIREN"); + + b.HasKey("SIREN"); + }); + + modelBuilder.Entity("Yavsc.Models.Blog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AuthorId"); + + b.Property("Content"); + + b.Property("Modified"); + + b.Property("Photo"); + + b.Property("Posted") + .ValueGeneratedOnAdd() + .HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP"); + + b.Property("Rate"); + + b.Property("Title"); + + b.Property("Visible"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Booking.BookQuery", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClientId") + .IsRequired(); + + b.Property("CreationDate") + .ValueGeneratedOnAdd() + .HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP"); + + b.Property("EventDate"); + + b.Property("LocationId"); + + b.Property("PerformerId") + .IsRequired(); + + b.Property("Previsional"); + + b.Property("ValidationDate"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Circle", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ApplicationUserId"); + + b.Property("Name"); + + b.Property("OwnerId"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.CircleMember", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("CircleId"); + + b.Property("MemberId") + .IsRequired(); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Contact", b => + { + b.Property("OwnerId"); + + b.Property("UserId"); + + b.HasKey("OwnerId", "UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Identity.GoogleCloudMobileDeclaration", b => + { + b.Property("DeviceId"); + + b.Property("DeclarationDate") + .ValueGeneratedOnAdd() + .HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP"); + + b.Property("DeviceOwnerId"); + + b.Property("GCMRegistrationId") + .IsRequired(); + + b.Property("Model"); + + b.Property("Platform"); + + b.Property("Version"); + + b.HasKey("DeviceId"); + }); + + modelBuilder.Entity("Yavsc.Models.Market.BaseProduct", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Description"); + + b.Property("Discriminator") + .IsRequired(); + + b.Property("Name"); + + b.Property("Public"); + + b.HasKey("Id"); + + b.HasAnnotation("Relational:DiscriminatorProperty", "Discriminator"); + + b.HasAnnotation("Relational:DiscriminatorValue", "BaseProduct"); + }); + + modelBuilder.Entity("Yavsc.Models.Market.Service", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ContextId"); + + b.Property("Description"); + + b.Property("Name"); + + b.Property("Public"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.OAuth.OAuth2Tokens", b => + { + b.Property("UserId"); + + b.Property("AccessToken"); + + b.Property("Expiration"); + + b.Property("ExpiresIn"); + + b.Property("RefreshToken"); + + b.Property("TokenType"); + + b.HasKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.PostTag", b => + { + b.Property("PostId"); + + b.Property("TagId"); + + b.HasKey("PostId", "TagId"); + }); + + modelBuilder.Entity("Yavsc.Models.Skill", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name"); + + b.Property("Rate"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name") + .IsRequired(); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b => + { + b.Property("PerformerId"); + + b.Property("AcceptGeoLocalization"); + + b.Property("AcceptNotifications"); + + b.Property("AcceptPublicContact"); + + b.Property("Active"); + + b.Property("ActivityCode") + .IsRequired(); + + b.Property("MaxDailyCost"); + + b.Property("MinDailyCost"); + + b.Property("OfferId"); + + b.Property("OrganizationAddressId"); + + b.Property("Rate"); + + b.Property("SIREN") + .IsRequired() + .HasAnnotation("MaxLength", 14); + + b.Property("WebSite"); + + b.HasKey("PerformerId"); + }); + + modelBuilder.Entity("Yavsc.Models.Market.Product", b => + { + b.HasBaseType("Yavsc.Models.Market.BaseProduct"); + + b.Property("Depth"); + + b.Property("Height"); + + b.Property("Price"); + + b.Property("Weight"); + + b.Property("Width"); + + b.HasAnnotation("Relational:DiscriminatorValue", "Product"); + }); + + modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNet.Identity.EntityFramework.IdentityRole") + .WithMany() + .HasForeignKey("RoleId"); + }); + + modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole", 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"); + }); + } + } +} diff --git a/Yavsc/Migrations/20160920215459_avatar.cs b/Yavsc/Migrations/20160920215459_avatar.cs new file mode 100644 index 00000000..46ac8643 --- /dev/null +++ b/Yavsc/Migrations/20160920215459_avatar.cs @@ -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_IdentityRole_RoleId", table: "AspNetRoleClaims"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim_ApplicationUser_UserId", table: "AspNetUserClaims"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin_ApplicationUser_UserId", table: "AspNetUserLogins"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole_IdentityRole_RoleId", table: "AspNetUserRoles"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole_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( + name: "Avatar", + table: "AspNetUsers", + nullable: true); + migrationBuilder.AddForeignKey( + name: "FK_IdentityRoleClaim_IdentityRole_RoleId", + table: "AspNetRoleClaims", + column: "RoleId", + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserClaim_ApplicationUser_UserId", + table: "AspNetUserClaims", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserLogin_ApplicationUser_UserId", + table: "AspNetUserLogins", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserRole_IdentityRole_RoleId", + table: "AspNetUserRoles", + column: "RoleId", + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserRole_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_IdentityRole_RoleId", table: "AspNetRoleClaims"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim_ApplicationUser_UserId", table: "AspNetUserClaims"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin_ApplicationUser_UserId", table: "AspNetUserLogins"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole_IdentityRole_RoleId", table: "AspNetUserRoles"); + migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole_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_IdentityRole_RoleId", + table: "AspNetRoleClaims", + column: "RoleId", + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserClaim_ApplicationUser_UserId", + table: "AspNetUserClaims", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserLogin_ApplicationUser_UserId", + table: "AspNetUserLogins", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserRole_IdentityRole_RoleId", + table: "AspNetUserRoles", + column: "RoleId", + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserRole_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); + } + } +} diff --git a/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs b/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs index 806f014a..498caf50 100644 --- a/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs @@ -149,6 +149,8 @@ namespace Yavsc.Migrations b.Property("AccessFailedCount"); + b.Property("Avatar"); + b.Property("ConcurrencyStamp") .IsConcurrencyToken(); @@ -264,14 +266,15 @@ namespace Yavsc.Migrations b.Property("ArticleId"); - b.Property("BookQueryId"); - - b.Property("Comment"); - b.Property("Count"); + b.Property("Description") + .IsRequired(); + b.Property("EstimateId"); + b.Property("EstimateTemplateId"); + b.Property("UnitaryCost"); b.HasKey("Id"); @@ -303,6 +306,21 @@ namespace Yavsc.Migrations b.HasKey("Id"); }); + modelBuilder.Entity("Yavsc.Models.Billing.EstimateTemplate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Description"); + + b.Property("OwnerId") + .IsRequired(); + + b.Property("Title"); + + b.HasKey("Id"); + }); + modelBuilder.Entity("Yavsc.Models.Billing.ExceptionSIREN", b => { b.Property("SIREN"); @@ -350,8 +368,6 @@ namespace Yavsc.Migrations b.Property("EventDate"); - b.Property("Lag"); - b.Property("LocationId"); b.Property("PerformerId") @@ -618,13 +634,13 @@ namespace Yavsc.Migrations .WithMany() .HasForeignKey("ArticleId"); - b.HasOne("Yavsc.Models.Booking.BookQuery") - .WithMany() - .HasForeignKey("BookQueryId"); - 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 => diff --git a/Yavsc/Model/ApplicationDbContext.cs b/Yavsc/Model/ApplicationDbContext.cs index e0cd5194..02acf328 100644 --- a/Yavsc/Model/ApplicationDbContext.cs +++ b/Yavsc/Model/ApplicationDbContext.cs @@ -181,6 +181,6 @@ namespace Yavsc.Models public DbSet EstimateTemplates { get; set; } - + public DbSet Contacts { get; set; } } } diff --git a/Yavsc/Model/Billing/CommandLine.cs b/Yavsc/Model/Billing/CommandLine.cs index 0e6d0b09..e0ca39dc 100644 --- a/Yavsc/Model/Billing/CommandLine.cs +++ b/Yavsc/Model/Billing/CommandLine.cs @@ -10,7 +10,9 @@ namespace Yavsc.Models.Billing [Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)] public long Id { get; set; } - public string Comment { get; set; } + + [Required] + public string Description { get; set; } public BaseProduct Article { get; set; } public int Count { get; set; } public decimal UnitaryCost { get; set; } diff --git a/Yavsc/Model/Billing/NominatvieCommand.cs b/Yavsc/Model/Billing/NominatvieCommand.cs index 76b235de..98d70a04 100644 --- a/Yavsc/Model/Billing/NominatvieCommand.cs +++ b/Yavsc/Model/Billing/NominatvieCommand.cs @@ -1,6 +1,5 @@ using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Yavsc.Models.Market; @@ -40,12 +39,7 @@ namespace Yavsc.Models.Billing /// The bill /// /// - public List Bill { get; set; } = new List(); - /// - /// Time span in seconds in which - /// Validation will be considered as definitive - /// - public int Lag { get; set; } + } } \ No newline at end of file diff --git a/Yavsc/Model/Booking/BookQuery.cs b/Yavsc/Model/Booking/BookQuery.cs index b8f787c8..1e69785a 100644 --- a/Yavsc/Model/Booking/BookQuery.cs +++ b/Yavsc/Model/Booking/BookQuery.cs @@ -18,29 +18,22 @@ namespace Yavsc.Models.Booking [Display(Name="Event date")] public DateTime EventDate{ - get - { return ((RendezVous)Bill[0]).EventDate; } - set { ((RendezVous)Bill[0]).EventDate = value; } + get; + set; } public Location Location { - get - { return ((RendezVous)Bill[0]).Location; } - set { ((RendezVous)Bill[0]).Location = value; }} + get; + set; + } public BookQuery() { - this.Bill.Add(new RendezVous()); } public BookQuery(Location eventLocation, DateTime eventDate) { - this.Bill.Add(new RendezVous{ - Location = eventLocation, - EventDate = eventDate - }); - } - public string GetDescription() { - return $"{Location?.Address} {EventDate.ToString()}"; + Location = eventLocation; + EventDate = eventDate; } } } \ No newline at end of file diff --git a/Yavsc/Model/Calendar/ProvidedEvent.cs b/Yavsc/Model/Calendar/ProvidedEvent.cs index f20e2246..837bdf50 100644 --- a/Yavsc/Model/Calendar/ProvidedEvent.cs +++ b/Yavsc/Model/Calendar/ProvidedEvent.cs @@ -30,13 +30,6 @@ namespace Yavsc.Models.Calendar /// Provided event. /// public class ProvidedEvent : YaEvent { - - public ProvidedEvent(string topic) : base(topic) - { - - } - - /// /// The privacy. /// diff --git a/Yavsc/Model/Identity/ApplicationUser.cs b/Yavsc/Model/Identity/ApplicationUser.cs index d986ee4e..ceb98bdb 100644 --- a/Yavsc/Model/Identity/ApplicationUser.cs +++ b/Yavsc/Model/Identity/ApplicationUser.cs @@ -9,24 +9,62 @@ namespace Yavsc.Models { public class ApplicationUser : IdentityUser { - - [Display(Name="AccountBalance")] + /// + /// Another me, as a byte array. + /// This value points a picture that may be used + /// to sign documents. + /// + /// the path to an user's image, relative to it's dir + /// Startup.UserFilesOptions + /// + /// + public string Avatar { get; set; } + /// + /// WIP Paypal + /// + /// + [Display(Name="Account balance")] public virtual AccountBalance AccountBalance { get; set; } + /// + /// User's posts + /// + /// [InverseProperty("Author")] public virtual List Posts { get; set; } + /// + /// User's contact list + /// + /// [InverseProperty("Owner")] public virtual List Book { get; set; } + /// + /// External devices using the API + /// + /// [InverseProperty("DeviceOwner")] public virtual List Devices { get; set; } + /// + /// User's circles + /// + /// [InverseProperty("Owner")] public virtual List Circles { get; set; } + + /// + /// Billing postal address + /// + /// public virtual Location PostalAddress { get; set; } + /// + /// User's Google calendar + /// + /// public string DedicatedGoogleCalendar { get; set; } public override string ToString() { diff --git a/Yavsc/Model/Messaging/BaseEvent.cs b/Yavsc/Model/Messaging/BaseEvent.cs index 19c2db10..ea946638 100644 --- a/Yavsc/Model/Messaging/BaseEvent.cs +++ b/Yavsc/Model/Messaging/BaseEvent.cs @@ -27,7 +27,23 @@ namespace Yavsc.Models.Messaging /// /// Base event. /// - 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 { /// /// The title. diff --git a/Yavsc/Model/Messaging/BookQueryEvent.cs b/Yavsc/Model/Messaging/BookQueryEvent.cs index 53f5b40c..060e2677 100644 --- a/Yavsc/Model/Messaging/BookQueryEvent.cs +++ b/Yavsc/Model/Messaging/BookQueryEvent.cs @@ -1,8 +1,7 @@ -using System; -using System.ComponentModel.DataAnnotations; namespace Yavsc.Models.Messaging { +using Yavsc.Model; // // BookQueryEvent.cs @@ -25,31 +24,27 @@ namespace Yavsc.Models.Messaging // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see . -public class BookQueryEvent: YaEvent +public class BookQueryEvent: BookQueryProviderView, IEvent { - public BookQueryEvent() : base("BookQuery") + public BookQueryEvent() { - + Topic = "BookQuery"; } - /// - /// The location. - /// - [Display(Name="Location")] - public Location Location { get; set; } - /// - /// The start date. - /// - [Display(Name="StartDate")] - public DateTime StartDate { get; set; } - /// - /// Gets or sets the end date. - /// - /// The end date. - [Display(Name="EndDate")] - public DateTime EndDate { get; set; } + public string Message + { + get; set; + } - public long CommandId { get; set; } - } + public string Sender + { + get; set; + } + + public string Topic + { + get; set; + } + } } diff --git a/Yavsc/Model/Messaging/CircleEvent.cs b/Yavsc/Model/Messaging/CircleEvent.cs index f9317eb5..ad9de407 100644 --- a/Yavsc/Model/Messaging/CircleEvent.cs +++ b/Yavsc/Model/Messaging/CircleEvent.cs @@ -29,11 +29,6 @@ namespace Yavsc.Models.Messaging /// public class CircleEvent: YaEvent { - public CircleEvent(string topic) : base(topic) - { - - } - /// /// Gets or sets the circles. /// diff --git a/Yavsc/Model/Messaging/ClientProviderInfo.cs b/Yavsc/Model/Messaging/ClientProviderInfo.cs new file mode 100644 index 00000000..7febd680 --- /dev/null +++ b/Yavsc/Model/Messaging/ClientProviderInfo.cs @@ -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; } + } + +} \ No newline at end of file diff --git a/Yavsc/Model/Messaging/YaEvent.cs b/Yavsc/Model/Messaging/YaEvent.cs index aca7190b..ce7304bd 100644 --- a/Yavsc/Model/Messaging/YaEvent.cs +++ b/Yavsc/Model/Messaging/YaEvent.cs @@ -28,24 +28,12 @@ namespace Yavsc.Models.Messaging /// public class YaEvent : BaseEvent { - public YaEvent(string topic) - { - Topic = topic; - } - /// - /// The topic. - /// - public string Topic { get; set; } /// /// The NF provider identifier. /// - [Display(Name="ProviderId")] - public string ProviderId { get; set; } - /// - /// The promotion code. - /// - [Display(Name="Comment")] - public string Comment { get; set; } + [Display(Name="From")] + public string FromUserName { get; set; } + /// /// The event web page. /// diff --git a/Yavsc/Model/Relationship/Contact.cs b/Yavsc/Model/Relationship/Contact.cs index ac845e7d..0dea2092 100644 --- a/Yavsc/Model/Relationship/Contact.cs +++ b/Yavsc/Model/Relationship/Contact.cs @@ -12,7 +12,10 @@ namespace Yavsc.Models [Required()] public string OwnerId { get; set; } - [ForeignKeyAttribute("OwnerId"),JsonIgnore] + [ForeignKeyAttribute("OwnerId"),NotMapped] public virtual ApplicationUser Owner { get; set; } + + [ForeignKeyAttribute("UserId"),NotMapped] + public virtual ApplicationUser User { get; set; } } } diff --git a/Yavsc/Services/IGoogleCloudMessageSender.cs b/Yavsc/Services/IGoogleCloudMessageSender.cs index b4db0123..033759c7 100644 --- a/Yavsc/Services/IGoogleCloudMessageSender.cs +++ b/Yavsc/Services/IGoogleCloudMessageSender.cs @@ -8,6 +8,6 @@ namespace Yavsc.Services { public interface IGoogleCloudMessageSender { - Task NotifyAsync(GoogleAuthSettings googlesettings, IEnumerable registrationId, YaEvent ev); + Task NotifyBookQueryAsync(GoogleAuthSettings googlesettings, IEnumerable registrationId, BookQueryEvent ev); } } diff --git a/Yavsc/Services/MessageServices.cs b/Yavsc/Services/MessageServices.cs index c9d7b5b6..33f54fd1 100755 --- a/Yavsc/Services/MessageServices.cs +++ b/Yavsc/Services/MessageServices.cs @@ -28,11 +28,11 @@ namespace Yavsc.Services /// bool somethingsent = (response.failure == 0 && response.success > 0) /// public async Task - NotifyAsync(GoogleAuthSettings googleSettings, IEnumerable registrationIds, YaEvent ev) + NotifyBookQueryAsync(GoogleAuthSettings googleSettings, IEnumerable registrationIds, BookQueryEvent ev) { MessageWithPayloadResponse response = null; await Task.Run(()=>{ - response = googleSettings.NotifyEvent(registrationIds, ev); + response = googleSettings.NotifyEvent(registrationIds, ev); }); return response; } diff --git a/Yavsc/Startup/Startup.FileServer.cs b/Yavsc/Startup/Startup.FileServer.cs index f40ae025..2f66ed44 100644 --- a/Yavsc/Startup/Startup.FileServer.cs +++ b/Yavsc/Startup/Startup.FileServer.cs @@ -11,26 +11,24 @@ namespace Yavsc public partial class Startup { public static string UserFilesDirName { get; private set; } + public static FileServerOptions UserFilesOptions { get; private set; } public void ConfigureFileServerApp(IApplicationBuilder app, SiteSettings siteSettings, IHostingEnvironment env) { - var rootPath = Path.Combine( + UserFilesDirName = Path.Combine( env.WebRootPath, - // TODO: add a ressource serveur id here, - // 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(); + siteSettings.UserFiles.DirName); + 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), EnableDirectoryBrowsing = env.IsDevelopment() - }); + }; + app.UseFileServer(UserFilesOptions); app.UseStaticFiles(); } } diff --git a/Yavsc/ViewModels/Account/Me.cs b/Yavsc/ViewModels/Account/Me.cs index 0f9cdb6e..c79093d4 100644 --- a/Yavsc/ViewModels/Account/Me.cs +++ b/Yavsc/ViewModels/Account/Me.cs @@ -8,13 +8,15 @@ namespace Yavsc.Models.Auth string username, IEnumerable emails, IEnumerable roles, - string avatar) + string avatar, + string address) { Id = useruserid; UserName = username; EMails = emails.ToArray(); Roles = roles.ToArray(); Avatar = avatar; + Address = address; } public string Id { get; set; } public string UserName { get; set; } @@ -25,7 +27,11 @@ namespace Yavsc.Models.Auth /// /// public string Avatar { get; set; } - + public string Address { get; set; } } +public class MyUpdate { + public string UserName { get; set; } + public string Avatar { get; set; } +} } \ No newline at end of file diff --git a/Yavsc/Views/Blogspot/Edit.cshtml b/Yavsc/Views/Blogspot/Edit.cshtml index 77877002..2f414d0c 100644 --- a/Yavsc/Views/Blogspot/Edit.cshtml +++ b/Yavsc/Views/Blogspot/Edit.cshtml @@ -136,8 +136,6 @@ editorcontenu.on('text-change',function(delta,source){

- -
diff --git a/Yavsc/Views/Home/Chat.cshtml b/Yavsc/Views/Home/Chat.cshtml index 98ba6e54..397f684b 100644 --- a/Yavsc/Views/Home/Chat.cshtml +++ b/Yavsc/Views/Home/Chat.cshtml @@ -5,9 +5,18 @@
+ + +
+
    +
@section scripts { @@ -27,6 +36,11 @@ $('#discussion').append('
  • ' + htmlEncode(name) + ': ' + htmlEncode(message) + '
  • '); }; + chat.client.PV = function (name, message) { + // Add the pv to the page. + $('#private').append('
  • ' + htmlEncode(name) + + ': ' + htmlEncode(message) + '
  • '); + }; // Get the user name and store it to prepend to messages. $('#displayname').val(prompt('Enter your name:', '')); // Set initial focus to message input box. @@ -39,6 +53,12 @@ // Clear text box and reset focus for next comment. $('#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. diff --git a/Yavsc/contrib/install_earth.sql b/Yavsc/contrib/install_earth.sql new file mode 100644 index 00000000..0a5cb225 --- /dev/null +++ b/Yavsc/contrib/install_earth.sql @@ -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 \ No newline at end of file diff --git a/Yavsc/tasks.todo b/Yavsc/tasks.todo index e224df39..97e64af6 100644 --- a/Yavsc/tasks.todo +++ b/Yavsc/tasks.todo @@ -4,23 +4,39 @@ Da road to the hell ## Jalon 1 -✔ Acces (publique) aux Blogs @done (August 13th 2016, 0:51) -✔ 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) -☐ Proposition de devis sur BookQuery -☐ Signature de contrat + ✔ Acces (publique) aux Blogs @done (August 13th 2016, 0:51) + ✔ 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) + ✔ Notifications commande @done (September 15th 2016, 15:00) + ☐ Proposition de devis sur BookQuery + ☐ Signature de contrat ## Jalon 2 -☐ Paiement client -☐ Login Twitter -☐ Notifications commande -☐ Saisie du devis sur commande générique + ☐ Paiement client d'un approvisionnement pour une demande de prestation définie + ☐ Login Twitter + ☐ Notifications et Twits de blogs, d'entées d'artiste, de success stories -## Jalon 3 +## Jalon 3 -☐ Aide à la rencontre -☐ activités secondaires + ☐ Saisie du devis sur commande générique + ☐ Saisie d'un devis à destination d'un invité [email] + ☐ Paiement d'Arrhes -☐ Arrhes -☐ conciliation +## Jalon 4 + + ☐ 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