Skip to content

Commit

Permalink
add created at in chat response
Browse files Browse the repository at this point in the history
  • Loading branch information
sdcb committed Jan 2, 2025
1 parent b83b76c commit f69862f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/BE/Controllers/Chats/UserChats/Dtos/ChatsResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ public record ChatsResponse

[JsonPropertyName("leafMessageId")]
public required string? LeafMessageId { get; init; }

[JsonPropertyName("createdAt")]
public required DateTime CreatedAt { get; init; }
}

public record ChatSpanDto
Expand Down
3 changes: 3 additions & 0 deletions src/BE/Controllers/Chats/UserChats/UserChatsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public async Task<ActionResult<ChatsResponse>> GetOneChat(string encryptedChatId
EnableSearch = s.EnableSearch,
}).ToArray(),
LeafMessageId = x.LeafMessageId != null ? idEncryption.EncryptMessageId(x.LeafMessageId.Value) : null,
CreatedAt = x.CreatedAt,
})
.FirstOrDefaultAsync(cancellationToken);

Expand Down Expand Up @@ -73,6 +74,7 @@ public async Task<ActionResult<PagedResult<ChatsResponse>>> GetChats([FromQuery]
EnableSearch = s.EnableSearch,
}).ToArray(),
LeafMessageId = x.LeafMessageId != null ? idEncryption.EncryptMessageId(x.LeafMessageId.Value) : null,
CreatedAt = x.CreatedAt,
}),
request,
cancellationToken);
Expand Down Expand Up @@ -145,6 +147,7 @@ public async Task<ActionResult<ChatsResponse>> CreateChat([FromBody] CreateChatR
EnableSearch = s.EnableSearch,
}).ToArray(),
LeafMessageId = chat.LeafMessageId != null ? idEncryption.EncryptMessageId(chat.LeafMessageId.Value) : null,
CreatedAt = chat.CreatedAt,
});
}

Expand Down

0 comments on commit f69862f

Please sign in to comment.