Skip to content

Commit

Permalink
Merge pull request #5 from Vipul1432/feature-giphy-in-chat
Browse files Browse the repository at this point in the history
Adds giphy(GIFs) in user & group chat
  • Loading branch information
Vipul1432 authored Jul 20, 2024
2 parents e7831ed + 485be31 commit aaca9fb
Show file tree
Hide file tree
Showing 9 changed files with 494 additions and 20 deletions.
4 changes: 2 additions & 2 deletions MinimalChat.API/Controllers/MessagesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ public async Task<IActionResult> GetConversationHistoryAsync([FromQuery] Convers
}
// Map group messages
List<GroupMemberDto> groupMemberDtos = null;
if (messages.Members != null)
if (messages?.Members.Count > 0)
{
groupMemberDtos = messages.Members.ToList().ConvertAll(member =>
{
Expand All @@ -293,7 +293,7 @@ public async Task<IActionResult> GetConversationHistoryAsync([FromQuery] Convers
var messageDtos = messages.Messages.Select(message =>
{
var messageDto = _mapper.Map<GetMessagesDto>(message);
if (string.IsNullOrEmpty(messageDto.Content))
if (string.IsNullOrEmpty(messageDto.Content) && string.IsNullOrEmpty(messageDto.GIFUrls))
{
string fileName = message.FilePath;
var filePath = Path.Combine(_applicationSettings.UploadDirectory, fileName);
Expand Down
10 changes: 3 additions & 7 deletions MinimalChat.Domain/DTOs/GetMessagesDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,10 @@ public class GetMessagesDto

[Required]
public string SenderId { get; set; }


public string? ReceiverId { get; set; }
public Guid? GroupId { get; set; }
[Required]
[MaxLength(1000)]
public string Content { get; set; }

public Guid? GroupId { get; set; }
public string? Content { get; set; }
public string? GIFUrls { get; set; }
public string? FilePath { get; set; }
public string? FileName { get; set; }

Expand Down
5 changes: 2 additions & 3 deletions MinimalChat.Domain/DTOs/MessageDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ public class MessageDto

public string? ReceiverId { get; set; }
public Guid? GroupId { get; set; }
[Required]
[MaxLength(1000)]
public string Content { get; set; }
public string? Content { get; set; }
public string? GIFUrls { get; set; }
}
}
1 change: 1 addition & 0 deletions MinimalChat.Domain/DTOs/ResponseMessageDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class ResponseMessageDto
public string SenderId { get; set; }
public string? ReceiverId { get; set; }
public string? Content { get; set; }
public string? GIFUrls { get; set; }
public DateTime Timestamp { get; set; }
public Guid? GroupId { get; set; }
public string? FilePath { get; set; }
Expand Down
1 change: 1 addition & 0 deletions MinimalChat.Domain/Models/Message.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class Message
[Required]
[MaxLength(1000)]
public string? Content { get; set; }
public string? GIFUrls { get; set; }
[Required]
public DateTime Timestamp { get; set; }

Expand Down
Loading

0 comments on commit aaca9fb

Please sign in to comment.