diff --git a/Knots/Hubs/ChatHub.cs b/Knots/Hubs/ChatHub.cs index 0d5da9b..1adf9ef 100644 --- a/Knots/Hubs/ChatHub.cs +++ b/Knots/Hubs/ChatHub.cs @@ -7,39 +7,39 @@ namespace Knots.Hubs; public class ChatHub(KnotsDbContext db, AutoMapper.IMapper mapper) : Hub { // Rejoindre une conversation (room) - public async Task JoinConversation(string conversationId) + public async Task JoinConversation(string discussionId) { - await Groups.AddToGroupAsync(Context.ConnectionId, conversationId); + await Groups.AddToGroupAsync(Context.ConnectionId, discussionId); } // Quitter une conversation - public async Task LeaveConversation(string conversationId) + public async Task LeaveConversation(string discussionId) { - await Groups.RemoveFromGroupAsync(Context.ConnectionId, conversationId); + await Groups.RemoveFromGroupAsync(Context.ConnectionId, discussionId); } // Envoyer un message à une conversation - public async Task SendMessage(string conversationId, string content) + public async Task SendMessage(string discussionId, string content) { var message = new Models.Message { - // adapte aux noms réels de ton modèle (AuthorId, Contenu, Date...) - AuthorId = int.Parse(Context.UserIdentifier!), - Contenu = content, - Date = DateTime.UtcNow, - DiscussionId = int.Parse(conversationId) + Contenu = content, + Date = DateTime.UtcNow, + Type = false, + UserId = int.Parse(Context.UserIdentifier!), + DiscussionId = int.Parse(discussionId) }; db.Messages.Add(message); await db.SaveChangesAsync(); - await Clients.Group(conversationId).SendAsync("ReceiveMessage", message); + await Clients.Group(discussionId).SendAsync("ReceiveMessage", message); } // Notifier que l'utilisateur est en train d'écrire - public async Task Typing(string conversationId) + public async Task Typing(string discussionId) { - await Clients.OthersInGroup(conversationId) + await Clients.OthersInGroup(discussionId) .SendAsync("UserTyping", Context.UserIdentifier); } } \ No newline at end of file diff --git a/Knots/Models/Message.cs b/Knots/Models/Message.cs index f100cf5..ba2d05c 100644 --- a/Knots/Models/Message.cs +++ b/Knots/Models/Message.cs @@ -9,8 +9,6 @@ public class Message [Required] public DateTime Date { get; set; } [Required] public Boolean Type { get; set; } - public int AuthorId { get; set; } - public int UserId { get; set; } public User User { get; set; } = null!; diff --git a/Knots/bin/Debug/net8.0/Knots.dll b/Knots/bin/Debug/net8.0/Knots.dll index ba7ec4c..474a836 100644 Binary files a/Knots/bin/Debug/net8.0/Knots.dll and b/Knots/bin/Debug/net8.0/Knots.dll differ diff --git a/Knots/bin/Debug/net8.0/Knots.exe b/Knots/bin/Debug/net8.0/Knots.exe index ed5d014..52189c6 100644 Binary files a/Knots/bin/Debug/net8.0/Knots.exe and b/Knots/bin/Debug/net8.0/Knots.exe differ diff --git a/Knots/bin/Debug/net8.0/Knots.pdb b/Knots/bin/Debug/net8.0/Knots.pdb index 3c9398e..3c84e73 100644 Binary files a/Knots/bin/Debug/net8.0/Knots.pdb and b/Knots/bin/Debug/net8.0/Knots.pdb differ diff --git a/Knots/obj/Debug/net8.0/Knots.AssemblyInfo.cs b/Knots/obj/Debug/net8.0/Knots.AssemblyInfo.cs index 4243247..c5dd044 100644 --- a/Knots/obj/Debug/net8.0/Knots.AssemblyInfo.cs +++ b/Knots/obj/Debug/net8.0/Knots.AssemblyInfo.cs @@ -13,7 +13,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("Knots")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+4f994ba183ab4a079dd7e762d3b7cacca26f8f75")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e6021dcc619fd4151caff82644b9bda369ef15fd")] [assembly: System.Reflection.AssemblyProductAttribute("Knots")] [assembly: System.Reflection.AssemblyTitleAttribute("Knots")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/Knots/obj/Debug/net8.0/Knots.AssemblyInfoInputs.cache b/Knots/obj/Debug/net8.0/Knots.AssemblyInfoInputs.cache index e2541b2..634f18e 100644 --- a/Knots/obj/Debug/net8.0/Knots.AssemblyInfoInputs.cache +++ b/Knots/obj/Debug/net8.0/Knots.AssemblyInfoInputs.cache @@ -1 +1 @@ -aa1c1119a88f3e3b5738f6ea6f67686474d5c6d7e7b2612859a07f3ee65ef199 +c634a46dc11c9265972dbfd647e5dc8eb04ef78a5549341a950a2b63f97dc490 diff --git a/Knots/obj/Debug/net8.0/Knots.dll b/Knots/obj/Debug/net8.0/Knots.dll index ba7ec4c..474a836 100644 Binary files a/Knots/obj/Debug/net8.0/Knots.dll and b/Knots/obj/Debug/net8.0/Knots.dll differ diff --git a/Knots/obj/Debug/net8.0/Knots.pdb b/Knots/obj/Debug/net8.0/Knots.pdb index 3c9398e..3c84e73 100644 Binary files a/Knots/obj/Debug/net8.0/Knots.pdb and b/Knots/obj/Debug/net8.0/Knots.pdb differ diff --git a/Knots/obj/Debug/net8.0/apphost.exe b/Knots/obj/Debug/net8.0/apphost.exe index ed5d014..52189c6 100644 Binary files a/Knots/obj/Debug/net8.0/apphost.exe and b/Knots/obj/Debug/net8.0/apphost.exe differ diff --git a/Knots/obj/Debug/net8.0/ref/Knots.dll b/Knots/obj/Debug/net8.0/ref/Knots.dll index 5e72baf..78df868 100644 Binary files a/Knots/obj/Debug/net8.0/ref/Knots.dll and b/Knots/obj/Debug/net8.0/ref/Knots.dll differ diff --git a/Knots/obj/Debug/net8.0/refint/Knots.dll b/Knots/obj/Debug/net8.0/refint/Knots.dll index 5e72baf..78df868 100644 Binary files a/Knots/obj/Debug/net8.0/refint/Knots.dll and b/Knots/obj/Debug/net8.0/refint/Knots.dll differ