ItaM
ItaM
CC#
Created by ItaM on 5/20/2024 in #help
What are you guys take in SOLID?
\ Its injecting an interface with three methods and only using one an anti pattern? Should I bother re-factoring to smaller chunks to make sure I am using all the methods I am injecting? Does solid even matters?
13 replies
CC#
Created by ItaM on 9/21/2023 in #help
❔ Cloduinary API in .NET, something similar to .UploadRange?
No description
15 replies
CC#
Created by ItaM on 9/19/2023 in #help
❔ Setting up cookie auth with .NET 7 Api. HttpContext does not have a definition for SignInAsync
No description
3 replies
CC#
Created by ItaM on 9/12/2023 in #help
❔ SOLVER Ordering messages based on the receiver or sender last message
I have this piece of code
public async Task<List<UserLimitedDto>> GetUsersThatHaveMessagedMe()
{
var (_, _, username) = await _tokenService.DecodeHS512Token();

var users = MessageJoinQuery()
.Where(u => u.Receiver_Username == username)
.GroupBy(u => u.Sender)
.Select(group => group.OrderByDescending(m => m.Timestamp).FirstOrDefault())
.ToList();

return users
.OrderByDescending(m => m.Timestamp)
.Select(u => new UserLimitedDto
{
User_Id = u.Sender_User_Id,
Username = u.Sender_Username,
Profile_Picture = u.Sender_Profile_Picture
})
.ToList();
}
public async Task<List<UserLimitedDto>> GetUsersThatHaveMessagedMe()
{
var (_, _, username) = await _tokenService.DecodeHS512Token();

var users = MessageJoinQuery()
.Where(u => u.Receiver_Username == username)
.GroupBy(u => u.Sender)
.Select(group => group.OrderByDescending(m => m.Timestamp).FirstOrDefault())
.ToList();

return users
.OrderByDescending(m => m.Timestamp)
.Select(u => new UserLimitedDto
{
User_Id = u.Sender_User_Id,
Username = u.Sender_Username,
Profile_Picture = u.Sender_Profile_Picture
})
.ToList();
}
What this does its that it gets a list of Users which meet a certain criteria. I have managed to order them based on the last message that they sent me, and it works pretty well. However, I am unable to order them based on the last message that I (receiver) sent them. It wont get updated
21 replies