diff --git a/src/Yavsc.Server/Models/Access/CircleAuthorizationToFile.cs b/src/Yavsc.Server/Models/Access/CircleAuthorizationToFile.cs deleted file mode 100644 index e29ca3d6..00000000 --- a/src/Yavsc.Server/Models/Access/CircleAuthorizationToFile.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Newtonsoft.Json; -using Yavsc.Abstract; -using Yavsc.Abstract.Identity.Security; -using Yavsc.Attributes.Validation; -using Yavsc.Models.Relationship; - -namespace Yavsc.Server.Models.Access -{ - [Obsolete("use rules from .access files")] - public class CircleAuthorizationToFile : ICircleAuthorization - { - - [Required] - public long CircleId - { - get; set; - } - - [Required] - [YaStringLength(48)] - [YaRegularExpression(Constants.UserFileNamePatternRegExp)] - public string FullPath - { - get; set; - } - - [ForeignKey("CircleId"), JsonIgnore] - public virtual Circle Circle { get; set; } - } -} diff --git a/src/Yavsc/ApiControllers/FileCircleApiController.cs b/src/Yavsc/ApiControllers/FileCircleApiController.cs deleted file mode 100644 index 0c16f4e3..00000000 --- a/src/Yavsc/ApiControllers/FileCircleApiController.cs +++ /dev/null @@ -1,188 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using System.Security.Claims; -using System.Threading.Tasks; -using Microsoft.AspNet.Authorization; -using Microsoft.AspNet.Http; -using Microsoft.AspNet.Mvc; -using Microsoft.Data.Entity; -using Yavsc.Models; -using Yavsc.Server.Models.Access; - -namespace Yavsc.Controllers -{ - [Produces("application/json")] - [Route("api/FileCircleApi")] - [Authorize] - public class FileCircleApiController : Controller - { - private readonly ApplicationDbContext _context; - - public FileCircleApiController(ApplicationDbContext context) - { - _context = context; - } - - // GET: api/FileCircleApi - [HttpGet] - public IEnumerable GetCircleAuthorizationToFile() - { - - var uid = User.GetUserId(); - return _context.CircleAuthorizationToFile - .Include( m => m.Circle) - .Where( m => m.Circle.OwnerId == uid); - - // .Where( m => (m.Circle.Public || m.Circle.OwnerId == uid || m.Circle.Members.Any(u=>u.MemberId == uid) )); - } - - // GET: api/FileCircleApi/5 - [HttpGet("{id}", Name = "GetCircleAuthorizationToFile")] - public async Task GetCircleAuthorizationToFile([FromRoute] long id) - { - if (!ModelState.IsValid) - { - return HttpBadRequest(ModelState); - } - var uid = User.GetUserId(); - - CircleAuthorizationToFile circleAuthorizationToFile = await _context.CircleAuthorizationToFile - .Include(m => m.Circle) - .Include( m => m.Circle.Members) - .SingleOrDefaultAsync(m => m.Circle.OwnerId == uid && m.CircleId == id); - - if (circleAuthorizationToFile == null) - { - return HttpNotFound(); - } - - return Ok(circleAuthorizationToFile); - } - - // PUT: api/FileCircleApi/5 - [HttpPut("{id}")] - public async Task PutCircleAuthorizationToFile([FromRoute] long id, [FromBody] CircleAuthorizationToFile circleAuthorizationToFile) - { - if (!ModelState.IsValid) - { - return HttpBadRequest(ModelState); - } - - if (id != circleAuthorizationToFile.CircleId) - { - return HttpBadRequest(); - } - var uid = User.GetUserId(); - var circle = await _context.Circle.FirstOrDefaultAsync(c=>c.Id == id); - if (circle == null) - { - return HttpBadRequest(); - } - - if (uid != circle.OwnerId) - { - return HttpBadRequest(); - } - - _context.Entry(circleAuthorizationToFile).State = EntityState.Modified; - - try - { - await _context.SaveChangesAsync(uid); - } - catch (DbUpdateConcurrencyException) - { - if (!CircleAuthorizationToFileExists(id)) - { - return HttpNotFound(); - } - else - { - throw; - } - } - - return new HttpStatusCodeResult(StatusCodes.Status204NoContent); - } - - // POST: api/FileCircleApi - [HttpPost] - public async Task PostCircleAuthorizationToFile([FromBody] CircleAuthorizationToFile circleAuthorizationToFile) - { - - if (!ModelState.IsValid) - { - return HttpBadRequest(ModelState); - } - var uid = User.GetUserId(); - var circle = await _context.Circle.FirstOrDefaultAsync(c=>c.Id == circleAuthorizationToFile.CircleId); - if (circle == null || circle.OwnerId != uid) - { - return HttpBadRequest(); - } - - - _context.CircleAuthorizationToFile.Add(circleAuthorizationToFile); - try - { - await _context.SaveChangesAsync(uid); - } - catch (DbUpdateException) - { - if (CircleAuthorizationToFileExists(circleAuthorizationToFile.CircleId)) - { - return new HttpStatusCodeResult(StatusCodes.Status409Conflict); - } - else - { - throw; - } - } - - return CreatedAtRoute("GetCircleAuthorizationToFile", new { id = circleAuthorizationToFile.CircleId }, circleAuthorizationToFile); - } - - // DELETE: api/FileCircleApi/5 - [HttpDelete("{id}")] - public async Task DeleteCircleAuthorizationToFile([FromRoute] long id) - { - - if (!ModelState.IsValid) - { - return HttpBadRequest(ModelState); - } - - CircleAuthorizationToFile circleAuthorizationToFile = await _context.CircleAuthorizationToFile - .Include(c=>c.Circle).SingleAsync(m => m.CircleId == id); - if (circleAuthorizationToFile == null) - { - return HttpNotFound(); - } - - var uid = User.GetUserId(); - if (circleAuthorizationToFile == null || circleAuthorizationToFile.Circle.OwnerId != uid) - { - return HttpBadRequest(); - } - - _context.CircleAuthorizationToFile.Remove(circleAuthorizationToFile); - await _context.SaveChangesAsync(); - - return Ok(circleAuthorizationToFile); - } - - protected override void Dispose(bool disposing) - { - if (disposing) - { - _context.Dispose(); - } - base.Dispose(disposing); - } - - private bool CircleAuthorizationToFileExists(long id) - { - return _context.CircleAuthorizationToFile.Count(e => e.CircleId == id) > 0; - } - } -} diff --git a/src/Yavsc/ApiControllers/Streaming/LiveApiController.cs b/src/Yavsc/ApiControllers/Streaming/LiveApiController.cs deleted file mode 100644 index 14656551..00000000 --- a/src/Yavsc/ApiControllers/Streaming/LiveApiController.cs +++ /dev/null @@ -1,209 +0,0 @@ - -using System.Linq; -using System.Net.WebSockets; -using System.Security.Claims; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.AspNet.Http; -using Microsoft.AspNet.Mvc; -using Microsoft.Data.Entity; -using Yavsc.Models; -using Yavsc.Models.Streaming; -using Yavsc.Services; - -namespace Yavsc.Controllers -{ - [Route("api/live")] - public class LiveApiController : Controller - { - readonly ILiveProcessor _liveProcessor; - private readonly ApplicationDbContext _dbContext; - - /// - /// Live Api Controller - /// - /// - /// - - public LiveApiController( - ApplicationDbContext context, - ILiveProcessor liveProcessor) - { - _liveProcessor = liveProcessor; - _dbContext = context; - } - - [HttpGet("filenamehint/{id}")] - public async Task GetFileNameHint(string id) - { - return await _dbContext.Tags.Where( t=> t.Name.StartsWith(id)).Select(t=>t.Name).Take(25).ToArrayAsync(); - } - - [HttpGet("live/uid-{id}")] - public async Task ByUserId(string id) - { - // TODO read access rights - // TODO multiple channel - if (!HttpContext.WebSockets.IsWebSocketRequest) return new BadRequestResult(); - var uid = User.GetUserId(); - var existent = _liveProcessor.Casters[id]; - var socket = await HttpContext.WebSockets.AcceptWebSocketAsync(); - if (existent.Listeners.TryAdd(uid,socket)) { - return Ok(); - } - else { - await socket.CloseAsync(WebSocketCloseStatus.EndpointUnavailable,"Listeners.TryAdd failed",CancellationToken.None); - } - return HttpBadRequest("Listeners.TryAdd returned false"); - } - - /// - /// Lists user's live castings - /// - /// user id - /// - public IActionResult Index(long? id) - { - if (id==0) - return View("Index", _liveProcessor.Casters.Select(c=> new { UserName = c.Key, Listenning = c.Value.Listeners.Count })); - - var flow = _dbContext.LiveFlow.SingleOrDefault(f=>f.Id == id); - if (flow == null) return HttpNotFound(); - - return View("Flow", flow); - - } - - - [HttpGet("meta/uid-{id}")] - public async Task GetLiveFlow([FromRoute] long id) - { - if (!ModelState.IsValid) - { - return HttpBadRequest(ModelState); - } - - LiveFlow liveFlow = await _dbContext.LiveFlow.SingleAsync(m => m.Id == id); - - if (liveFlow == null) - { - return HttpNotFound(); - } - - return Ok(liveFlow); - } - - [HttpPut("meta/{id}")] - public async Task PutLiveFlow([FromRoute] long id, [FromBody] LiveFlow liveFlow) - { - if (!ModelState.IsValid) - { - return HttpBadRequest(ModelState); - } - - if (id != liveFlow.Id) - { - return HttpBadRequest(); - } - var uid = User.GetUserId(); - if (liveFlow.OwnerId!=uid) - { - ModelState.AddModelError("id","This flow isn't yours."); - return HttpBadRequest(ModelState); - } - - _dbContext.Entry(liveFlow).State = EntityState.Modified; - - try - { - await _dbContext.SaveChangesAsync(uid); - } - catch (DbUpdateConcurrencyException) - { - if (!LiveFlowExists(id)) - { - return HttpNotFound(); - } - else - { - throw; - } - } - - return new HttpStatusCodeResult(StatusCodes.Status204NoContent); - } - - [HttpPost("meta")] - public async Task PostLiveFlow([FromBody] LiveFlow liveFlow) - { - if (!ModelState.IsValid) - { - return HttpBadRequest(ModelState); - } - - var uid = User.GetUserId(); - liveFlow.OwnerId=uid; - - _dbContext.LiveFlow.Add(liveFlow); - try - { - await _dbContext.SaveChangesAsync(uid); - } - catch (DbUpdateException) - { - if (LiveFlowExists(liveFlow.Id)) - { - return new HttpStatusCodeResult(StatusCodes.Status409Conflict); - } - else - { - throw; - } - } - - return CreatedAtRoute("GetLiveFlow", new { id = liveFlow.Id }, liveFlow); - } - - // DELETE: api/LiveApi/5 - [HttpDelete("meta/uid-{uid}")] - public async Task DeleteLiveFlow([FromRoute] long uid) - { - if (!ModelState.IsValid) - { - return HttpBadRequest(ModelState); - } - - LiveFlow liveFlow = await _dbContext.LiveFlow.SingleAsync(m => m.Id == uid); - if (liveFlow == null) - { - return HttpNotFound(); - } - - var cuid = User.GetUserId(); - if (liveFlow.OwnerId!=cuid) - { - ModelState.AddModelError("id","This flow isn't yours."); - return HttpBadRequest(ModelState); - } - - _dbContext.LiveFlow.Remove(liveFlow); - await _dbContext.SaveChangesAsync(cuid); - - return Ok(liveFlow); - } - - protected override void Dispose(bool disposing) - { - if (disposing) - { - _dbContext.Dispose(); - } - base.Dispose(disposing); - } - - private bool LiveFlowExists(long id) - { - return _dbContext.LiveFlow.Count(e => e.Id == id) > 0; - } - } -} diff --git a/src/Yavsc/Controllers/Administration/MailingTemplateController.cs b/src/Yavsc/Controllers/Administration/MailingTemplateController.cs index 2d5cee82..5fe80c6c 100644 --- a/src/Yavsc/Controllers/Administration/MailingTemplateController.cs +++ b/src/Yavsc/Controllers/Administration/MailingTemplateController.cs @@ -12,6 +12,7 @@ using Microsoft.AspNet.Authorization; using Yavsc.Templates; using System.Linq; using Microsoft.Extensions.Logging; +using Yavsc.Server.Settings; namespace Yavsc.Controllers { @@ -69,7 +70,7 @@ namespace Yavsc.Controllers { ViewBag.ManagerId = new SelectList(_context.ApplicationUser, "Id", "UserName"); ViewBag.ToSend = GetSelectFromEnum(typeof(Periodicity)); - ViewBag.Id = TemplateConstants.Criterias.Select( + ViewBag.Id = UserPolicies.Criterias.Select( c => new SelectListItem{ Text = c.Key, Value = c.Key }).ToList(); } diff --git a/src/Yavsc/Controllers/Communicating/LiveFlowController.cs b/src/Yavsc/Controllers/Communicating/LiveFlowController.cs deleted file mode 100644 index f54b8dae..00000000 --- a/src/Yavsc/Controllers/Communicating/LiveFlowController.cs +++ /dev/null @@ -1,183 +0,0 @@ -using System.Linq; -using System.Security.Claims; -using System.Threading.Tasks; -using Microsoft.AspNet.Authorization; -using Microsoft.AspNet.Mvc; -using Microsoft.AspNet.Mvc.Rendering; -using Microsoft.Data.Entity; -using Yavsc.Models; -using Yavsc.Models.Streaming; - -namespace Yavsc.Controllers -{ - public class LiveFlowController : Controller - { - private readonly ApplicationDbContext _context; - - public LiveFlowController(ApplicationDbContext context) - { - _context = context; - } - - // GET: LiveFlow - public async Task Index() - { - var uid = User.GetUserId(); - var applicationDbContext = _context.LiveFlow.Where(f=>f.OwnerId == uid); - return View(await applicationDbContext.ToListAsync()); - } - - public async Task AdminIndex() - { - var applicationDbContext = _context.LiveFlow.Include(l => l.Owner); - return View(await applicationDbContext.ToListAsync()); - } - - // GET: LiveFlow/Details/5 - public async Task Details(long? id) - { - if (id == null) - { - return HttpNotFound(); - } - - LiveFlow liveFlow = await _context.LiveFlow.SingleAsync(m => m.Id == id); - if (liveFlow == null) - { - return HttpNotFound(); - } - - return View(liveFlow); - } - - // GET: LiveFlow/Create - public IActionResult Create() - { - ViewData["OwnerId"] = new SelectList(_context.ApplicationUser, "Id", "Owner"); - return View(); - } - - // POST: LiveFlow/Create - [HttpPost] - [ValidateAntiForgeryToken] - public async Task Create(LiveFlow liveFlow) - { - if (ModelState.IsValid) - { - _context.LiveFlow.Add(liveFlow); - await _context.SaveChangesAsync(); - return RedirectToAction("Index"); - } - ViewData["OwnerId"] = new SelectList(_context.ApplicationUser, "Id", "Owner", liveFlow.OwnerId); - return View(liveFlow); - } - - // GET: LiveFlow/Edit/5 - public async Task Edit(long? id) - { - if (id == null) - { - return HttpNotFound(); - } - - LiveFlow liveFlow = await _context.LiveFlow.SingleAsync(m => m.Id == id); - if (liveFlow == null) - { - return HttpNotFound(); - } - - return View(liveFlow); - } - - public async Task AdminEdit(long? id) - { - if (id == null) - { - return HttpNotFound(); - } - - LiveFlow liveFlow = await _context.LiveFlow.SingleAsync(m => m.Id == id); - if (liveFlow == null) - { - return HttpNotFound(); - } - - ViewBag.OwnerId = _context.ApplicationUser.Select - (u=> new SelectListItem(){Text=u.UserName,Value=u.Id,Selected=liveFlow.OwnerId==u.Id}); - return View("AdminEdit", liveFlow); - } - // POST: LiveFlow/Edit/5 - [HttpPost] - [ValidateAntiForgeryToken] - public async Task Edit(LiveFlow liveFlow) - { - if (User.GetUserId()!=liveFlow.OwnerId) - { - ModelState.AddModelError("OwnerId","denied"); - } - else if (ModelState.IsValid) - { - _context.Update(liveFlow); - await _context.SaveChangesAsync(); - return RedirectToAction("Index"); - } - return View(liveFlow); - } - - - // POST: LiveFlow/Edit/5 - [HttpPost] - [ValidateAntiForgeryToken] - [Authorize("AdministratorOnly")] - public async Task AdminEdit(LiveFlow liveFlow) - { - if (ModelState.IsValid) - { - _context.Update(liveFlow); - await _context.SaveChangesAsync(); - return RedirectToAction("Index"); - } - ViewData["OwnerId"] = new SelectList(_context.ApplicationUser, "Id", "Owner", liveFlow.OwnerId); - return View(liveFlow); - } - - // GET: LiveFlow/Delete/5 - [ActionName("Delete")] - public async Task Delete(long? id) - { - if (id == null) - { - return HttpNotFound(); - } - LiveFlow liveFlow = await _context.LiveFlow.SingleAsync(m => m.Id == id); - - if (liveFlow == null) - { - return HttpNotFound(); - } - else if (User.GetUserId()!=liveFlow.OwnerId) - { - ModelState.AddModelError("OwnerId","denied"); - } - - return View(liveFlow); - } - - // POST: LiveFlow/Delete/5 - [HttpPost, ActionName("Delete")] - [ValidateAntiForgeryToken] - public async Task DeleteConfirmed(long id) - { - LiveFlow liveFlow = await _context.LiveFlow.SingleAsync(m => m.Id == id); - if (User.GetUserId()!=liveFlow.OwnerId) - { - ModelState.AddModelError("OwnerId","denied"); - } else - { - _context.LiveFlow.Remove(liveFlow); - await _context.SaveChangesAsync(); - } - return RedirectToAction("Index"); - } - } -} diff --git a/src/Yavsc/Controllers/Communicating/MyFSRulesController.cs b/src/Yavsc/Controllers/Communicating/MyFSRulesController.cs deleted file mode 100644 index c1556fcb..00000000 --- a/src/Yavsc/Controllers/Communicating/MyFSRulesController.cs +++ /dev/null @@ -1,121 +0,0 @@ -using System.Linq; -using System.Security.Claims; -using System.Threading.Tasks; -using Microsoft.AspNet.Authorization; -using Microsoft.AspNet.Mvc; -using Microsoft.AspNet.Mvc.Rendering; -using Microsoft.Data.Entity; -using Microsoft.Extensions.Logging; -using Yavsc.Models; -using Yavsc.Server.Models.Access; - -namespace Yavsc.Controllers -{ - [Authorize()] - public class MyFSRulesController : Controller - { - private readonly ApplicationDbContext _context; - private readonly ILogger _logger; - - public MyFSRulesController(ApplicationDbContext context, - ILoggerFactory loggerFactory) - { - _context = context; - _logger = loggerFactory.CreateLogger(); - } - - // GET: MyFSRules - public async Task Index() - { - var applicationDbContext = _context.CircleAuthorizationToFile.Include(c => c.Circle) - .Where (m=>m.Circle.OwnerId == User.GetUserId()); - return View(await applicationDbContext.ToListAsync()); - } - - // GET: MyFSRules/Details/5 - public async Task Details(long circleId, string fullPath) - { - - var uid = User.GetUserId(); - _logger.LogInformation($"Searching fsa for {uid} :\n {circleId}/{fullPath}"); - CircleAuthorizationToFile circleAuthorizationToFile = - await _context.CircleAuthorizationToFile - .Include(m=>m.Circle) - .SingleOrDefaultAsync(m => ((m.CircleId == circleId) && (m.FullPath == fullPath) && - (m.Circle.OwnerId == uid))); - if (circleAuthorizationToFile == null) - { - return HttpNotFound(); - } - - return View(circleAuthorizationToFile); - } - - // GET: MyFSRules/Create - public IActionResult Create() - { - var uid = User.GetUserId(); - var userCircles = _context.Circle.Where(c=>c.OwnerId == uid); - ViewBag.CircleId = new SelectList(userCircles, "Id", "Name"); - var uccount = userCircles.Count(); - _logger.LogInformation($"User circle count : {uccount}"); - return View(); - } - - // POST: MyFSRules/Create - [HttpPost] - [ValidateAntiForgeryToken] - public async Task Create(CircleAuthorizationToFile circleAuthorizationToFile) - { - var uid = User.GetUserId(); - if (ModelState.IsValid) - { - // refuse to allow files to other circle than user's ones. - var circle = await _context.Circle.SingleOrDefaultAsync(c=>c.Id==circleAuthorizationToFile.CircleId); - if (circle.OwnerId != uid) return this.HttpUnauthorized(); - _context.CircleAuthorizationToFile.Add(circleAuthorizationToFile); - await _context.SaveChangesAsync(); - return RedirectToAction("Index"); - } - var userCircles = _context.Circle.Where(c=>c.OwnerId == uid); - ViewBag.CircleId = new SelectList(userCircles, "Id", "Name"); - return View(circleAuthorizationToFile); - } - - // GET: MyFSRules/Delete/5 - [ActionName("Delete")] - public async Task Delete(long circleId, string fullPath) - { - var uid = User.GetUserId(); - CircleAuthorizationToFile circleAuthorizationToFile = - await _context.CircleAuthorizationToFile - .Include(a=>a.Circle).SingleOrDefaultAsync(m => m.CircleId == circleId && m.FullPath == fullPath); - if (circleAuthorizationToFile == null) - { - return HttpNotFound(); - } - if (circleAuthorizationToFile.Circle.OwnerId != uid) return HttpUnauthorized(); - return View(circleAuthorizationToFile); - } - - // POST: MyFSRules/Delete/5 - [HttpPost, ActionName("Delete")] - [ValidateAntiForgeryToken] - public async Task DeleteConfirmed(long circleId, string fullPath) - { - var uid = User.GetUserId(); - CircleAuthorizationToFile circleAuthorizationToFile = - await _context.CircleAuthorizationToFile - .Include(a=> a.Circle) - .SingleOrDefaultAsync(m => m.CircleId == circleId && m.FullPath == fullPath); - if (circleAuthorizationToFile == null) - { - return HttpNotFound(); - } - if (circleAuthorizationToFile.Circle.OwnerId != uid) return HttpUnauthorized(); - _context.CircleAuthorizationToFile.Remove(circleAuthorizationToFile); - await _context.SaveChangesAsync(); - return RedirectToAction("Index"); - } - } -} diff --git a/src/Yavsc/Migrations/20210603172023_no-more-circle-autorisation-to-file.Designer.cs b/src/Yavsc/Migrations/20210603172023_no-more-circle-autorisation-to-file.Designer.cs new file mode 100644 index 00000000..8557de03 --- /dev/null +++ b/src/Yavsc/Migrations/20210603172023_no-more-circle-autorisation-to-file.Designer.cs @@ -0,0 +1,2035 @@ +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("20210603172023_no-more-circle-autorisation-to-file")] + partial class nomorecircleautorisationtofile + { + 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.Abstract.Identity.ClientProviderInfo", b => + { + b.Property("UserId"); + + b.Property("Avatar"); + + b.Property("BillingAddressId"); + + b.Property("EMail"); + + b.Property("Phone"); + + b.Property("UserName"); + + b.HasKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Access.Ban", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("DateCreated"); + + b.Property("DateModified"); + + b.Property("Reason") + .IsRequired(); + + b.Property("TargetId") + .IsRequired(); + + b.Property("UserCreated"); + + b.Property("UserModified"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Access.BlackListed", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("OwnerId") + .IsRequired(); + + b.Property("UserId") + .IsRequired(); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Access.CircleAuthorizationToBlogPost", b => + { + b.Property("CircleId"); + + b.Property("BlogPostId"); + + b.HasKey("CircleId", "BlogPostId"); + }); + + modelBuilder.Entity("Yavsc.Models.AccountBalance", b => + { + b.Property("UserId"); + + b.Property("ContactCredits"); + + b.Property("Credits"); + + b.HasKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.ApplicationUser", b => + { + b.Property("Id"); + + b.Property("AccessFailedCount"); + + b.Property("AllowMonthlyEmail"); + + b.Property("Avatar") + .HasAnnotation("MaxLength", 512) + .HasAnnotation("Relational:DefaultValue", "/images/Users/icon_user.png") + .HasAnnotation("Relational:DefaultValueType", "System.String"); + + b.Property("BankInfoId"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken(); + + b.Property("DateCreated"); + + b.Property("DateModified"); + + b.Property("DedicatedGoogleCalendar") + .HasAnnotation("MaxLength", 512); + + b.Property("DiskQuota") + .HasAnnotation("Relational:DefaultValue", "524288000") + .HasAnnotation("Relational:DefaultValueType", "System.Int64"); + + b.Property("DiskUsage"); + + b.Property("Email") + .HasAnnotation("MaxLength", 256); + + b.Property("EmailConfirmed"); + + b.Property("FullName") + .HasAnnotation("MaxLength", 512); + + b.Property("LockoutEnabled"); + + b.Property("LockoutEnd"); + + b.Property("MaxFileSize"); + + 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("UserCreated"); + + b.Property("UserModified"); + + 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.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.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.Bank.BankIdentity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AccountNumber"); + + b.Property("BIC"); + + b.Property("BankCode"); + + b.Property("BankedKey"); + + b.Property("IBAN"); + + b.Property("WicketCode"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Billing.CommandLine", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Count"); + + b.Property("Currency"); + + b.Property("Description") + .IsRequired() + .HasAnnotation("MaxLength", 512); + + b.Property("EstimateId"); + + b.Property("EstimateTemplateId"); + + b.Property("Name") + .IsRequired() + .HasAnnotation("MaxLength", 256); + + 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("ClientValidationDate"); + + b.Property("CommandId"); + + b.Property("CommandType") + .IsRequired(); + + b.Property("Description"); + + b.Property("OwnerId"); + + b.Property("ProviderValidationDate"); + + 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.BlogPost", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AuthorId"); + + b.Property("Content"); + + b.Property("DateCreated"); + + b.Property("DateModified"); + + b.Property("Lang"); + + b.Property("Photo"); + + b.Property("Rate"); + + b.Property("Title"); + + b.Property("UserCreated"); + + b.Property("UserModified"); + + b.Property("Visible"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Blog.BlogTag", b => + { + b.Property("PostId"); + + b.Property("TagId"); + + b.HasKey("PostId", "TagId"); + }); + + modelBuilder.Entity("Yavsc.Models.Blog.Comment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AuthorId") + .IsRequired(); + + b.Property("Content"); + + b.Property("DateCreated"); + + b.Property("DateModified"); + + b.Property("ParentId"); + + b.Property("PostId"); + + b.Property("UserCreated"); + + b.Property("UserModified"); + + b.Property("Visible"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Calendar.Period", b => + { + b.Property("Start"); + + b.Property("End"); + + b.HasKey("Start", "End"); + }); + + modelBuilder.Entity("Yavsc.Models.Calendar.Schedule", b => + { + b.Property("OwnerId"); + + b.HasKey("OwnerId"); + }); + + modelBuilder.Entity("Yavsc.Models.Calendar.ScheduledEvent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("PeriodEnd"); + + b.Property("PeriodStart"); + + b.Property("Reccurence"); + + b.Property("ScheduleOwnerId"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Chat.ChatConnection", b => + { + b.Property("ConnectionId"); + + b.Property("ApplicationUserId") + .IsRequired(); + + b.Property("Connected"); + + b.Property("UserAgent"); + + b.HasKey("ConnectionId"); + }); + + modelBuilder.Entity("Yavsc.Models.Chat.ChatRoom", b => + { + b.Property("Name"); + + b.Property("DateCreated"); + + b.Property("DateModified"); + + b.Property("LatestJoinPart"); + + b.Property("OwnerId"); + + b.Property("Topic"); + + b.Property("UserCreated"); + + b.Property("UserModified"); + + b.HasKey("Name"); + }); + + modelBuilder.Entity("Yavsc.Models.Chat.ChatRoomAccess", b => + { + b.Property("ChannelName"); + + b.Property("UserId"); + + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Level"); + + b.HasKey("ChannelName", "UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Cratie.Option", b => + { + b.Property("Code"); + + b.Property("CodeScrutin"); + + b.Property("DateCreated"); + + b.Property("DateModified"); + + b.Property("Description"); + + b.Property("UserCreated"); + + b.Property("UserModified"); + + b.HasKey("Code", "CodeScrutin"); + }); + + modelBuilder.Entity("Yavsc.Models.Drawing.Color", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Blue"); + + b.Property("Green"); + + b.Property("Name"); + + b.Property("Red"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Forms.Form", b => + { + b.Property("Id"); + + b.Property("Summary"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.BrusherProfile", b => + { + b.Property("UserId"); + + b.Property("ActionDistance"); + + b.Property("CarePrice"); + + b.Property("FlatFeeDiscount"); + + b.Property("HalfBalayagePrice"); + + b.Property("HalfBrushingPrice"); + + b.Property("HalfColorPrice"); + + b.Property("HalfDefrisPrice"); + + b.Property("HalfFoldingPrice"); + + b.Property("HalfMechPrice"); + + b.Property("HalfMultiColorPrice"); + + b.Property("HalfPermanentPrice"); + + b.Property("KidCutPrice"); + + b.Property("LongBalayagePrice"); + + b.Property("LongBrushingPrice"); + + b.Property("LongColorPrice"); + + b.Property("LongDefrisPrice"); + + b.Property("LongFoldingPrice"); + + b.Property("LongMechPrice"); + + b.Property("LongMultiColorPrice"); + + b.Property("LongPermanentPrice"); + + b.Property("ManBrushPrice"); + + b.Property("ManCutPrice"); + + b.Property("ScheduleOwnerId"); + + b.Property("ShampooPrice"); + + b.Property("ShortBalayagePrice"); + + b.Property("ShortBrushingPrice"); + + b.Property("ShortColorPrice"); + + b.Property("ShortDefrisPrice"); + + b.Property("ShortFoldingPrice"); + + b.Property("ShortMechPrice"); + + b.Property("ShortMultiColorPrice"); + + b.Property("ShortPermanentPrice"); + + b.Property("WomenHalfCutPrice"); + + b.Property("WomenLongCutPrice"); + + b.Property("WomenShortCutPrice"); + + b.HasKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairCutQuery", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ActivityCode") + .IsRequired(); + + b.Property("AdditionalInfo"); + + b.Property("ClientId") + .IsRequired(); + + b.Property("Consent"); + + b.Property("DateCreated"); + + b.Property("DateModified"); + + b.Property("Description"); + + b.Property("EventDate"); + + b.Property("LocationId"); + + b.Property("PaymentId"); + + b.Property("PerformerId") + .IsRequired(); + + b.Property("PrestationId"); + + b.Property("Previsional"); + + b.Property("Rejected"); + + b.Property("RejectedAt"); + + b.Property("SelectedProfileUserId"); + + b.Property("Status"); + + b.Property("UserCreated"); + + b.Property("UserModified"); + + b.Property("ValidationDate"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairMultiCutQuery", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ActivityCode") + .IsRequired(); + + b.Property("ClientId") + .IsRequired(); + + b.Property("Consent"); + + b.Property("DateCreated"); + + b.Property("DateModified"); + + b.Property("Description"); + + b.Property("EventDate"); + + b.Property("LocationId"); + + b.Property("PaymentId"); + + b.Property("PerformerId") + .IsRequired(); + + b.Property("Previsional"); + + b.Property("Rejected"); + + b.Property("RejectedAt"); + + b.Property("Status"); + + b.Property("UserCreated"); + + b.Property("UserModified"); + + b.Property("ValidationDate"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairPrestation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Cares"); + + b.Property("Cut"); + + b.Property("Dressing"); + + b.Property("Gender"); + + b.Property("Length"); + + b.Property("Shampoo"); + + b.Property("Tech"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairPrestationCollectionItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("PrestationId"); + + b.Property("QueryId"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairTaint", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Brand"); + + b.Property("ColorId"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairTaintInstance", b => + { + b.Property("TaintId"); + + b.Property("PrestationId"); + + b.HasKey("TaintId", "PrestationId"); + }); + + modelBuilder.Entity("Yavsc.Models.Identity.DeviceDeclaration", b => + { + b.Property("DeviceId"); + + b.Property("DeclarationDate") + .ValueGeneratedOnAdd() + .HasAnnotation("Relational:GeneratedValueSql", "LOCALTIMESTAMP"); + + b.Property("DeviceOwnerId"); + + b.Property("LatestActivityUpdate"); + + b.Property("Model"); + + b.Property("Platform"); + + b.Property("Version"); + + b.HasKey("DeviceId"); + }); + + modelBuilder.Entity("Yavsc.Models.IT.Evolution.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Description"); + + b.Property("ShortName"); + + b.Property("Status"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.IT.Fixing.Bug", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Description"); + + b.Property("FeatureId"); + + b.Property("Status"); + + b.Property("Title"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Market.Product", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Depth"); + + b.Property("Description"); + + b.Property("Height"); + + b.Property("Name"); + + b.Property("Price"); + + b.Property("Public"); + + b.Property("Weight"); + + b.Property("Width"); + + b.HasKey("Id"); + }); + + 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.Messaging.Announce", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("For"); + + b.Property("Message"); + + b.Property("OwnerId"); + + b.Property("Sender"); + + b.Property("Topic"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Messaging.DimissClicked", b => + { + b.Property("UserId"); + + b.Property("NotificationId"); + + b.HasKey("UserId", "NotificationId"); + }); + + modelBuilder.Entity("Yavsc.Models.Messaging.Notification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Target"); + + b.Property("body") + .IsRequired(); + + b.Property("click_action") + .IsRequired(); + + b.Property("color"); + + b.Property("icon") + .HasAnnotation("Relational:DefaultValue", "exclam") + .HasAnnotation("Relational:DefaultValueType", "System.String"); + + b.Property("sound"); + + b.Property("tag"); + + b.Property("title") + .IsRequired(); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Musical.Instrument", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name") + .HasAnnotation("MaxLength", 255); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Musical.InstrumentRating", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("InstrumentId"); + + b.Property("OwnerId"); + + b.Property("Rate"); + + b.HasKey("Id"); + + b.HasAlternateKey("InstrumentId", "OwnerId"); + }); + + modelBuilder.Entity("Yavsc.Models.Musical.MusicalPreference", b => + { + b.Property("OwnerProfileId"); + + b.Property("DjSettingsUserId"); + + b.Property("GeneralSettingsUserId"); + + b.Property("Rate"); + + b.Property("TendencyId"); + + b.HasKey("OwnerProfileId"); + }); + + modelBuilder.Entity("Yavsc.Models.Musical.MusicalTendency", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name") + .HasAnnotation("MaxLength", 255); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Musical.Profiles.DjSettings", b => + { + b.Property("UserId"); + + b.Property("SoundCloudId"); + + b.HasKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Musical.Profiles.GeneralSettings", b => + { + b.Property("UserId"); + + b.HasKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Musical.Profiles.Instrumentation", b => + { + b.Property("InstrumentId"); + + b.Property("UserId"); + + b.HasKey("InstrumentId", "UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Payment.PayPalPayment", b => + { + b.Property("CreationToken"); + + b.Property("DateCreated"); + + b.Property("DateModified"); + + b.Property("ExecutorId"); + + b.Property("OrderReference"); + + b.Property("PaypalPayerId"); + + b.Property("State"); + + b.Property("UserCreated"); + + b.Property("UserModified"); + + b.HasKey("CreationToken"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.Circle", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ApplicationUserId"); + + b.Property("Name"); + + b.Property("OwnerId"); + + b.Property("Public"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.CircleMember", b => + { + b.Property("MemberId"); + + b.Property("CircleId"); + + b.HasKey("MemberId", "CircleId"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.Contact", b => + { + b.Property("OwnerId"); + + b.Property("UserId"); + + b.Property("AddressId"); + + b.Property("ApplicationUserId"); + + b.Property("EMail"); + + b.Property("Name"); + + b.HasKey("OwnerId", "UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.HyperLink", b => + { + b.Property("HRef"); + + b.Property("Method"); + + b.Property("BrusherProfileUserId"); + + b.Property("ContentType"); + + b.Property("PayPalPaymentCreationToken"); + + b.Property("Rel"); + + b.HasKey("HRef", "Method"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.Location", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Address") + .HasAnnotation("MaxLength", 512); + + b.Property("Latitude"); + + b.Property("Longitude"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.PostalAddress", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("City"); + + b.Property("Country"); + + b.Property("PostalCode"); + + b.Property("Province"); + + b.Property("State"); + + b.Property("Street1"); + + b.Property("Street2"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Skill", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name"); + + b.Property("Rate"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Streaming.LiveFlow", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("DifferedFileName"); + + b.Property("MediaType"); + + b.Property("OwnerId"); + + b.Property("Pitch"); + + b.Property("SequenceNumber"); + + b.Property("Title"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.Activity", b => + { + b.Property("Code"); + + b.Property("DateCreated"); + + b.Property("DateModified"); + + b.Property("Description"); + + b.Property("Hidden"); + + b.Property("ModeratorGroupName"); + + b.Property("Name"); + + b.Property("ParentCode"); + + b.Property("Photo"); + + b.Property("Rate"); + + b.Property("SettingsClassName"); + + b.Property("UserCreated"); + + b.Property("UserModified"); + + b.HasKey("Code"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.CommandForm", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ActionName"); + + b.Property("ActivityCode"); + + b.Property("Title"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.CoWorking", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("FormationSettingsUserId"); + + b.Property("PerformerId"); + + b.Property("WorkingForId"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b => + { + b.Property("PerformerId"); + + b.Property("AcceptNotifications"); + + b.Property("AcceptPublicContact"); + + b.Property("Active"); + + b.Property("MaxDailyCost"); + + b.Property("MinDailyCost"); + + b.Property("OrganizationAddressId"); + + b.Property("Rate"); + + b.Property("SIREN"); + + b.Property("UseGeoLocalizationToReduceDistanceWithClients"); + + b.Property("WebSite"); + + b.HasKey("PerformerId"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.Profiles.FormationSettings", b => + { + b.Property("UserId"); + + b.Property("DisplayName"); + + b.HasKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.RdvQuery", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ActivityCode") + .IsRequired(); + + b.Property("ClientId") + .IsRequired(); + + b.Property("Consent"); + + b.Property("DateCreated"); + + b.Property("DateModified"); + + b.Property("Description"); + + b.Property("EventDate"); + + b.Property("LocationId"); + + b.Property("LocationType"); + + b.Property("PaymentId"); + + b.Property("PerformerId") + .IsRequired(); + + b.Property("Previsional"); + + b.Property("Reason"); + + b.Property("Rejected"); + + b.Property("RejectedAt"); + + b.Property("Status"); + + b.Property("UserCreated"); + + b.Property("UserModified"); + + b.Property("ValidationDate"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.UserActivity", b => + { + b.Property("DoesCode"); + + b.Property("UserId"); + + b.Property("Weight"); + + b.HasKey("DoesCode", "UserId"); + }); + + modelBuilder.Entity("Yavsc.Server.Models.Blog.BlogTrad", b => + { + b.Property("PostId"); + + b.Property("Lang"); + + b.Property("Body"); + + b.Property("Title"); + + b.Property("TraducerId"); + + b.HasKey("PostId", "Lang"); + }); + + modelBuilder.Entity("Yavsc.Server.Models.EMailing.MailingTemplate", b => + { + b.Property("Id"); + + b.Property("Body") + .HasAnnotation("MaxLength", 65536); + + b.Property("DateCreated"); + + b.Property("DateModified"); + + b.Property("ReplyToAddress"); + + b.Property("ToSend"); + + b.Property("Topic"); + + b.Property("UserCreated"); + + b.Property("UserModified"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Server.Models.IT.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ActivityCode") + .IsRequired(); + + b.Property("ClientId") + .IsRequired(); + + b.Property("Consent"); + + b.Property("DateCreated"); + + b.Property("DateModified"); + + b.Property("Description"); + + b.Property("GitId"); + + b.Property("Name"); + + b.Property("OwnerId"); + + b.Property("PaymentId"); + + b.Property("PerformerId") + .IsRequired(); + + b.Property("Previsional"); + + b.Property("Rejected"); + + b.Property("RejectedAt"); + + b.Property("Status"); + + b.Property("UserCreated"); + + b.Property("UserModified"); + + b.Property("ValidationDate"); + + b.Property("Version"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Server.Models.IT.ProjectBuildConfiguration", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name"); + + b.Property("ProjectId"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Server.Models.IT.SourceCode.GitRepositoryReference", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Branch"); + + b.Property("OwnerId"); + + b.Property("Path"); + + b.Property("Url"); + + b.HasKey("Id"); + }); + + 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.Access.Ban", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("TargetId"); + }); + + modelBuilder.Entity("Yavsc.Models.Access.BlackListed", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("OwnerId"); + + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Access.CircleAuthorizationToBlogPost", b => + { + b.HasOne("Yavsc.Models.Blog.BlogPost") + .WithMany() + .HasForeignKey("BlogPostId"); + + b.HasOne("Yavsc.Models.Relationship.Circle") + .WithMany() + .HasForeignKey("CircleId"); + }); + + 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.Models.Bank.BankIdentity") + .WithMany() + .HasForeignKey("BankInfoId"); + + b.HasOne("Yavsc.Models.Relationship.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.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.ApplicationUser") + .WithMany() + .HasForeignKey("ClientId"); + + b.HasOne("Yavsc.Models.Workflow.RdvQuery") + .WithMany() + .HasForeignKey("CommandId"); + + b.HasOne("Yavsc.Models.Workflow.PerformerProfile") + .WithMany() + .HasForeignKey("OwnerId"); + }); + + modelBuilder.Entity("Yavsc.Models.Blog.BlogPost", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("AuthorId"); + }); + + modelBuilder.Entity("Yavsc.Models.Blog.BlogTag", b => + { + b.HasOne("Yavsc.Models.Blog.BlogPost") + .WithMany() + .HasForeignKey("PostId"); + + b.HasOne("Yavsc.Models.Relationship.Tag") + .WithMany() + .HasForeignKey("TagId"); + }); + + modelBuilder.Entity("Yavsc.Models.Blog.Comment", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("AuthorId"); + + b.HasOne("Yavsc.Models.Blog.Comment") + .WithMany() + .HasForeignKey("ParentId"); + + b.HasOne("Yavsc.Models.Blog.BlogPost") + .WithMany() + .HasForeignKey("PostId"); + }); + + modelBuilder.Entity("Yavsc.Models.Calendar.Schedule", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("OwnerId"); + }); + + modelBuilder.Entity("Yavsc.Models.Calendar.ScheduledEvent", b => + { + b.HasOne("Yavsc.Models.Calendar.Schedule") + .WithMany() + .HasForeignKey("ScheduleOwnerId"); + + b.HasOne("Yavsc.Models.Calendar.Period") + .WithMany() + .HasForeignKey("PeriodStart", "PeriodEnd"); + }); + + modelBuilder.Entity("Yavsc.Models.Chat.ChatConnection", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Chat.ChatRoom", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("OwnerId"); + }); + + modelBuilder.Entity("Yavsc.Models.Chat.ChatRoomAccess", b => + { + b.HasOne("Yavsc.Models.Chat.ChatRoom") + .WithMany() + .HasForeignKey("ChannelName"); + + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.BrusherProfile", b => + { + b.HasOne("Yavsc.Models.Calendar.Schedule") + .WithMany() + .HasForeignKey("ScheduleOwnerId"); + + b.HasOne("Yavsc.Models.Workflow.PerformerProfile") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairCutQuery", b => + { + b.HasOne("Yavsc.Models.Workflow.Activity") + .WithMany() + .HasForeignKey("ActivityCode"); + + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("ClientId"); + + b.HasOne("Yavsc.Models.Relationship.Location") + .WithMany() + .HasForeignKey("LocationId"); + + b.HasOne("Yavsc.Models.Payment.PayPalPayment") + .WithMany() + .HasForeignKey("PaymentId"); + + b.HasOne("Yavsc.Models.Workflow.PerformerProfile") + .WithMany() + .HasForeignKey("PerformerId"); + + b.HasOne("Yavsc.Models.Haircut.HairPrestation") + .WithMany() + .HasForeignKey("PrestationId"); + + b.HasOne("Yavsc.Models.Haircut.BrusherProfile") + .WithMany() + .HasForeignKey("SelectedProfileUserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairMultiCutQuery", b => + { + b.HasOne("Yavsc.Models.Workflow.Activity") + .WithMany() + .HasForeignKey("ActivityCode"); + + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("ClientId"); + + b.HasOne("Yavsc.Models.Relationship.Location") + .WithMany() + .HasForeignKey("LocationId"); + + b.HasOne("Yavsc.Models.Payment.PayPalPayment") + .WithMany() + .HasForeignKey("PaymentId"); + + b.HasOne("Yavsc.Models.Workflow.PerformerProfile") + .WithMany() + .HasForeignKey("PerformerId"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairPrestationCollectionItem", b => + { + b.HasOne("Yavsc.Models.Haircut.HairPrestation") + .WithMany() + .HasForeignKey("PrestationId"); + + b.HasOne("Yavsc.Models.Haircut.HairMultiCutQuery") + .WithMany() + .HasForeignKey("QueryId"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairTaint", b => + { + b.HasOne("Yavsc.Models.Drawing.Color") + .WithMany() + .HasForeignKey("ColorId"); + }); + + modelBuilder.Entity("Yavsc.Models.Haircut.HairTaintInstance", b => + { + b.HasOne("Yavsc.Models.Haircut.HairPrestation") + .WithMany() + .HasForeignKey("PrestationId"); + + b.HasOne("Yavsc.Models.Haircut.HairTaint") + .WithMany() + .HasForeignKey("TaintId"); + }); + + modelBuilder.Entity("Yavsc.Models.Identity.DeviceDeclaration", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("DeviceOwnerId"); + }); + + modelBuilder.Entity("Yavsc.Models.IT.Fixing.Bug", b => + { + b.HasOne("Yavsc.Models.IT.Evolution.Feature") + .WithMany() + .HasForeignKey("FeatureId"); + }); + + modelBuilder.Entity("Yavsc.Models.Market.Service", b => + { + b.HasOne("Yavsc.Models.Workflow.Activity") + .WithMany() + .HasForeignKey("ContextId"); + }); + + modelBuilder.Entity("Yavsc.Models.Messaging.Announce", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("OwnerId"); + }); + + modelBuilder.Entity("Yavsc.Models.Messaging.DimissClicked", b => + { + b.HasOne("Yavsc.Models.Messaging.Notification") + .WithMany() + .HasForeignKey("NotificationId"); + + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Musical.InstrumentRating", b => + { + b.HasOne("Yavsc.Models.Musical.Instrument") + .WithMany() + .HasForeignKey("InstrumentId"); + + b.HasOne("Yavsc.Models.Workflow.PerformerProfile") + .WithMany() + .HasForeignKey("OwnerId"); + }); + + modelBuilder.Entity("Yavsc.Models.Musical.MusicalPreference", b => + { + b.HasOne("Yavsc.Models.Musical.Profiles.DjSettings") + .WithMany() + .HasForeignKey("DjSettingsUserId"); + + b.HasOne("Yavsc.Models.Musical.Profiles.GeneralSettings") + .WithMany() + .HasForeignKey("GeneralSettingsUserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Musical.Profiles.Instrumentation", b => + { + b.HasOne("Yavsc.Models.Musical.Instrument") + .WithMany() + .HasForeignKey("InstrumentId"); + + b.HasOne("Yavsc.Models.Workflow.PerformerProfile") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Payment.PayPalPayment", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("ExecutorId"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.Circle", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.CircleMember", b => + { + b.HasOne("Yavsc.Models.Relationship.Circle") + .WithMany() + .HasForeignKey("CircleId"); + + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("MemberId"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.Contact", b => + { + b.HasOne("Yavsc.Models.Relationship.PostalAddress") + .WithMany() + .HasForeignKey("AddressId"); + + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId"); + }); + + modelBuilder.Entity("Yavsc.Models.Relationship.HyperLink", b => + { + b.HasOne("Yavsc.Models.Haircut.BrusherProfile") + .WithMany() + .HasForeignKey("BrusherProfileUserId"); + + b.HasOne("Yavsc.Models.Payment.PayPalPayment") + .WithMany() + .HasForeignKey("PayPalPaymentCreationToken"); + }); + + modelBuilder.Entity("Yavsc.Models.Streaming.LiveFlow", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("OwnerId"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.Activity", b => + { + b.HasOne("Yavsc.Models.Workflow.Activity") + .WithMany() + .HasForeignKey("ParentCode"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.CommandForm", b => + { + b.HasOne("Yavsc.Models.Workflow.Activity") + .WithMany() + .HasForeignKey("ActivityCode"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.CoWorking", b => + { + b.HasOne("Yavsc.Models.Workflow.Profiles.FormationSettings") + .WithMany() + .HasForeignKey("FormationSettingsUserId"); + + b.HasOne("Yavsc.Models.Workflow.PerformerProfile") + .WithMany() + .HasForeignKey("PerformerId"); + + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("WorkingForId"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.PerformerProfile", b => + { + b.HasOne("Yavsc.Models.Relationship.Location") + .WithMany() + .HasForeignKey("OrganizationAddressId"); + + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("PerformerId"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.RdvQuery", b => + { + b.HasOne("Yavsc.Models.Workflow.Activity") + .WithMany() + .HasForeignKey("ActivityCode"); + + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("ClientId"); + + b.HasOne("Yavsc.Models.Relationship.Location") + .WithMany() + .HasForeignKey("LocationId"); + + b.HasOne("Yavsc.Models.Payment.PayPalPayment") + .WithMany() + .HasForeignKey("PaymentId"); + + b.HasOne("Yavsc.Models.Workflow.PerformerProfile") + .WithMany() + .HasForeignKey("PerformerId"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.UserActivity", b => + { + b.HasOne("Yavsc.Models.Workflow.Activity") + .WithMany() + .HasForeignKey("DoesCode"); + + b.HasOne("Yavsc.Models.Workflow.PerformerProfile") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Yavsc.Server.Models.Blog.BlogTrad", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("TraducerId"); + }); + + modelBuilder.Entity("Yavsc.Server.Models.IT.Project", b => + { + b.HasOne("Yavsc.Models.Workflow.Activity") + .WithMany() + .HasForeignKey("ActivityCode"); + + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("ClientId"); + + b.HasOne("Yavsc.Server.Models.IT.SourceCode.GitRepositoryReference") + .WithMany() + .HasForeignKey("GitId"); + + b.HasOne("Yavsc.Models.Payment.PayPalPayment") + .WithMany() + .HasForeignKey("PaymentId"); + + b.HasOne("Yavsc.Models.Workflow.PerformerProfile") + .WithMany() + .HasForeignKey("PerformerId"); + }); + + modelBuilder.Entity("Yavsc.Server.Models.IT.ProjectBuildConfiguration", b => + { + b.HasOne("Yavsc.Server.Models.IT.Project") + .WithMany() + .HasForeignKey("ProjectId"); + }); + + modelBuilder.Entity("Yavsc.Server.Models.IT.SourceCode.GitRepositoryReference", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("OwnerId"); + }); + } + } +} diff --git a/src/Yavsc/Migrations/20210603172023_no-more-circle-autorisation-to-file.cs b/src/Yavsc/Migrations/20210603172023_no-more-circle-autorisation-to-file.cs new file mode 100644 index 00000000..450e09b1 --- /dev/null +++ b/src/Yavsc/Migrations/20210603172023_no-more-circle-autorisation-to-file.cs @@ -0,0 +1,819 @@ +using System; +using System.Collections.Generic; +using Microsoft.Data.Entity.Migrations; + +namespace Yavsc.Migrations +{ + public partial class nomorecircleautorisationtofile : 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_Ban_ApplicationUser_TargetId", table: "Ban"); + migrationBuilder.DropForeignKey(name: "FK_BlackListed_ApplicationUser_OwnerId", table: "BlackListed"); + migrationBuilder.DropForeignKey(name: "FK_BlackListed_ApplicationUser_UserId", table: "BlackListed"); + migrationBuilder.DropForeignKey(name: "FK_CircleAuthorizationToBlogPost_BlogPost_BlogPostId", table: "CircleAuthorizationToBlogPost"); + migrationBuilder.DropForeignKey(name: "FK_CircleAuthorizationToBlogPost_Circle_CircleId", table: "CircleAuthorizationToBlogPost"); + migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance"); + migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact"); + migrationBuilder.DropForeignKey(name: "FK_CommandLine_Estimate_EstimateId", table: "CommandLine"); + migrationBuilder.DropForeignKey(name: "FK_Estimate_ApplicationUser_ClientId", table: "Estimate"); + migrationBuilder.DropForeignKey(name: "FK_BlogTag_BlogPost_PostId", table: "BlogTag"); + migrationBuilder.DropForeignKey(name: "FK_BlogTag_Tag_TagId", table: "BlogTag"); + migrationBuilder.DropForeignKey(name: "FK_Comment_ApplicationUser_AuthorId", table: "Comment"); + migrationBuilder.DropForeignKey(name: "FK_Comment_BlogPost_PostId", table: "Comment"); + migrationBuilder.DropForeignKey(name: "FK_Schedule_ApplicationUser_OwnerId", table: "Schedule"); + migrationBuilder.DropForeignKey(name: "FK_ChatConnection_ApplicationUser_ApplicationUserId", table: "ChatConnection"); + migrationBuilder.DropForeignKey(name: "FK_ChatRoomAccess_ApplicationUser_UserId", table: "ChatRoomAccess"); + migrationBuilder.DropForeignKey(name: "FK_BrusherProfile_PerformerProfile_UserId", table: "BrusherProfile"); + migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_Activity_ActivityCode", table: "HairCutQuery"); + migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_ApplicationUser_ClientId", table: "HairCutQuery"); + migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_PerformerProfile_PerformerId", table: "HairCutQuery"); + migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_HairPrestation_PrestationId", table: "HairCutQuery"); + migrationBuilder.DropForeignKey(name: "FK_HairMultiCutQuery_Activity_ActivityCode", table: "HairMultiCutQuery"); + migrationBuilder.DropForeignKey(name: "FK_HairMultiCutQuery_ApplicationUser_ClientId", table: "HairMultiCutQuery"); + migrationBuilder.DropForeignKey(name: "FK_HairMultiCutQuery_PerformerProfile_PerformerId", table: "HairMultiCutQuery"); + migrationBuilder.DropForeignKey(name: "FK_HairPrestationCollectionItem_HairPrestation_PrestationId", table: "HairPrestationCollectionItem"); + migrationBuilder.DropForeignKey(name: "FK_HairPrestationCollectionItem_HairMultiCutQuery_QueryId", table: "HairPrestationCollectionItem"); + migrationBuilder.DropForeignKey(name: "FK_HairTaint_Color_ColorId", table: "HairTaint"); + migrationBuilder.DropForeignKey(name: "FK_HairTaintInstance_HairPrestation_PrestationId", table: "HairTaintInstance"); + migrationBuilder.DropForeignKey(name: "FK_HairTaintInstance_HairTaint_TaintId", table: "HairTaintInstance"); + migrationBuilder.DropForeignKey(name: "FK_DimissClicked_Notification_NotificationId", table: "DimissClicked"); + migrationBuilder.DropForeignKey(name: "FK_InstrumentRating_Instrument_InstrumentId", table: "InstrumentRating"); + migrationBuilder.DropForeignKey(name: "FK_Instrumentation_Instrument_InstrumentId", table: "Instrumentation"); + migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember"); + migrationBuilder.DropForeignKey(name: "FK_Contact_PostalAddress_AddressId", table: "Contact"); + migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganizationAddressId", table: "PerformerProfile"); + migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerformerId", table: "PerformerProfile"); + migrationBuilder.DropForeignKey(name: "FK_RdvQuery_Activity_ActivityCode", table: "RdvQuery"); + migrationBuilder.DropForeignKey(name: "FK_RdvQuery_ApplicationUser_ClientId", table: "RdvQuery"); + migrationBuilder.DropForeignKey(name: "FK_RdvQuery_PerformerProfile_PerformerId", table: "RdvQuery"); + migrationBuilder.DropForeignKey(name: "FK_Project_Activity_ActivityCode", table: "Project"); + migrationBuilder.DropForeignKey(name: "FK_Project_ApplicationUser_ClientId", table: "Project"); + migrationBuilder.DropForeignKey(name: "FK_Project_GitRepositoryReference_GitId", table: "Project"); + migrationBuilder.DropForeignKey(name: "FK_Project_PerformerProfile_PerformerId", table: "Project"); + migrationBuilder.DropForeignKey(name: "FK_ProjectBuildConfiguration_Project_ProjectId", table: "ProjectBuildConfiguration"); + migrationBuilder.DropTable("CircleAuthorizationToFile"); + 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_Ban_ApplicationUser_TargetId", + table: "Ban", + column: "TargetId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_BlackListed_ApplicationUser_OwnerId", + table: "BlackListed", + column: "OwnerId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_BlackListed_ApplicationUser_UserId", + table: "BlackListed", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_CircleAuthorizationToBlogPost_BlogPost_BlogPostId", + table: "CircleAuthorizationToBlogPost", + column: "BlogPostId", + principalTable: "BlogPost", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_CircleAuthorizationToBlogPost_Circle_CircleId", + table: "CircleAuthorizationToBlogPost", + column: "CircleId", + principalTable: "Circle", + 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_Estimate_EstimateId", + table: "CommandLine", + column: "EstimateId", + principalTable: "Estimate", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_Estimate_ApplicationUser_ClientId", + table: "Estimate", + column: "ClientId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_BlogTag_BlogPost_PostId", + table: "BlogTag", + column: "PostId", + principalTable: "BlogPost", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_BlogTag_Tag_TagId", + table: "BlogTag", + column: "TagId", + principalTable: "Tag", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_Comment_ApplicationUser_AuthorId", + table: "Comment", + column: "AuthorId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_Comment_BlogPost_PostId", + table: "Comment", + column: "PostId", + principalTable: "BlogPost", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_Schedule_ApplicationUser_OwnerId", + table: "Schedule", + column: "OwnerId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_ChatConnection_ApplicationUser_ApplicationUserId", + table: "ChatConnection", + column: "ApplicationUserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_ChatRoomAccess_ApplicationUser_UserId", + table: "ChatRoomAccess", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_BrusherProfile_PerformerProfile_UserId", + table: "BrusherProfile", + column: "UserId", + principalTable: "PerformerProfile", + principalColumn: "PerformerId", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_HairCutQuery_Activity_ActivityCode", + table: "HairCutQuery", + column: "ActivityCode", + principalTable: "Activity", + principalColumn: "Code", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_HairCutQuery_ApplicationUser_ClientId", + table: "HairCutQuery", + column: "ClientId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_HairCutQuery_PerformerProfile_PerformerId", + table: "HairCutQuery", + column: "PerformerId", + principalTable: "PerformerProfile", + principalColumn: "PerformerId", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_HairCutQuery_HairPrestation_PrestationId", + table: "HairCutQuery", + column: "PrestationId", + principalTable: "HairPrestation", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_HairMultiCutQuery_Activity_ActivityCode", + table: "HairMultiCutQuery", + column: "ActivityCode", + principalTable: "Activity", + principalColumn: "Code", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_HairMultiCutQuery_ApplicationUser_ClientId", + table: "HairMultiCutQuery", + column: "ClientId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_HairMultiCutQuery_PerformerProfile_PerformerId", + table: "HairMultiCutQuery", + column: "PerformerId", + principalTable: "PerformerProfile", + principalColumn: "PerformerId", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_HairPrestationCollectionItem_HairPrestation_PrestationId", + table: "HairPrestationCollectionItem", + column: "PrestationId", + principalTable: "HairPrestation", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_HairPrestationCollectionItem_HairMultiCutQuery_QueryId", + table: "HairPrestationCollectionItem", + column: "QueryId", + principalTable: "HairMultiCutQuery", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_HairTaint_Color_ColorId", + table: "HairTaint", + column: "ColorId", + principalTable: "Color", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_HairTaintInstance_HairPrestation_PrestationId", + table: "HairTaintInstance", + column: "PrestationId", + principalTable: "HairPrestation", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_HairTaintInstance_HairTaint_TaintId", + table: "HairTaintInstance", + column: "TaintId", + principalTable: "HairTaint", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_DimissClicked_Notification_NotificationId", + table: "DimissClicked", + column: "NotificationId", + principalTable: "Notification", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_InstrumentRating_Instrument_InstrumentId", + table: "InstrumentRating", + column: "InstrumentId", + principalTable: "Instrument", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_Instrumentation_Instrument_InstrumentId", + table: "Instrumentation", + column: "InstrumentId", + principalTable: "Instrument", + principalColumn: "Id", + 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_Contact_PostalAddress_AddressId", + table: "Contact", + column: "AddressId", + principalTable: "PostalAddress", + principalColumn: "Id", + 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); + migrationBuilder.AddForeignKey( + name: "FK_RdvQuery_Activity_ActivityCode", + table: "RdvQuery", + column: "ActivityCode", + principalTable: "Activity", + principalColumn: "Code", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_RdvQuery_ApplicationUser_ClientId", + table: "RdvQuery", + column: "ClientId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_RdvQuery_PerformerProfile_PerformerId", + table: "RdvQuery", + column: "PerformerId", + principalTable: "PerformerProfile", + principalColumn: "PerformerId", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_Project_Activity_ActivityCode", + table: "Project", + column: "ActivityCode", + principalTable: "Activity", + principalColumn: "Code", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_Project_ApplicationUser_ClientId", + table: "Project", + column: "ClientId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_Project_GitRepositoryReference_GitId", + table: "Project", + column: "GitId", + principalTable: "GitRepositoryReference", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_Project_PerformerProfile_PerformerId", + table: "Project", + column: "PerformerId", + principalTable: "PerformerProfile", + principalColumn: "PerformerId", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_ProjectBuildConfiguration_Project_ProjectId", + table: "ProjectBuildConfiguration", + column: "ProjectId", + principalTable: "Project", + 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_Ban_ApplicationUser_TargetId", table: "Ban"); + migrationBuilder.DropForeignKey(name: "FK_BlackListed_ApplicationUser_OwnerId", table: "BlackListed"); + migrationBuilder.DropForeignKey(name: "FK_BlackListed_ApplicationUser_UserId", table: "BlackListed"); + migrationBuilder.DropForeignKey(name: "FK_CircleAuthorizationToBlogPost_BlogPost_BlogPostId", table: "CircleAuthorizationToBlogPost"); + migrationBuilder.DropForeignKey(name: "FK_CircleAuthorizationToBlogPost_Circle_CircleId", table: "CircleAuthorizationToBlogPost"); + migrationBuilder.DropForeignKey(name: "FK_AccountBalance_ApplicationUser_UserId", table: "AccountBalance"); + migrationBuilder.DropForeignKey(name: "FK_BalanceImpact_AccountBalance_BalanceId", table: "BalanceImpact"); + migrationBuilder.DropForeignKey(name: "FK_CommandLine_Estimate_EstimateId", table: "CommandLine"); + migrationBuilder.DropForeignKey(name: "FK_Estimate_ApplicationUser_ClientId", table: "Estimate"); + migrationBuilder.DropForeignKey(name: "FK_BlogTag_BlogPost_PostId", table: "BlogTag"); + migrationBuilder.DropForeignKey(name: "FK_BlogTag_Tag_TagId", table: "BlogTag"); + migrationBuilder.DropForeignKey(name: "FK_Comment_ApplicationUser_AuthorId", table: "Comment"); + migrationBuilder.DropForeignKey(name: "FK_Comment_BlogPost_PostId", table: "Comment"); + migrationBuilder.DropForeignKey(name: "FK_Schedule_ApplicationUser_OwnerId", table: "Schedule"); + migrationBuilder.DropForeignKey(name: "FK_ChatConnection_ApplicationUser_ApplicationUserId", table: "ChatConnection"); + migrationBuilder.DropForeignKey(name: "FK_ChatRoomAccess_ApplicationUser_UserId", table: "ChatRoomAccess"); + migrationBuilder.DropForeignKey(name: "FK_BrusherProfile_PerformerProfile_UserId", table: "BrusherProfile"); + migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_Activity_ActivityCode", table: "HairCutQuery"); + migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_ApplicationUser_ClientId", table: "HairCutQuery"); + migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_PerformerProfile_PerformerId", table: "HairCutQuery"); + migrationBuilder.DropForeignKey(name: "FK_HairCutQuery_HairPrestation_PrestationId", table: "HairCutQuery"); + migrationBuilder.DropForeignKey(name: "FK_HairMultiCutQuery_Activity_ActivityCode", table: "HairMultiCutQuery"); + migrationBuilder.DropForeignKey(name: "FK_HairMultiCutQuery_ApplicationUser_ClientId", table: "HairMultiCutQuery"); + migrationBuilder.DropForeignKey(name: "FK_HairMultiCutQuery_PerformerProfile_PerformerId", table: "HairMultiCutQuery"); + migrationBuilder.DropForeignKey(name: "FK_HairPrestationCollectionItem_HairPrestation_PrestationId", table: "HairPrestationCollectionItem"); + migrationBuilder.DropForeignKey(name: "FK_HairPrestationCollectionItem_HairMultiCutQuery_QueryId", table: "HairPrestationCollectionItem"); + migrationBuilder.DropForeignKey(name: "FK_HairTaint_Color_ColorId", table: "HairTaint"); + migrationBuilder.DropForeignKey(name: "FK_HairTaintInstance_HairPrestation_PrestationId", table: "HairTaintInstance"); + migrationBuilder.DropForeignKey(name: "FK_HairTaintInstance_HairTaint_TaintId", table: "HairTaintInstance"); + migrationBuilder.DropForeignKey(name: "FK_DimissClicked_Notification_NotificationId", table: "DimissClicked"); + migrationBuilder.DropForeignKey(name: "FK_InstrumentRating_Instrument_InstrumentId", table: "InstrumentRating"); + migrationBuilder.DropForeignKey(name: "FK_Instrumentation_Instrument_InstrumentId", table: "Instrumentation"); + migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember"); + migrationBuilder.DropForeignKey(name: "FK_Contact_PostalAddress_AddressId", table: "Contact"); + migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_Location_OrganizationAddressId", table: "PerformerProfile"); + migrationBuilder.DropForeignKey(name: "FK_PerformerProfile_ApplicationUser_PerformerId", table: "PerformerProfile"); + migrationBuilder.DropForeignKey(name: "FK_RdvQuery_Activity_ActivityCode", table: "RdvQuery"); + migrationBuilder.DropForeignKey(name: "FK_RdvQuery_ApplicationUser_ClientId", table: "RdvQuery"); + migrationBuilder.DropForeignKey(name: "FK_RdvQuery_PerformerProfile_PerformerId", table: "RdvQuery"); + migrationBuilder.DropForeignKey(name: "FK_Project_Activity_ActivityCode", table: "Project"); + migrationBuilder.DropForeignKey(name: "FK_Project_ApplicationUser_ClientId", table: "Project"); + migrationBuilder.DropForeignKey(name: "FK_Project_GitRepositoryReference_GitId", table: "Project"); + migrationBuilder.DropForeignKey(name: "FK_Project_PerformerProfile_PerformerId", table: "Project"); + migrationBuilder.DropForeignKey(name: "FK_ProjectBuildConfiguration_Project_ProjectId", table: "ProjectBuildConfiguration"); + migrationBuilder.CreateTable( + name: "CircleAuthorizationToFile", + columns: table => new + { + CircleId = table.Column(nullable: false), + FullPath = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CircleAuthorizationToFile", x => new { x.CircleId, x.FullPath }); + table.ForeignKey( + name: "FK_CircleAuthorizationToFile_Circle_CircleId", + column: x => x.CircleId, + principalTable: "Circle", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + 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_Ban_ApplicationUser_TargetId", + table: "Ban", + column: "TargetId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_BlackListed_ApplicationUser_OwnerId", + table: "BlackListed", + column: "OwnerId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_BlackListed_ApplicationUser_UserId", + table: "BlackListed", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_CircleAuthorizationToBlogPost_BlogPost_BlogPostId", + table: "CircleAuthorizationToBlogPost", + column: "BlogPostId", + principalTable: "BlogPost", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_CircleAuthorizationToBlogPost_Circle_CircleId", + table: "CircleAuthorizationToBlogPost", + column: "CircleId", + principalTable: "Circle", + 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_Estimate_EstimateId", + table: "CommandLine", + column: "EstimateId", + principalTable: "Estimate", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_Estimate_ApplicationUser_ClientId", + table: "Estimate", + column: "ClientId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_BlogTag_BlogPost_PostId", + table: "BlogTag", + column: "PostId", + principalTable: "BlogPost", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_BlogTag_Tag_TagId", + table: "BlogTag", + column: "TagId", + principalTable: "Tag", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_Comment_ApplicationUser_AuthorId", + table: "Comment", + column: "AuthorId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_Comment_BlogPost_PostId", + table: "Comment", + column: "PostId", + principalTable: "BlogPost", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_Schedule_ApplicationUser_OwnerId", + table: "Schedule", + column: "OwnerId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_ChatConnection_ApplicationUser_ApplicationUserId", + table: "ChatConnection", + column: "ApplicationUserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_ChatRoomAccess_ApplicationUser_UserId", + table: "ChatRoomAccess", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_BrusherProfile_PerformerProfile_UserId", + table: "BrusherProfile", + column: "UserId", + principalTable: "PerformerProfile", + principalColumn: "PerformerId", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_HairCutQuery_Activity_ActivityCode", + table: "HairCutQuery", + column: "ActivityCode", + principalTable: "Activity", + principalColumn: "Code", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_HairCutQuery_ApplicationUser_ClientId", + table: "HairCutQuery", + column: "ClientId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_HairCutQuery_PerformerProfile_PerformerId", + table: "HairCutQuery", + column: "PerformerId", + principalTable: "PerformerProfile", + principalColumn: "PerformerId", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_HairCutQuery_HairPrestation_PrestationId", + table: "HairCutQuery", + column: "PrestationId", + principalTable: "HairPrestation", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_HairMultiCutQuery_Activity_ActivityCode", + table: "HairMultiCutQuery", + column: "ActivityCode", + principalTable: "Activity", + principalColumn: "Code", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_HairMultiCutQuery_ApplicationUser_ClientId", + table: "HairMultiCutQuery", + column: "ClientId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_HairMultiCutQuery_PerformerProfile_PerformerId", + table: "HairMultiCutQuery", + column: "PerformerId", + principalTable: "PerformerProfile", + principalColumn: "PerformerId", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_HairPrestationCollectionItem_HairPrestation_PrestationId", + table: "HairPrestationCollectionItem", + column: "PrestationId", + principalTable: "HairPrestation", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_HairPrestationCollectionItem_HairMultiCutQuery_QueryId", + table: "HairPrestationCollectionItem", + column: "QueryId", + principalTable: "HairMultiCutQuery", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_HairTaint_Color_ColorId", + table: "HairTaint", + column: "ColorId", + principalTable: "Color", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_HairTaintInstance_HairPrestation_PrestationId", + table: "HairTaintInstance", + column: "PrestationId", + principalTable: "HairPrestation", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_HairTaintInstance_HairTaint_TaintId", + table: "HairTaintInstance", + column: "TaintId", + principalTable: "HairTaint", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_DimissClicked_Notification_NotificationId", + table: "DimissClicked", + column: "NotificationId", + principalTable: "Notification", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_InstrumentRating_Instrument_InstrumentId", + table: "InstrumentRating", + column: "InstrumentId", + principalTable: "Instrument", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_Instrumentation_Instrument_InstrumentId", + table: "Instrumentation", + column: "InstrumentId", + principalTable: "Instrument", + principalColumn: "Id", + 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_Contact_PostalAddress_AddressId", + table: "Contact", + column: "AddressId", + principalTable: "PostalAddress", + principalColumn: "Id", + 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); + migrationBuilder.AddForeignKey( + name: "FK_RdvQuery_Activity_ActivityCode", + table: "RdvQuery", + column: "ActivityCode", + principalTable: "Activity", + principalColumn: "Code", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_RdvQuery_ApplicationUser_ClientId", + table: "RdvQuery", + column: "ClientId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_RdvQuery_PerformerProfile_PerformerId", + table: "RdvQuery", + column: "PerformerId", + principalTable: "PerformerProfile", + principalColumn: "PerformerId", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_Project_Activity_ActivityCode", + table: "Project", + column: "ActivityCode", + principalTable: "Activity", + principalColumn: "Code", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_Project_ApplicationUser_ClientId", + table: "Project", + column: "ClientId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_Project_GitRepositoryReference_GitId", + table: "Project", + column: "GitId", + principalTable: "GitRepositoryReference", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_Project_PerformerProfile_PerformerId", + table: "Project", + column: "PerformerId", + principalTable: "PerformerProfile", + principalColumn: "PerformerId", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_ProjectBuildConfiguration_Project_ProjectId", + table: "ProjectBuildConfiguration", + column: "ProjectId", + principalTable: "Project", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + } +} diff --git a/src/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs b/src/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs index e2c94898..7d87b4d2 100644 --- a/src/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/src/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs @@ -1388,15 +1388,6 @@ namespace Yavsc.Migrations b.HasKey("DoesCode", "UserId"); }); - modelBuilder.Entity("Yavsc.Server.Models.Access.CircleAuthorizationToFile", b => - { - b.Property("CircleId"); - - b.Property("FullPath"); - - b.HasKey("CircleId", "FullPath"); - }); - modelBuilder.Entity("Yavsc.Server.Models.Blog.BlogTrad", b => { b.Property("PostId"); @@ -1995,13 +1986,6 @@ namespace Yavsc.Migrations .HasForeignKey("UserId"); }); - modelBuilder.Entity("Yavsc.Server.Models.Access.CircleAuthorizationToFile", b => - { - b.HasOne("Yavsc.Models.Relationship.Circle") - .WithMany() - .HasForeignKey("CircleId"); - }); - modelBuilder.Entity("Yavsc.Server.Models.Blog.BlogTrad", b => { b.HasOne("Yavsc.Models.ApplicationUser") diff --git a/src/Yavsc/Models/ApplicationDbContext.cs b/src/Yavsc/Models/ApplicationDbContext.cs index 01264883..445fcace 100644 --- a/src/Yavsc/Models/ApplicationDbContext.cs +++ b/src/Yavsc/Models/ApplicationDbContext.cs @@ -38,7 +38,6 @@ namespace Yavsc.Models using Blog; using Yavsc.Abstract.Identity; using Yavsc.Server.Models.Blog; - using Yavsc.Server.Models.Access; public class ApplicationDbContext : IdentityDbContext { @@ -68,7 +67,6 @@ namespace Yavsc.Models builder.Entity().HasOne(bl => bl.User); builder.Entity().HasOne(bl => bl.Owner); builder.Entity().HasKey(tr => new { post = tr.PostId, lang = tr.Lang }); - builder.Entity().HasKey(a => new { cid=a.CircleId, path=a.FullPath }); builder.Entity().HasAlternateKey(i => new { Instrument= i.InstrumentId, owner = i.OwnerId }); foreach (var et in builder.Model.GetEntityTypes()) @@ -290,9 +288,6 @@ namespace Yavsc.Models public DbSet ChatRoomAccess { get; set; } - [Obsolete("use pazof.rules from .access files")] - public DbSet CircleAuthorizationToFile { get; set; } - public DbSet InstrumentRating { get; set; } } diff --git a/src/Yavsc/Startup/Startup.OAuth.cs b/src/Yavsc/Startup/Startup.OAuth.cs index f603be93..d17f6fa9 100644 --- a/src/Yavsc/Startup/Startup.OAuth.cs +++ b/src/Yavsc/Startup/Startup.OAuth.cs @@ -63,24 +63,8 @@ namespace Yavsc option => { IdentityAppOptions = option; - option.User.AllowedUserNameCharacters += " "; option.User.RequireUniqueEmail = true; option.Cookies.ApplicationCookie.LoginPath = "/signin"; - // option.Cookies.TwoFactorRememberMeCookie.ExpireTimeSpan = TimeSpan.FromDays(30); - // option.Cookies.TwoFactorRememberMeCookie.DataProtectionProvider = ProtectionProvider; - // option.Cookies.ApplicationCookie.DataProtectionProvider = ProtectionProvider; - // option.Cookies.ExternalCookie.DataProtectionProvider = ProtectionProvider; - // option.Cookies.ApplicationCookie.AuthenticationScheme = Constants.ApplicationAuthenticationSheme; - /* - option.Cookies.ApplicationCookie.LoginPath = new PathString(Constants.LoginPath.Substring(1)); - option.Cookies.ApplicationCookie.AccessDeniedPath = new PathString(Constants.AccessDeniedPath.Substring(1)); - option.Cookies.ApplicationCookie.AutomaticAuthenticate = true; - option.Cookies.ApplicationCookie.AuthenticationScheme = Constants.ApplicationAuthenticationSheme; - option.Cookies.ApplicationCookieAuthenticationScheme = Constants.ApplicationAuthenticationSheme; - option.Cookies.ExternalCookieAuthenticationScheme = Constants.ExternalAuthenticationSheme; - option.Cookies.ExternalCookie.AutomaticAuthenticate = true; - option.Cookies.ExternalCookie.AuthenticationScheme = Constants.ExternalAuthenticationSheme; - */ } ).AddEntityFrameworkStores() .AddTokenProvider>(Constants.DefaultFactor) diff --git a/src/cli/Commands/SendMailCommand.cs b/src/cli/Commands/SendMailCommand.cs index e6d38cb1..9693559e 100644 --- a/src/cli/Commands/SendMailCommand.cs +++ b/src/cli/Commands/SendMailCommand.cs @@ -16,11 +16,11 @@ namespace cli CommandArgument critCommandArg = null; CommandOption sendHelpOption = null; CommandLineApplication sendMailCommandApp - = rootApp.Command("send-monthly", + = rootApp.Command("send-email", (target) => { target.FullName = "Send email"; - target.Description = "Sends monthly emails using given template from code"; + target.Description = "Sends emails using given template from code"; sendHelpOption = target.HelpOption("-? | -h | --help"); critCommandArg = target.Argument( "criteria", diff --git a/src/cli/Commands/UserListCleanUp.cs b/src/cli/Commands/UserListCleanUp.cs index 9b3efba2..6eecbffd 100644 --- a/src/cli/Commands/UserListCleanUp.cs +++ b/src/cli/Commands/UserListCleanUp.cs @@ -47,11 +47,23 @@ namespace cli.Commands ApplicationDbContext dbContext = app.Services.GetService(); Func criteria = UserPolicies.Criterias["user-to-remove"]; + if (userManager==null) + { + logger.LogError("No user manager"); + throw new Exception("No user manager"); + } + logger.LogInformation("Starting emailling"); - mailer.SendEmailFromCriteria("user-to-remove"); - foreach (ApplicationUser user in dbContext.ApplicationUser.Where( - u => criteria(u) - )) + try { + mailer.SendEmailFromCriteria("user-to-remove"); + } + catch (NoMaillingTemplateException ex) + { + logger.LogWarning(ex.Message); + } + ApplicationUser [] users = dbContext.ApplicationUser.Where( + u => criteria(u)).ToArray(); + foreach (ApplicationUser user in users) { dbContext.DeviceDeclaration.RemoveRange(dbContext.DeviceDeclaration.Where(g => g.DeviceOwnerId == user.Id)); await userManager.DeleteAsync(user); diff --git a/src/cli/Program.cs b/src/cli/Program.cs index 73f6b924..07b5ecb7 100644 --- a/src/cli/Program.cs +++ b/src/cli/Program.cs @@ -121,6 +121,7 @@ namespace cli new AuthCommander(loggerFactory).Integrate(cliapp); new GenerationCommander().Integrate(cliapp); new Streamer(loggerFactory, cxSettings, usercxSettings ).Integrate(cliapp); + new UserListCleanUp().Integrate(cliapp); if (args.Length == 0) { diff --git a/src/cli/Services/EMailer.cs b/src/cli/Services/EMailer.cs index c9ef9028..4b716e34 100644 --- a/src/cli/Services/EMailer.cs +++ b/src/cli/Services/EMailer.cs @@ -21,6 +21,13 @@ using Yavsc.Server.Settings; namespace cli.Services { + public class NoMaillingTemplateException : Exception + { + public NoMaillingTemplateException(string templateCode) : base ($"No template found under id {templateCode}.") + { + + } + } public class EMailer { @@ -74,7 +81,7 @@ namespace cli.Services var templateInfo = dbContext.MailingTemplate.FirstOrDefault(t => t.Id == templateCode); - if (templateInfo==null) throw new Exception($"No template found under id {templateCode}."); + if (templateInfo==null) throw new NoMaillingTemplateException(templateCode); logger.LogInformation($"Using code: {templateCode}, subject: {subtemp} "); logger.LogInformation("And body:\n"+templateInfo.Body); using (StringReader reader = new StringReader(templateInfo.Body)) diff --git a/src/cli/Startup.cs b/src/cli/Startup.cs index 7562247a..e610ca6c 100644 --- a/src/cli/Startup.cs +++ b/src/cli/Startup.cs @@ -27,6 +27,8 @@ using System.Collections.Generic; using Microsoft.Extensions.CodeGeneration.EntityFramework; using System.Linq; using Newtonsoft.Json; +using Microsoft.AspNet.Identity; +using Microsoft.AspNet.Identity.EntityFramework; namespace cli { @@ -143,6 +145,7 @@ namespace cli services.AddSingleton(typeof(IAssemblyLoadContextAccessor), svs => PlatformServices.Default.AssemblyLoadContextAccessor); services.AddSingleton(typeof(IAssemblyLoaderContainer), svs => PlatformServices.Default.AssemblyLoaderContainer); services.AddSingleton(typeof(ILibraryManager), svs => PlatformServices.Default.LibraryManager); + services.AddSingleton>(); services.AddSingleton(typeof(BootstrapperContext), svs => new BootstrapperContext @@ -247,6 +250,12 @@ Microsoft.Extensions.CodeGeneration.ICodeGeneratorActionsService), services.AddTransient(typeof(IPackageInstaller),typeof(PackageInstaller)); services.AddTransient(typeof(Microsoft.Extensions.CodeGeneration.ILogger),typeof(Microsoft.Extensions.CodeGeneration.ConsoleLogger)); + services.AddIdentity( + option => + { + option.User.RequireUniqueEmail = true; + } + ).AddEntityFrameworkStores(); Services = services; } diff --git a/test/yavscTests/Startup.cs b/test/yavscTests/Startup.cs index 08400a74..3237af55 100644 --- a/test/yavscTests/Startup.cs +++ b/test/yavscTests/Startup.cs @@ -180,24 +180,8 @@ namespace test option => { IdentityAppOptions = option; - option.User.AllowedUserNameCharacters += " "; option.User.RequireUniqueEmail = true; option.Cookies.ApplicationCookie.LoginPath = "/signin"; - // option.Cookies.TwoFactorRememberMeCookie.ExpireTimeSpan = TimeSpan.FromDays(30); - // option.Cookies.TwoFactorRememberMeCookie.DataProtectionProvider = ProtectionProvider; - // option.Cookies.ApplicationCookie.DataProtectionProvider = ProtectionProvider; - // option.Cookies.ExternalCookie.DataProtectionProvider = ProtectionProvider; - // option.Cookies.ApplicationCookie.AuthenticationScheme = Constants.ApplicationAuthenticationSheme; - /* - option.Cookies.ApplicationCookie.LoginPath = new PathString(Constants.LoginPath.Substring(1)); - option.Cookies.ApplicationCookie.AccessDeniedPath = new PathString(Constants.AccessDeniedPath.Substring(1)); - option.Cookies.ApplicationCookie.AutomaticAuthenticate = true; - option.Cookies.ApplicationCookie.AuthenticationScheme = Constants.ApplicationAuthenticationSheme; - option.Cookies.ApplicationCookieAuthenticationScheme = Constants.ApplicationAuthenticationSheme; - option.Cookies.ExternalCookieAuthenticationScheme = Constants.ExternalAuthenticationSheme; - option.Cookies.ExternalCookie.AutomaticAuthenticate = true; - option.Cookies.ExternalCookie.AuthenticationScheme = Constants.ExternalAuthenticationSheme; - */ } ).AddEntityFrameworkStores() .AddTokenProvider>(Constants.DefaultFactor)