mirror of https://github.com/Squidex/squidex.git
7 changed files with 139 additions and 78 deletions
@ -0,0 +1,63 @@ |
|||
// ==========================================================================
|
|||
// AssetUpdatedDto.cs
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex Group
|
|||
// All rights reserved.
|
|||
// ==========================================================================
|
|||
|
|||
using System.ComponentModel.DataAnnotations; |
|||
using Squidex.Infrastructure.CQRS.Commands; |
|||
using Squidex.Write.Assets.Commands; |
|||
|
|||
namespace Squidex.Controllers.Api.Assets.Models |
|||
{ |
|||
public sealed class AssetReplacedDto |
|||
{ |
|||
/// <summary>
|
|||
/// The mime type.
|
|||
/// </summary>
|
|||
[Required] |
|||
public string MimeType { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// The size of the file in bytes.
|
|||
/// </summary>
|
|||
public long FileSize { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Determines of the created file is an image.
|
|||
/// </summary>
|
|||
public bool IsImage { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// The width of the image in pixels if the asset is an image.
|
|||
/// </summary>
|
|||
public int? PixelWidth { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// The height of the image in pixels if the asset is an image.
|
|||
/// </summary>
|
|||
public int? PixelHeight { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// The version of the asset.
|
|||
/// </summary>
|
|||
public long Version { get; set; } |
|||
|
|||
public static AssetReplacedDto Create(UpdateAsset command, EntitySavedResult result) |
|||
{ |
|||
var response = new AssetReplacedDto |
|||
{ |
|||
FileSize = command.File.FileSize, |
|||
MimeType = command.File.MimeType, |
|||
IsImage = command.ImageInfo != null, |
|||
PixelWidth = command.ImageInfo?.PixelWidth, |
|||
PixelHeight = command.ImageInfo?.PixelHeight, |
|||
Version = result.Version |
|||
}; |
|||
|
|||
return response; |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue