Skip to content

Commit 355368f

Browse files
committed
updated image upload command, command handler
1 parent 26ad795 commit 355368f

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

src/Application/UserImages/ImageUpload/UploadUserImageCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ public sealed record UploadUserImageCommand : ICommand<Guid>
77
{
88
public Guid UserId { get; set; }
99
public byte[]? ImageData { get; set; }
10-
// public Uri ImageUrl { get; set; }
10+
public Uri ImageUrl { get; set; } = null!;
1111
}

src/Application/UserImages/ImageUpload/UploadUserImageCommandHandler.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public async Task<Result<Guid>> Handle(UploadUserImageCommand command, Cancellat
3737
Id = Guid.NewGuid(),
3838
UserId = user.Id,
3939
ImageData = command.ImageData,
40+
ImageUrl = command.ImageUrl,
4041
CreatedAt = dateTimeProvider.UtcNow
4142
};
4243

src/Web.Api/Endpoints/UserImages/UploadImageData.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ public void MapEndpoint(IEndpointRouteBuilder app)
4343
var command = new UploadUserImageCommand
4444
{
4545
UserId = request.UserId,
46-
ImageData = memoryStream.ToArray()
46+
ImageData = memoryStream.ToArray(),
47+
ImageUrl = cloudinaryUrl.ToString()
4748
};
4849

4950
Result<Guid> result = await sender.Send(command, cancellationToken);

0 commit comments

Comments
 (0)