diff --git a/scripts/build/make/dnx.mk b/scripts/build/make/dnx.mk index 2e049626..79beeb87 100644 --- a/scripts/build/make/dnx.mk +++ b/scripts/build/make/dnx.mk @@ -44,7 +44,7 @@ project.lock.json: project.json $(dnu) restore watch: project.lock.json - MONO_MANAGED_WATCHER=enabled ASPNET_ENV=$(ASPNET_ENV) ASPNET_LOG_LEVEL=$(ASPNET_LOG_LEVEL) dnx-watch web --configuration=$(CONFIGURATION) + MONO_OPTIONS=--debug MONO_MANAGED_WATCHER=enabled ASPNET_ENV=$(ASPNET_ENV) ASPNET_LOG_LEVEL=$(ASPNET_LOG_LEVEL) dnx-watch web --configuration=$(CONFIGURATION) clean: rm -rf bin obj diff --git a/src/Yavsc.Abstract/Chat/ChatRoomAccessLevel.cs b/src/Yavsc.Abstract/Chat/ChatRoomAccessLevel.cs index 20ade855..6752bc4f 100644 --- a/src/Yavsc.Abstract/Chat/ChatRoomAccessLevel.cs +++ b/src/Yavsc.Abstract/Chat/ChatRoomAccessLevel.cs @@ -1,7 +1,9 @@ namespace Yavsc.Abstract.Chat { public enum ChatRoomAccessLevel: int { - Op=1, - HalfOp=2 + None=0, + Voice, + Op, + HalfOp } } \ No newline at end of file diff --git a/src/Yavsc.Server/ChatUserFlags.cs b/src/Yavsc.Server/ChatUserFlags.cs new file mode 100644 index 00000000..21b221b2 --- /dev/null +++ b/src/Yavsc.Server/ChatUserFlags.cs @@ -0,0 +1,12 @@ +namespace Yavsc +{ + /// + /// Chat User Flags + /// + public enum ChatUserFlags : byte + { + away = 1, + invisible = 2, + cop = 4 + } +} diff --git a/src/Yavsc.Server/Constants.cs b/src/Yavsc.Server/Constants.cs index fb499b84..b3f39e47 100644 --- a/src/Yavsc.Server/Constants.cs +++ b/src/Yavsc.Server/Constants.cs @@ -61,9 +61,8 @@ namespace Yavsc public const string HubGroupAnonymous = "anonymous"; public const string HubGroupCops= "cops"; public const int MaxChanelName = 255; - } - public static class NotificationTypes { - public const string Connected = "connected"; - public const string DisConnected = "disconnected"; + + public const string AnonymousUserNamePrefix = "?"; + public const string KeyParamChatUserName = "username"; } } diff --git a/src/Yavsc.Server/ErrorMessages.cs b/src/Yavsc.Server/ErrorMessages.cs new file mode 100644 index 00000000..f49c3069 --- /dev/null +++ b/src/Yavsc.Server/ErrorMessages.cs @@ -0,0 +1,6 @@ +namespace Yavsc +{ + public static class ErrorMessages { + public const string ContactRefused = "contact refused"; + } +} diff --git a/src/Yavsc.Server/Models/Access/BlackList.cs b/src/Yavsc.Server/Models/Access/BlackList.cs index 64e9cbe4..62c3ed94 100644 --- a/src/Yavsc.Server/Models/Access/BlackList.cs +++ b/src/Yavsc.Server/Models/Access/BlackList.cs @@ -15,8 +15,11 @@ namespace Yavsc.Models.Access [Required] public string OwnerId { get; set; } - [ForeignKey("OwnerId"),JsonIgnore] + [ForeignKey("OwnerId"), JsonIgnore] public virtual ApplicationUser Owner { get; set; } + + [ForeignKey("UserId"), JsonIgnore] + public virtual ApplicationUser User { get; set; } } } diff --git a/src/Yavsc.Server/Models/Chat/ChatRoom.cs b/src/Yavsc.Server/Models/Chat/ChatRoom.cs index eb397ecb..909d58fb 100644 --- a/src/Yavsc.Server/Models/Chat/ChatRoom.cs +++ b/src/Yavsc.Server/Models/Chat/ChatRoom.cs @@ -1,12 +1,14 @@ +using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using Newtonsoft.Json; using Yavsc.Abstract.Chat; namespace Yavsc.Models.Chat { - public class ChatRoom: IChatRoom + public class ChatRoom: IChatRoom, IBaseTrackedEntity { public string Topic { get; set; } @@ -16,11 +18,17 @@ namespace Yavsc.Models.Chat public string OwnerId { get; set; } - [ForeignKey("OwnerId")] + [ForeignKey("OwnerId")][JsonIgnore] public virtual ApplicationUser Owner { get; set; } - [InverseProperty("Room")] + [InverseProperty("Room")][JsonIgnore] public virtual List Moderation { get; set; } + public DateTime LatestJoinPart { get; set;} + public DateTime DateCreated { get; set; } + + public string UserCreated { get; set; } + public DateTime DateModified { get; set;} + public string UserModified { get; set; } } } \ No newline at end of file diff --git a/src/Yavsc.Server/Models/Chat/ChatRoomAccess.cs b/src/Yavsc.Server/Models/Chat/ChatRoomAccess.cs index 797ccdc7..18d3f301 100644 --- a/src/Yavsc.Server/Models/Chat/ChatRoomAccess.cs +++ b/src/Yavsc.Server/Models/Chat/ChatRoomAccess.cs @@ -25,8 +25,6 @@ namespace Yavsc.Models.Chat get; set; } - - [ForeignKey("UserId")] public virtual ApplicationUser User { get; set; } } diff --git a/src/Yavsc.Server/NotificationTypes.cs b/src/Yavsc.Server/NotificationTypes.cs new file mode 100644 index 00000000..d3e8d02c --- /dev/null +++ b/src/Yavsc.Server/NotificationTypes.cs @@ -0,0 +1,13 @@ +namespace Yavsc +{ + public static class NotificationTypes { + public const string Connected = "connected"; + public const string DisConnected = "disconnected"; + public const string Reconnected = "reconnected"; + public const string UserPart = "userpart"; + public const string UserJoin = "userjoin"; + public const string PrivateMessageDenied = "deniedpv"; + + public const string Error = "error"; + } +} diff --git a/src/Yavsc.Server/ServerCommands.cs b/src/Yavsc.Server/ServerCommands.cs new file mode 100644 index 00000000..e6feff91 --- /dev/null +++ b/src/Yavsc.Server/ServerCommands.cs @@ -0,0 +1,33 @@ +namespace Yavsc +{ + public static class ServerCommands { + + public const string whois = nameof(whois); + public const string whowas = nameof(whowas); + + /// + /// modify a chan or an user + /// + /// + public const string mode = nameof(mode); + + /// + /// register a channel + /// + /// + public const string register = nameof(register); + + /// + /// kick some user + /// + /// + public const string kick = nameof(kick); + + /// + /// ban an user + /// + /// + public const string ban = nameof(ban); + + } +} diff --git a/src/Yavsc/Controllers/Contracting/CommandController.cs b/src/Yavsc/Controllers/Contracting/CommandController.cs index b738dba4..6248c2bc 100644 --- a/src/Yavsc/Controllers/Contracting/CommandController.cs +++ b/src/Yavsc/Controllers/Contracting/CommandController.cs @@ -24,7 +24,7 @@ namespace Yavsc.Controllers protected UserManager _userManager; protected ApplicationDbContext _context; protected GoogleAuthSettings _googleSettings; - protected IYavscMessageSender _GCMSender; + protected IYavscMessageSender _MessageSender; protected IEmailSender _emailSender; protected IStringLocalizer _localizer; protected SiteSettings _siteSettings; @@ -44,7 +44,7 @@ namespace Yavsc.Controllers ILoggerFactory loggerFactory) { _context = context; - _GCMSender = GCMSender; + _MessageSender = GCMSender; _emailSender = emailSender; _googleSettings = googleSettings.Value; _userManager = userManager; @@ -165,47 +165,39 @@ namespace Yavsc.Controllers var yaev = command.CreateEvent(_localizer, "NewCommand"); - MessageWithPayloadResponse grep = null; + MessageWithPayloadResponse nrep = null; if (pro.AcceptNotifications && pro.AcceptPublicContact) { - try { - _logger.LogInformation("sending GCM"); - if (pro.Performer.DeviceDeclarations.Count > 0) - { - var regids = command.PerformerProfile.Performer - .DeviceDeclarations.Select(d => d.DeviceId); - grep = await _GCMSender.NotifyBookQueryAsync(regids, yaev); - } - - + _logger.LogInformation("sending message"); + var regids = new [] { command.PerformerProfile.Performer.Id }; + nrep = await _MessageSender.NotifyBookQueryAsync(regids, yaev); // TODO setup a profile choice to allow notifications // both on mailbox and mobile // if (grep==null || grep.success<=0 || grep.failure>0) - ViewBag.GooglePayload = grep; + ViewBag.MessagingResponsePayload = nrep; } catch (Exception ex) { - _logger.LogError(ex.Message); + _logger.LogError("Message sending failed with: "+ex.Message); + throw; } - try - { - ViewBag.EmailSent = await _emailSender.SendEmailAsync( - command.PerformerProfile.Performer.UserName, - command.PerformerProfile.Performer.Email, - $"{command.Client.UserName} (un client) vous demande un rendez-vous", - $"{yaev.CreateBody()}\r\n-- \r\n{yaev.Previsional}\r\n{yaev.EventDate}\r\n" - ); - } - catch (Exception ex) - { - _logger.LogError(ex.Message); - } } + else { + nrep = new MessageWithPayloadResponse { failure=1, results = new MessageWithPayloadResponse.Result[] { + new MessageWithPayloadResponse.Result + { + error=ErrorMessages.ContactRefused, + registration_id= pro.PerformerId + } + } }; + _logger.LogInformation("Command.Create && ( !pro.AcceptNotifications || |pro.AcceptPublicContact ) "); + } + ViewBag.MessagingResponsePayload = nrep; ViewBag.Activity = _context.Activities.FirstOrDefault(a => a.Code == command.ActivityCode); ViewBag.GoogleSettings = _googleSettings; return View("CommandConfirmation", command); diff --git a/src/Yavsc/Controllers/Haircut/HairCutCommandController.cs b/src/Yavsc/Controllers/Haircut/HairCutCommandController.cs index 7fcf0ccd..7608f3da 100644 --- a/src/Yavsc/Controllers/Haircut/HairCutCommandController.cs +++ b/src/Yavsc/Controllers/Haircut/HairCutCommandController.cs @@ -104,7 +104,7 @@ namespace Yavsc.Controllers { var regids = command.PerformerProfile.Performer .DeviceDeclarations.Select(d => d.DeviceId); - grep = await _GCMSender.NotifyAsync(regids, yaev); + grep = await _MessageSender.NotifyAsync(regids, yaev); } // TODO setup a profile choice to allow notifications // both on mailbox and mobile @@ -271,7 +271,7 @@ namespace Yavsc.Controllers if (pro.Performer.DeviceDeclarations.Count > 0) { var regids = pro.Performer.DeviceDeclarations.Select(d => d.DeviceId); - grep = await _GCMSender.NotifyHairCutQueryAsync(regids, yaev); + grep = await _MessageSender.NotifyHairCutQueryAsync(regids, yaev); } // TODO setup a profile choice to allow notifications // both on mailbox and mobile @@ -431,7 +431,7 @@ namespace Yavsc.Controllers { var regids = command.PerformerProfile.Performer .DeviceDeclarations.Select(d => d.DeviceId); - grep = await _GCMSender.NotifyHairCutQueryAsync(regids, yaev); + grep = await _MessageSender.NotifyHairCutQueryAsync(regids, yaev); } // TODO setup a profile choice to allow notifications // both on mailbox and mobile, and to allow calendar event insertion. diff --git a/src/Yavsc/Hubs/ChatHub.cs b/src/Yavsc/Hubs/ChatHub.cs index d4d65c5f..81834394 100644 --- a/src/Yavsc/Hubs/ChatHub.cs +++ b/src/Yavsc/Hubs/ChatHub.cs @@ -19,6 +19,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see . using Microsoft.AspNet.SignalR; +using Microsoft.AspNet.SignalR.Hosting; using System.Threading.Tasks; using System.Collections.Generic; using System.Linq; @@ -26,7 +27,8 @@ using System.Linq; namespace Yavsc { using System; - using Microsoft.AspNet.Authorization; + using System.Collections.Concurrent; + using Microsoft.AspNet.WebUtilities; using Microsoft.Data.Entity; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -37,12 +39,12 @@ namespace Yavsc { ApplicationDbContext _dbContext; ILogger _logger; - IUserIdProvider _userIdProvider; - public ChatHub(IUserIdProvider userIdProvider) + public ChatHub() { - _userIdProvider = userIdProvider; + var scope = Startup.Services.GetRequiredService().CreateScope(); + _dbContext = scope.ServiceProvider.GetService(); var loggerFactory = scope.ServiceProvider.GetService(); _logger = loggerFactory.CreateLogger(); @@ -51,18 +53,21 @@ namespace Yavsc public override async Task OnConnected() { bool isAuth = false; - string userName = null; + string userName = setUserName(); if (Context.User != null) { isAuth = Context.User.Identity.IsAuthenticated; - userName = Context.User.Identity.Name; - + var group = isAuth ? Constants.HubGroupAuthenticated : Constants.HubGroupAnonymous; // Log ("Cx: " + group); await Groups.Add(Context.ConnectionId, group); if (isAuth) { + _logger.LogInformation("Authenticated chat user"); + + var userId = _dbContext.Users.First(u=>u.UserName == userName).Id; + var userHadConnections = _dbContext.ChatConnection.Any(accx => accx.ConnectionId == Context.ConnectionId); if (userHadConnections) { @@ -72,134 +77,276 @@ namespace Yavsc else _dbContext.ChatConnection.Add(new ChatConnection { + ApplicationUserId = userId, ConnectionId = Context.ConnectionId, UserAgent = Context.Request.Headers["User-Agent"], Connected = true }); _dbContext.SaveChanges(); - var userId = _userIdProvider.GetUserId(this.Context.Request); - Clients.CallerState.BlackListedBy = await _dbContext.BlackListed.Where(r=>r.UserId == userId).Select(r=>r.OwnerId).ToArrayAsync(); - // TODO ChatHubConnectioinFlags + // TODO ChatHubConnectioinFlags } else + { // FIXME is this line reached ? - await Groups.Add(Context.ConnectionId, Constants.HubGroupAnonymous); + _logger.LogInformation("Anonymous chat user (first use case)"); + throw new NotSupportedException(); + } + } + else { + // TODO var uname = Context.Request.QueryString[Constants.KeyParamChatUserName] ?? "anon"; + + await Groups.Add(Context.ConnectionId, Constants.HubGroupAnonymous); } - else await Groups.Add(Context.ConnectionId, Constants.HubGroupAnonymous); - // TODO only notify followers Clients.Group(Constants.HubGroupAuthenticated).notify(NotificationTypes.Connected, Context.ConnectionId, userName); - await base.OnConnected(); } + static ConcurrentDictionary ChatUserNames + = new ConcurrentDictionary(); + string setUserName() + { + if (Context.User!=null) + if (Context.User.Identity.IsAuthenticated) + { + ChatUserNames[Context.ConnectionId]=Context.User.Identity.Name; + _logger.LogInformation($"chat user name set to : {Context.User.Identity.Name}"); + return Context.User.Identity.Name; + } + anonymousSequence++; + var aname = $"{Constants.AnonymousUserNamePrefix}{anonymousSequence}"; + ChatUserNames[Context.ConnectionId]=aname; + _logger.LogInformation($"Anonymous chat user name set to : {aname}"); + return aname; + } + + static long anonymousSequence=0; public override Task OnDisconnected(bool stopCalled) { - string userName = Context.User?.Identity.Name; - Clients.Group("authenticated").notify("disconnected", Context.ConnectionId, userName); + Clients.Group("authenticated").notify(NotificationTypes.DisConnected, Context.ConnectionId, userName); if (userName != null) { - using (var db = new ApplicationDbContext()) { - var cx = db.ChatConnection.SingleOrDefault(c => c.ConnectionId == Context.ConnectionId); - if (cx != null) + var cx = _dbContext.ChatConnection.SingleOrDefault(c => c.ConnectionId == Context.ConnectionId); + if (cx != null) + { + if (stopCalled) { - if (stopCalled) - { - var user = db.Users.Single(u => u.UserName == userName); - user.Connections.Remove(cx); - } - else - { - cx.Connected = false; - } - db.SaveChanges(); + var user = _dbContext.Users.Single(u => u.UserName == userName); + user.Connections.Remove(cx); } + else + { + cx.Connected = false; + } + _dbContext.SaveChanges(); } } - return base.OnDisconnected(stopCalled); } public override Task OnReconnected() { - string userName = Context.User?.Identity.Name; - if (userName != null) + if (Context.User != null) if (Context.User.Identity.IsAuthenticated) { + var userName = Context.User.Identity.Name; + var user = _dbContext.Users.FirstOrDefault(u=>u.UserName == userName); + if (user == null) + _logger.LogWarning($"null user with <{userName}> & Context.User.Identity.IsAuthenticated"); + var userId = user.Id; + var userHadConnections = _dbContext.ChatConnection.Any(accx => accx.ConnectionId == Context.ConnectionId); - var user = _dbContext.Users.Single(u => u.UserName == userName); - - if (user.Connections==null) user.Connections = new List(); - - - var cx = user.Connections.SingleOrDefault(c => c.ConnectionId == Context.ConnectionId); - if (cx != null) + if (userHadConnections) { + var ccx = _dbContext.ChatConnection.First(c=> c.ConnectionId == Context.ConnectionId); + ccx.Connected=true; + } + else + _dbContext.ChatConnection.Add(new ChatConnection { - cx.Connected = true; - _dbContext.SaveChanges(); - } - else cx = new ChatConnection { ConnectionId = Context.ConnectionId, + ApplicationUserId = userId, + ConnectionId = Context.ConnectionId, UserAgent = Context.Request.Headers["User-Agent"], - Connected = true }; + Connected = true + }); + _dbContext.SaveChanges(); + Clients.Group("authenticated").notify(NotificationTypes.Reconnected, Context.ConnectionId, userName); } - return base.OnReconnected(); } - public void Send(string name, string message) + static ConcurrentDictionary Channels = new ConcurrentDictionary(); + + public class ChatRoomInfo { + public string Name ; + public Dictionary Users = new Dictionary(); + public string Topic; + } + + public void Join(string roomName) { - string uname = (Context.User != null) ? - $"[{Context.User.Identity.Name}]" : - $"?{name}"; - Clients.All.addMessage(uname, message); + _logger.LogInformation("a client for "+roomName); + var userName = ChatUserNames[Context.ConnectionId]; + _logger.LogInformation($" chat user : {userName}"); + var roomGroupName = "room_"+roomName; + + ChatRoomInfo chanInfo; + if (Channels.ContainsKey(roomName)) + { + if (Channels.TryGetValue(roomName, out chanInfo)) { + _logger.LogInformation("room is avaible."); + if (chanInfo.Users.ContainsKey(Context.ConnectionId)) + _logger.LogWarning("user already joined."); + else { + chanInfo.Users.Add(Context.ConnectionId, userName); + + Groups.Add(Context.ConnectionId,roomGroupName); + } + Clients.Caller.onJoined(chanInfo); + Clients.Group("room_"+roomName).notify( NotificationTypes.UserJoin, Context.ConnectionId, Clients.Caller.UserName); + + _logger.LogInformation("exiting ok."); + return; + } + else { + _logger.LogInformation("room seemd to be avaible ... but we could get no info on it."); + Clients.Caller.notify(NotificationTypes.Error, "join get chan failed ..."); + return; + } + } + // chan was almost empty + _logger.LogInformation("joining empty chan."); + + var room = _dbContext.ChatRoom.FirstOrDefault(r => r.Name == roomName); + + chanInfo = new ChatRoomInfo(); + chanInfo.Users.Add(Context.ConnectionId, userName); + + if (room!=null) + { + _logger.LogInformation("existent room."); + chanInfo.Topic = room.Topic; + chanInfo.Name = room.Name; + } + else { // a first join, we create it. + _logger.LogInformation("room creation."); + chanInfo.Name = roomName; + chanInfo.Topic = ""; + } + + if (Channels.TryAdd(roomName, chanInfo)) + { + Groups.Add(Context.ConnectionId, roomGroupName); + Clients.Caller.onJoined(chanInfo); + } + else _logger.LogError("Chan create failed unexpectly..."); + } + + [Authorize] + public void Register (string room ) + { + var existent = _dbContext.ChatRoom.Any(r => r.Name == room); + if (existent) { + Clients.Caller.notify(NotificationTypes.Error, "already registered."); + return; + } + string userName = Context.User.Identity.Name; + var user = _dbContext.Users.FirstOrDefault(u=>u.UserName == userName); + var newroom = new ChatRoom { Name = room, OwnerId = user.Id }; + ChatRoomInfo chanInfo; + if (Channels.TryGetValue(room, out chanInfo)) + { + // TODO get and require some admin status for current user on this chan + newroom.Topic = chanInfo.Topic; + } + newroom.LatestJoinPart = DateTime.Now; + + _dbContext.ChatRoom.Add(newroom); + _dbContext.SaveChanges(user.Id); + } + + /** TODO chan register on server command + room = new ChatRoom { Name = roomName, OwnerId = uid }; + _dbContext.ChatRoom.Add(room); + _dbContext.SaveChanges(uid); + room.LatestJoinPart = DateTime.Now; + chanInfo.Topic = room.Topic; + */ + + + public void Part (string roomName, string reason) + { + ChatRoomInfo chanInfo; + if (Channels.TryGetValue(roomName, out chanInfo)) + { + var roomGroupName = "room_"+roomName; + Groups.Remove(Context.ConnectionId, roomGroupName); + var group = Clients.Group(roomGroupName); + var username = ChatUserNames[Context.ConnectionId]; + group.notify( NotificationTypes.UserPart, Context.ConnectionId, new { username, reason } ); + + chanInfo.Users.Remove(Context.ConnectionId); + ChatRoomInfo deadchanInfo; + if (chanInfo.Users.Count==0) + if (Channels.TryRemove(roomName, out deadchanInfo)) + { + var room = _dbContext.ChatRoom.FirstOrDefault(r => r.Name == roomName); + room.LatestJoinPart = DateTime.Now; + _dbContext.SaveChanges(); + } + } + else { + Clients.Caller.notify(NotificationTypes.Error, "not joint"); + } } + public void Send(string roomName, string message) + { + var groupname = "room_"+roomName; + ChatRoomInfo chanInfo; + if (Channels.TryGetValue(roomName, out chanInfo)) + { + if (!chanInfo.Users.ContainsKey(Context.ConnectionId)){ + Clients.Caller.notify(NotificationTypes.Error, $"could not join channel ({roomName})"); + return; + } + string uname = ChatUserNames[Context.ConnectionId]; + Clients.Group(groupname).addMessage(uname, roomName, message); + } + else + { + Clients.Caller.notify(NotificationTypes.Error, $"could not join channel ({roomName})"); + return; + } + + } [Authorize] public void SendPV(string connectionId, string message) { - if (Clients.CallerState.BlackListedBy!=null) - foreach (string destId in Clients.CallerState.BlackListedBy) + if (!Context.User.IsInRole(Constants.AdminGroupName)) + { + var bl = _dbContext.BlackListed + .Include(r => r.User) + .Where(r=>r.User.UserName == Context.User.Identity.Name) + .Select(r=>r.OwnerId); + + if (bl!=null) foreach (string uid in bl) { - if (_dbContext.ChatConnection.Any(c => c.ConnectionId == connectionId && c.ApplicationUserId == destId )) - { - _logger.LogInformation($"PV aborted by black list"); - Clients.Caller.send("denied"); + if (_dbContext.ChatConnection.Any(cx => cx.ApplicationUserId==uid && cx.Connected)) + Clients.Caller.notify(NotificationTypes.PrivateMessageDenied, connectionId); return ; - } } + } var cli = Clients.Client(connectionId); cli.addPV(Context.User.Identity.Name, message); } - private async Task AllowPv(string destConnectionId) - { - if (Context.User.IsInRole(Constants.BlogModeratorGroupName)) - - if (Context.User.IsInRole(Constants.BlogModeratorGroupName) - || Context.User.IsInRole(Constants.AdminGroupName)) - return true; - if (!Context.User.Identity.IsAuthenticated) - return false; - string senderId = (await _dbContext.ChatConnection.SingleAsync (c=>c.ConnectionId == Context.ConnectionId)).ApplicationUserId; - - - if (_dbContext.Ban.Any(b=>b.TargetId == senderId)) return false; - var destChatUser = await _dbContext.ChatConnection.SingleAsync (c=>c.ConnectionId == destConnectionId); - - if (_dbContext.BlackListed.Any(b=>b.OwnerId == destChatUser.ApplicationUserId && b.UserId == senderId)) return false; - var destUser = await _dbContext.Performers.FirstOrDefaultAsync( u=> u.PerformerId == destChatUser.ApplicationUserId); - return destUser?.AcceptPublicContact ?? true; - } + [Authorize] public void SendStream(string connectionId, long streamId, string message) { var sender = Context.User.Identity.Name; - // TODO personal black|white list + - // Contact list allowed only + - // only pro - var hubCxContext = Clients.User(connectionId); var cli = Clients.Client(connectionId); cli.addStreamInfo(sender, streamId, message); } diff --git a/src/Yavsc/Migrations/20190510021107_chanDates.Designer.cs b/src/Yavsc/Migrations/20190510021107_chanDates.Designer.cs new file mode 100644 index 00000000..d5e3fbe2 --- /dev/null +++ b/src/Yavsc/Migrations/20190510021107_chanDates.Designer.cs @@ -0,0 +1,2045 @@ +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("20190510021107_chanDates")] + partial class chanDates + { + 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("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("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") + .HasAnnotation("MaxLength", 15); + + b.Property("BIC") + .HasAnnotation("MaxLength", 15); + + b.Property("BankCode") + .HasAnnotation("MaxLength", 5); + + b.Property("BankedKey"); + + b.Property("IBAN") + .HasAnnotation("MaxLength", 33); + + b.Property("WicketCode") + .HasAnnotation("MaxLength", 5); + + 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") + .HasAnnotation("MaxLength", 56224); + + b.Property("DateCreated"); + + b.Property("DateModified"); + + b.Property("Lang") + .HasAnnotation("MaxLength", 8); + + b.Property("Photo") + .HasAnnotation("MaxLength", 1024); + + b.Property("Rate"); + + b.Property("Title") + .HasAnnotation("MaxLength", 1024); + + 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") + .HasAnnotation("MaxLength", 255); + + 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") + .HasAnnotation("MaxLength", 512); + + 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") + .IsRequired() + .HasAnnotation("MaxLength", 255); + + b.HasKey("Id"); + }); + + 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") + .IsRequired() + .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") + .IsRequired(); + + 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.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") + .IsRequired() + .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") + .IsRequired(); + + 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") + .HasAnnotation("MaxLength", 255); + + b.Property("MediaType") + .HasAnnotation("MaxLength", 127); + + b.Property("OwnerId") + .IsRequired(); + + b.Property("Pitch") + .HasAnnotation("MaxLength", 1023); + + b.Property("SequenceNumber"); + + b.Property("Title") + .HasAnnotation("MaxLength", 255); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.Activity", b => + { + b.Property("Code") + .HasAnnotation("MaxLength", 512); + + b.Property("DateCreated"); + + b.Property("DateModified"); + + b.Property("Description"); + + b.Property("Hidden"); + + b.Property("ModeratorGroupName"); + + b.Property("Name") + .IsRequired() + .HasAnnotation("MaxLength", 512); + + b.Property("ParentCode") + .HasAnnotation("MaxLength", 512); + + 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") + .IsRequired(); + + 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") + .IsRequired() + .HasAnnotation("MaxLength", 14); + + b.Property("UseGeoLocalizationToReduceDistanceWithClients"); + + b.Property("WebSite"); + + b.HasKey("PerformerId"); + }); + + modelBuilder.Entity("Yavsc.Models.Workflow.Profiles.FormationSettings", b => + { + b.Property("UserId"); + + 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") + .ValueGeneratedOnAdd(); + + b.Property("Body") + .HasAnnotation("MaxLength", 65536); + + b.Property("DateCreated"); + + b.Property("DateModified"); + + b.Property("ManagerId") + .IsRequired(); + + b.Property("ReplyToAddress"); + + b.Property("SuccessorId") + .IsRequired(); + + b.Property("ToSend"); + + b.Property("Topic") + .HasAnnotation("MaxLength", 128); + + 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") + .IsRequired(); + + 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") + .IsRequired(); + + b.Property("ProjectId"); + + b.HasKey("Id"); + }); + + modelBuilder.Entity("Yavsc.Server.Models.IT.SourceCode.GitRepositoryReference", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Branch") + .HasAnnotation("MaxLength", 512); + + b.Property("OwnerId") + .HasAnnotation("MaxLength", 1024); + + b.Property("Path") + .IsRequired(); + + b.Property("Url") + .HasAnnotation("MaxLength", 2048); + + 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"); + }); + + 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.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.EMailing.MailingTemplate", b => + { + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("ManagerId"); + + b.HasOne("Yavsc.Models.ApplicationUser") + .WithMany() + .HasForeignKey("SuccessorId"); + }); + + 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/20190510021107_chanDates.cs b/src/Yavsc/Migrations/20190510021107_chanDates.cs new file mode 100644 index 00000000..cdb0fe83 --- /dev/null +++ b/src/Yavsc/Migrations/20190510021107_chanDates.cs @@ -0,0 +1,941 @@ +using System; +using System.Collections.Generic; +using Microsoft.Data.Entity.Migrations; + +namespace Yavsc.Migrations +{ + public partial class chanDates : 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_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_DimissClicked_ApplicationUser_UserId", table: "DimissClicked"); + migrationBuilder.DropForeignKey(name: "FK_Instrumentation_Instrument_InstrumentId", table: "Instrumentation"); + migrationBuilder.DropForeignKey(name: "FK_PayPalPayment_ApplicationUser_ExecutorId", table: "PayPalPayment"); + migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember"); + migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember"); + migrationBuilder.DropForeignKey(name: "FK_Contact_PostalAddress_AddressId", table: "Contact"); + migrationBuilder.DropForeignKey(name: "FK_LiveFlow_ApplicationUser_OwnerId", table: "LiveFlow"); + migrationBuilder.DropForeignKey(name: "FK_CommandForm_Activity_ActivityCode", table: "CommandForm"); + 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_UserActivity_Activity_DoesCode", table: "UserActivity"); + migrationBuilder.DropForeignKey(name: "FK_UserActivity_PerformerProfile_UserId", table: "UserActivity"); + migrationBuilder.DropForeignKey(name: "FK_MailingTemplate_ApplicationUser_ManagerId", table: "MailingTemplate"); + migrationBuilder.DropForeignKey(name: "FK_MailingTemplate_ApplicationUser_SuccessorId", table: "MailingTemplate"); + 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.AddColumn( + name: "DateCreated", + table: "ChatRoom", + nullable: false, + defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + migrationBuilder.AddColumn( + name: "DateModified", + table: "ChatRoom", + nullable: false, + defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + migrationBuilder.AddColumn( + name: "LatestJoinPart", + table: "ChatRoom", + nullable: false, + defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + migrationBuilder.AddColumn( + name: "UserCreated", + table: "ChatRoom", + nullable: true); + migrationBuilder.AddColumn( + name: "UserModified", + table: "ChatRoom", + nullable: true); + migrationBuilder.AddForeignKey( + name: "FK_IdentityRoleClaim_IdentityRole_RoleId", + table: "AspNetRoleClaims", + column: "RoleId", + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserClaim_ApplicationUser_UserId", + table: "AspNetUserClaims", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserLogin_ApplicationUser_UserId", + table: "AspNetUserLogins", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserRole_IdentityRole_RoleId", + table: "AspNetUserRoles", + column: "RoleId", + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_IdentityUserRole_ApplicationUser_UserId", + table: "AspNetUserRoles", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_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_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_DimissClicked_ApplicationUser_UserId", + table: "DimissClicked", + column: "UserId", + principalTable: "AspNetUsers", + 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_PayPalPayment_ApplicationUser_ExecutorId", + table: "PayPalPayment", + column: "ExecutorId", + principalTable: "AspNetUsers", + 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_CircleMember_ApplicationUser_MemberId", + table: "CircleMember", + column: "MemberId", + principalTable: "AspNetUsers", + 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_LiveFlow_ApplicationUser_OwnerId", + table: "LiveFlow", + column: "OwnerId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_CommandForm_Activity_ActivityCode", + table: "CommandForm", + column: "ActivityCode", + principalTable: "Activity", + principalColumn: "Code", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_PerformerProfile_Location_OrganizationAddressId", + table: "PerformerProfile", + column: "OrganizationAddressId", + principalTable: "Location", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_PerformerProfile_ApplicationUser_PerformerId", + table: "PerformerProfile", + column: "PerformerId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + 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_UserActivity_Activity_DoesCode", + table: "UserActivity", + column: "DoesCode", + principalTable: "Activity", + principalColumn: "Code", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_UserActivity_PerformerProfile_UserId", + table: "UserActivity", + column: "UserId", + principalTable: "PerformerProfile", + principalColumn: "PerformerId", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_MailingTemplate_ApplicationUser_ManagerId", + table: "MailingTemplate", + column: "ManagerId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + migrationBuilder.AddForeignKey( + name: "FK_MailingTemplate_ApplicationUser_SuccessorId", + table: "MailingTemplate", + column: "SuccessorId", + principalTable: "AspNetUsers", + principalColumn: "Id", + 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_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_DimissClicked_ApplicationUser_UserId", table: "DimissClicked"); + migrationBuilder.DropForeignKey(name: "FK_Instrumentation_Instrument_InstrumentId", table: "Instrumentation"); + migrationBuilder.DropForeignKey(name: "FK_PayPalPayment_ApplicationUser_ExecutorId", table: "PayPalPayment"); + migrationBuilder.DropForeignKey(name: "FK_CircleMember_Circle_CircleId", table: "CircleMember"); + migrationBuilder.DropForeignKey(name: "FK_CircleMember_ApplicationUser_MemberId", table: "CircleMember"); + migrationBuilder.DropForeignKey(name: "FK_Contact_PostalAddress_AddressId", table: "Contact"); + migrationBuilder.DropForeignKey(name: "FK_LiveFlow_ApplicationUser_OwnerId", table: "LiveFlow"); + migrationBuilder.DropForeignKey(name: "FK_CommandForm_Activity_ActivityCode", table: "CommandForm"); + 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_UserActivity_Activity_DoesCode", table: "UserActivity"); + migrationBuilder.DropForeignKey(name: "FK_UserActivity_PerformerProfile_UserId", table: "UserActivity"); + migrationBuilder.DropForeignKey(name: "FK_MailingTemplate_ApplicationUser_ManagerId", table: "MailingTemplate"); + migrationBuilder.DropForeignKey(name: "FK_MailingTemplate_ApplicationUser_SuccessorId", table: "MailingTemplate"); + 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.DropColumn(name: "DateCreated", table: "ChatRoom"); + migrationBuilder.DropColumn(name: "DateModified", table: "ChatRoom"); + migrationBuilder.DropColumn(name: "LatestJoinPart", table: "ChatRoom"); + migrationBuilder.DropColumn(name: "UserCreated", table: "ChatRoom"); + migrationBuilder.DropColumn(name: "UserModified", table: "ChatRoom"); + 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_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_DimissClicked_ApplicationUser_UserId", + table: "DimissClicked", + column: "UserId", + principalTable: "AspNetUsers", + 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_PayPalPayment_ApplicationUser_ExecutorId", + table: "PayPalPayment", + column: "ExecutorId", + principalTable: "AspNetUsers", + 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_CircleMember_ApplicationUser_MemberId", + table: "CircleMember", + column: "MemberId", + principalTable: "AspNetUsers", + 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_LiveFlow_ApplicationUser_OwnerId", + table: "LiveFlow", + column: "OwnerId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_CommandForm_Activity_ActivityCode", + table: "CommandForm", + column: "ActivityCode", + principalTable: "Activity", + principalColumn: "Code", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_PerformerProfile_Location_OrganizationAddressId", + table: "PerformerProfile", + column: "OrganizationAddressId", + principalTable: "Location", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_PerformerProfile_ApplicationUser_PerformerId", + table: "PerformerProfile", + column: "PerformerId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + 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_UserActivity_Activity_DoesCode", + table: "UserActivity", + column: "DoesCode", + principalTable: "Activity", + principalColumn: "Code", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_UserActivity_PerformerProfile_UserId", + table: "UserActivity", + column: "UserId", + principalTable: "PerformerProfile", + principalColumn: "PerformerId", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_MailingTemplate_ApplicationUser_ManagerId", + table: "MailingTemplate", + column: "ManagerId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + migrationBuilder.AddForeignKey( + name: "FK_MailingTemplate_ApplicationUser_SuccessorId", + table: "MailingTemplate", + column: "SuccessorId", + principalTable: "AspNetUsers", + principalColumn: "Id", + 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 4c145d59..afb03189 100644 --- a/src/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/src/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs @@ -1,6 +1,8 @@ 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 @@ -544,10 +546,20 @@ namespace Yavsc.Migrations b.Property("Name") .HasAnnotation("MaxLength", 255); + b.Property("DateCreated"); + + b.Property("DateModified"); + + b.Property("LatestJoinPart"); + b.Property("OwnerId"); b.Property("Topic"); + b.Property("UserCreated"); + + b.Property("UserModified"); + b.HasKey("Name"); }); diff --git a/src/Yavsc/Models/ApplicationDbContext.cs b/src/Yavsc/Models/ApplicationDbContext.cs index 33c4dc66..1f0f33e2 100644 --- a/src/Yavsc/Models/ApplicationDbContext.cs +++ b/src/Yavsc/Models/ApplicationDbContext.cs @@ -63,7 +63,9 @@ namespace Yavsc.Models builder.Entity().HasKey(o => new { o.Code, o.CodeScrutin }); builder.Entity().Property(n => n.icon).HasDefaultValue("exclam"); builder.Entity().HasKey(p => new { room = p.ChannelName, user = p.UserId }); - + builder.Entity().HasOne(bl => bl.User); + builder.Entity().HasOne(bl => bl.Owner); + foreach (var et in builder.Model.GetEntityTypes()) { if (et.ClrType.GetInterface("IBaseTrackedEntity") != null) diff --git a/src/Yavsc/Services/MessageServices.cs b/src/Yavsc/Services/MessageServices.cs deleted file mode 100755 index d22650eb..00000000 --- a/src/Yavsc/Services/MessageServices.cs +++ /dev/null @@ -1,8 +0,0 @@ - -namespace Yavsc.Services -{ - // This class is used by the application to send Email and SMS - // when you turn on two-factor authentication in ASP.NET Identity. - // For more details see this link http://go.microsoft.com/fwlink/?LinkID=532713 - -} diff --git a/src/Yavsc/Services/YavscMessageSender.cs b/src/Yavsc/Services/YavscMessageSender.cs index 32d9d2a3..e2986464 100644 --- a/src/Yavsc/Services/YavscMessageSender.cs +++ b/src/Yavsc/Services/YavscMessageSender.cs @@ -47,13 +47,13 @@ namespace Yavsc.Services throw new Exception("Spécifier un expéditeur"); if (userIds == null ) - throw new NotImplementedException("Notify e No user id"); + throw new Exception("Notify e No user id"); MessageWithPayloadResponse response = new MessageWithPayloadResponse(); var raa = userIds.ToArray(); if (raa.Length<1) - throw new NotImplementedException("No GCM reg ids"); + throw new Exception("No dest id"); try { _logger.LogInformation($"Sending to {string.Join(" ",raa)} using signalR : "+JsonConvert.SerializeObject(ev)); @@ -68,30 +68,44 @@ namespace Yavsc.Services var user = _dbContext.Users.FirstOrDefault(u=> u.Id == clientId); if (user==null) { + response.failure++; result.error = "no such user."; continue; } if (!user.EmailConfirmed){ + response.failure++; result.error = "user has not confirmed his email address."; continue; } var body = ev.CreateBody(); + + var mailSent = await _emailSender.SendEmailAsync( + user.UserName, + user.Email, + $"{ev.Sender} (un client) vous demande un rendez-vous", + $"{ev.CreateBody()}\r\n" + ); + var sent = await _emailSender.SendEmailAsync(ev.Sender, user.Email, ev.Topic, body ); - result.message_id = sent.MessageId; if (!sent.Sent) { + result.message_id = sent.MessageId; result.error = sent.ErrorMessage; response.failure++; } else + { + result.message_id = mailSent.MessageId; response.success++; + } } else { // we assume that each hub connected client will handle this signal - hubClient.notify(ev); + result.message_id=hubClient.notify(ev); response.success++; } + results.Add(result); } response.results = results.ToArray(); return response; diff --git a/src/Yavsc/Startup/Startup.OAuth.cs b/src/Yavsc/Startup/Startup.OAuth.cs index ace105fa..63ed6852 100644 --- a/src/Yavsc/Startup/Startup.OAuth.cs +++ b/src/Yavsc/Startup/Startup.OAuth.cs @@ -129,7 +129,6 @@ namespace Yavsc { options.AutomaticAuthenticate = true; options.ExpireTimeSpan = TimeSpan.FromMinutes (5); options.LoginPath = new PathString (Constants.LoginPath.Substring (1)); - // TODO implement an access denied page options.AccessDeniedPath = new PathString (Constants.LoginPath.Substring (1)); }); diff --git a/src/Yavsc/Views/Home/Chat.cshtml b/src/Yavsc/Views/Home/Chat.cshtml index 2379344c..2ea78f1e 100644 --- a/src/Yavsc/Views/Home/Chat.cshtml +++ b/src/Yavsc/Views/Home/Chat.cshtml @@ -1,59 +1,23 @@ @{ ViewBag.Title = "Chat"; } -

Chat

+

@ViewBag.Title

+ -
- -
- Salons -
    -
  • -
- Utilisateurs -
    -
-
    -
-
-
-
-
-
-
- -
-
- @if (ViewBag.IsAuthenticated) { -
-
-
-
- -
-
- -
-
- } - -
-
-
+
@section scripts { - @if (!ViewBag.IsAuthenticated) { // Get the user name and store it to prepend to messages. } + } - - diff --git a/src/Yavsc/wwwroot/js/chat.js b/src/Yavsc/wwwroot/js/chat.js index e84745a0..53a963c6 100644 --- a/src/Yavsc/wwwroot/js/chat.js +++ b/src/Yavsc/wwwroot/js/chat.js @@ -1,184 +1,303 @@ +(function ($) { - var pvuis +/* +# chat control ids - var audio = new Audio('/sounds/bell.mp3') +## inputs - function addULI (uname, cxids) { - $('
  • ') - .data('name', uname) - .data('cxids', cxids) - .css('cursor', 'pointer') - .click(function () { setPrivate(this); }) - .appendTo('#userlist') - } +* msg_ : input providing a room message +* pv_ : input providing a private message +* command : input providing server command +* roomname : input (hidden or not) providing a room name - function getUsers () { - $('#userlist').empty() - $('#to').empty() - $.get('/api/chat/users').done( - function (users) { - $.each(users, function () { - var user = this - var existent = $('#userlist li').filterByData('name', user.UserName) - if (existent.length > 0) existent.remove() - var cxids = [] - $.each(user.Connections, function () { - cxids.push(this.ConnectionId) - }) - addULI(user.UserName, cxids) - }) +## persistent containers + +* chatview : the global container +* rooms : container from room displays +* pvs : container from pv displays +* server : container for server messages + +## temporary containers + +* room_ : room message list +* pv_ : private discussion display + +## css classes + +* form-control +* btn btn-default + +*/ + + var ChatView = function ($view, full) + { + + if (!full) throw "not implemented"; + + var chat = $.connection.chatHub + // Create a function that the hub can call back to display messages. + chat.client.addMessage = function (name, room, message) { + // Add the message to the page. + $('#room_'+room).append('
  • ' + htmlEncode(name) + + ': ' + htmlEncode(message) + '
  • ') + } + + chat.client.addPV = function (name, message) { + if (!$('#mute').prop('checked')) { + audio.play() } - ) - } - - function onCx () { - setTimeout(function () { - getUsers() - }, 120), - $('#chatview').removeClass('disabled') - $('#sendmessage').prop('disabled',false); - $('#sendpv').prop('disabled',false); - } - function onDisCx () { - $('#chatview').addClass('disabled'); - $('#sendmessage').prop('disabled',true); - $('#sendpv').prop('disabled',true); - - } - // This optional function html-encodes messages for display in the page. - function htmlEncode (value) { - var encodedValue = $('
    ').text(value).html() - return encodedValue - } - - var setPrivate = function (li) { - $('#sendmessagebox').addClass('hidden') - $('#sendpvbox').removeClass('hidden') - pvuis = { CXs: $(li).data('cxids'), UserName: $(li).data('name') } - $('#sendpvdest').html(pvuis.UserName) - $('#pv').focus() - } - var setPublic = function () { - $('#sendmessagebox').removeClass('hidden') - $('#sendpvbox').addClass('hidden') - $('#message').focus() - } - $('#pubChan').css('cursor', 'pointer') - $('#pubChan').click(setPublic) - setPublic() - // Reference the auto-generated proxy for the hub. - var chat = $.connection.chatHub - // Create a function that the hub can call back to display messages. - chat.client.addMessage = function (name, message) { - // Add the message to the page. - $('#discussion').append('
  • ' + htmlEncode(name) - + ': ' + htmlEncode(message) + '
  • ') - } - chat.client.addPV = function (name, message) { - if (!$('#mute').prop('checked')) { - audio.play() - } - // Add the pv to the page. - $('#discussion').append('
  • ' + htmlEncode(name) - + ': ' + htmlEncode(message) + '
  • ') - } - $.fn.filterByData = function (prop, val) { - return this.filter( - function () { return $(this).data(prop) == val; } - ) - } - - var onUserDisconnected = function (cxid) { - $('#userlist li').filter(function () { - var nids = $(this).data('cxids').filter(function () { - return $(this) !== cxid - }) - if (nids.Length == 0) $(this).remove() - else $(this).data('cxids', nids) - }) - } - var onUserConnected = function (cxid, username) { - var connected = $('#userlist li').filterByData('name', username) - if (connected.length > 0) { - var ids = connected.data('cxids') - ids.push(cxid) - connected.data('cxids', ids) - } else { - addULI(username, [cxid]) - } - } - chat.client.notify = function (tag, message, data) { - if (data) { // Add the pv to the page. - - if (tag === 'connected') { - onUserConnected(message, data) - $('#discussion').append('
  • ' + htmlEncode(tag) - + ' ' + htmlEncode(data) + '
  • ') - } - else if (tag === 'disconnected') { - onUserDisconnected(message, data) - $('#discussion').append('
  • ' + htmlEncode(tag) - + ' ' + htmlEncode(data) + '
  • ') - }else { - $('#discussion').append('
  • ' + htmlEncode(tag) - + ' ' + htmlEncode(message) + ' : ' + htmlEncode(data) + '
  • ') + $('#pv_'+name).append('
  • ' + htmlEncode(name) + + ': ' + htmlEncode(message) + '
  • ') + } + chat.client.notify = function (tag, message, data) { + if (data) { + // Add the notification to the page. + if (tag === 'connected') { + onUserConnected(ulist, message, data) + $('#notifications').append('
  • ' + htmlEncode(tag) + + ' ' + htmlEncode(data) + '
  • ') + } + else if (tag === 'disconnected') { + onUserDisconnected(ulist, message, data) + $('#notifications').append('
  • ' + htmlEncode(tag) + + ' ' + htmlEncode(data) + '
  • ') + } // reconnected userpart userjoin deniedpv + else { + $('#notifications').append('
  • ' + htmlEncode(tag) + + ' ' + htmlEncode(message) + ' : ' + htmlEncode(data) + '
  • ') + } } } - } + + chat.client.onJoined = function (rinfo) + { + console.log(rinfo); + $('#inp_'+rinfo.Name).prop('enable',true) + + } - var sendMessage = function () { - chat.server.send($('#displayname').val(), $('#message').val()) - // Clear text box and reset focus for next comment. - $('#message').val('') - } + $.fn.filterByData = function (prop, val) { + return this.filter( + function () { return $(this).data(prop) == val; } + ) + } - var sendPV = function () { - var msg = $('#pv').val() - // Call the Send method on the hub. - $.each(pvuis.CXs, function () { - chat.server.sendPV(this, msg) + var roomlist = $("
    "); + + roomlist.appendTo($view); + + var buildRoom = function (room) + { + console.log('building:'+room); + + var roomTag = $(""+room+""); + roomTag.addClass('btn').addClass('default') + .click(function(){ + setRoom(room) + }); + + var roomview = $("
    "); + + roomTag.appendTo(roomlist); + roomview.prop('id',"vroom_"+room); + var msglist = $("
      "); + msglist.prop('id',"room_"+room); + msglist.appendTo(roomview); + + $("") + .prop('id','inp_'+room) + .prop('enable',false) + .prop('hint','hello') + .prop('title','send to '+room) + .keydown(function(ev){ + if (ev.which == 13) { + console.log('sending:'+room+' '+this.value); + chat.server.send(room, this.value) + this.value="" + } + }).appendTo(roomview); + chans.push(room); + roomview.appendTo($view); + console.log('done with built:'); + console.log(chans); + } + + // build a channel list + var chans = Array(); + + $view.data("chans").split(",").forEach(function(chan) { + buildRoom(chan) + }); + + + function onCx () { + setTimeout(function () { + getUsers() + }, 120), + $('#chatview').removeClass('disabled'); + + chans.forEach(function(room) { + chat.server.join(room); + }) + } + + function onDisCx () { + $('#chatview').addClass('disabled'); + } + + // Start the connection. + $.connection.hub.start().done(function () { + onCx() }) - $('#discussion').append('
    • ' + htmlEncode(pvuis.UserName) - + '<< ' + htmlEncode(msg) + '
    • ') - // Clear text box and reset focus for next comment. - $('#pv').val('') - } - // Start the connection. - $.connection.hub.start().done(function () { - onCx() - $('#sendmessage').click(function () { - // Call the Send method on the hub. - sendMessage() - $('#message').focus() + $.connection.hub.disconnected(function () { + onDisCx() + setTimeout(function () { + $.connection.hub.start().done(function () { + // $('#mySignalRConnectionIdHidden').val($.connection.hub.id) + onCx() + }, 30000); // Re-start connection after 30 seconds + }) }) - $('#message').keydown(function (event) { + + $("") + .appendTo($view); + var chanName = $(""); + chanName.appendTo($view); + + + chanName.keydown( + function (event) { if (event.which == 13) { - sendMessage() + buildRoom(this.value); + this.value="" + } else { + // TODO showRoomInfo(this.value); } - }) + }); + + var ulist = $("
        ").addClass('userlist'); + + ulist.appendTo($view); + + var activeRoom; + var setRoom = function(room) { + if (activeRoom) { + // TODO animate + activeRoom.addClass("hidden"); + } + activeRoom=$("#vroom_"+room); + activeRoom.removeClass("hidden") + } + var pvuis + // TODO get this data from the chatview element + var audio = new Audio('/sounds/bell.mp3') + + var sendPV = function () { + var msg = $('#pv').val() + // Call the Send method on the hub. + $.each(pvuis.CXs, function () { + chat.server.sendPV(this, msg) + }) + $('#discussion').append('
      • ' + htmlEncode(pvuis.UserName) + + '<< ' + htmlEncode(msg) + '
      • ') + // Clear text box and reset focus for next comment. + $('#pv').val('') + } + $('#pv').keydown(function (event) { if (event.which == 13) { sendPV() } }) - $('#sendpv').click(function () { - // Call the Send method on the hub. - sendPV() - $('#sendpv').focus() - }) - }) - $.connection.hub.disconnected(function () { - onDisCx() - setTimeout(function () { - $.connection.hub.start().done(function () { - $('#mySignalRConnectionIdHidden').val($.connection.hub.id) - onCx() - }, 30000); // Re-start connection after 30 seconds + $('#command').keydown(function (event) { + if (event.which == 13) { + sendCommand() + } }) - }) - $(window).unload(function () { chat.server.abort(); }) + function addChatUser (ulist, uname, cxids) { + $('
      • ' + uname + '
      • ') + .data('name', uname) + .data('cxids', cxids) + .css('cursor', 'pointer') + .click(function () { setPrivateTarget(this); }) + .appendTo(ulist) + } + + + function getUsers (ulist) { + $('#userlist').empty() + $('#to').empty() + $.get('/api/chat/users').done( + function (users) { + $.each(users, function () { + var user = this + var existent = $('#userlist li').filterByData('name', user.UserName) + if (existent.length > 0) existent.remove() + var cxids = [] + $.each(user.Connections, function () { + cxids.push(this.ConnectionId) + }) + addChatUser(ulist,user.UserName, cxids) + }) + } + ) + } + + + // This optional function html-encodes messages for display in the page. + function htmlEncode (value) { + var encodedValue = $('
        ').text(value).html() + return encodedValue + } + + var setPrivateTarget = function (li) { + $('#rooms').addClass('hidden') + $('#sendpvbox').removeClass('hidden') + pvuis = { CXs: $(li).data('cxids'), UserName: $(li).data('name') } + $('#sendpvdest').html(pvuis.UserName) + $('#pvs').focus() + } + var setPublic = function () { + $('#rooms').removeClass('hidden') + $('#sendpvbox').addClass('hidden') + $('#message').focus() + } + $('#pubChan').css('cursor', 'pointer') + $('#pubChan').click(setPublic) + setPublic() + // Reference the auto-generated proxy for the hub. + + + var onUserDisconnected = function (cxid) { + $('#userlist li').filter(function () { + var nids = $(this).data('cxids').filter(function () { + return $(this) !== cxid + }); + if (nids.length==0) $(this).remove() + else $(this).data('cxids', nids) + }) + } + + var onUserConnected = function (ulist, cxid, username) { + var connected = $('#userlist li').filterByData('name', username) + if (connected.length > 0) { + var ids = connected.data('cxids') + ids.push(cxid) + connected.data('cxids', ids) + } else { + addChatUser(ulist, username, [cxid]) + } + } + + $(window).unload(function () { chat.server.abort(); }) + + } + + $(document).ready(function($){ + ChatView($('#chatview'),true); + }); + })(jQuery); \ No newline at end of file diff --git a/src/Yavsc/wwwroot/js/parallax.js b/src/Yavsc/wwwroot/js/parallax.js index 4dce2d3c..2e79c1b0 100644 --- a/src/Yavsc/wwwroot/js/parallax.js +++ b/src/Yavsc/wwwroot/js/parallax.js @@ -26,6 +26,9 @@ $(document).ready(function($){ var $stheight = $(window).height(); var onPos = function (bgobj,ax,ay) { + // save pos for scrolling + tiltLR=ax; + titleFB=ay; var speed = bgobj.data('speed'); var dx=($window.scrollLeft()+ax-$stwidth/2)/speed; var dy=($window.scrollTop()+ay-$stheight/2)/speed; @@ -83,13 +86,9 @@ $(document).ready(function($){ if (window.DeviceOrientationEvent) { if ($stwidth>320 && $stheight>320) { window.addEventListener('deviceorientation', function(event) { - tiltLR = $stwidth*Math.sin(event.gamma*Math.PI/180); - titleFB = $stheight*Math.sin(event.beta*Math.PI/90); - onPos($bgobj,tiltLR,titleFB); + onPos($bgobj,$stwidth*Math.sin(event.gamma*Math.PI/180),$stheight*Math.sin(event.beta*Math.PI/90)); },false); } $(window).mousemove(function(e) { - tiltLR = e.pageX; - titleFB = e.pageY; onPos($bgobj,e.pageX,e.pageY); }); }