Browse Source

Merge branch 'master' of github.com:Squidex/squidex

pull/596/head
Sebastian 5 years ago
parent
commit
ae78aafbdb
  1. 2
      backend/src/Squidex.Domain.Apps.Entities/Apps/Commands/AppCommand.cs
  2. 2
      backend/src/Squidex.Domain.Apps.Entities/Apps/Commands/AppUpdateCommand.cs
  3. 2
      backend/src/Squidex.Domain.Apps.Entities/Apps/Commands/CreateApp.cs
  4. 2
      backend/src/Squidex.Domain.Apps.Entities/Apps/State/AppState.cs
  5. 2
      backend/src/Squidex.Domain.Apps.Entities/Assets/Commands/AssetCommand.cs
  6. 2
      backend/src/Squidex.Domain.Apps.Entities/Assets/Commands/AssetFolderCommand.cs
  7. 2
      backend/src/Squidex.Domain.Apps.Entities/Assets/State/AssetFolderState.cs
  8. 3
      backend/src/Squidex.Domain.Apps.Entities/Assets/State/AssetState.cs
  9. 2
      backend/src/Squidex.Domain.Apps.Entities/Contents/Commands/ContentCommand.cs
  10. 6
      backend/src/Squidex.Domain.Apps.Entities/Contents/State/ContentState.cs
  11. 3
      backend/src/Squidex.Domain.Apps.Entities/Rules/State/RuleState.cs
  12. 2
      backend/src/Squidex.Domain.Apps.Entities/Schemas/Commands/CreateSchema.cs
  13. 2
      backend/src/Squidex.Domain.Apps.Entities/Schemas/Commands/SchemaUpdateCommand.cs
  14. 2
      backend/src/Squidex.Domain.Apps.Entities/Schemas/State/SchemaState.cs
  15. 16
      backend/src/Squidex/Areas/Api/Controllers/Assets/AssetContentController.cs

2
backend/src/Squidex.Domain.Apps.Entities/Apps/Commands/AppCommand.cs

@ -5,6 +5,7 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Runtime.Serialization;
using Squidex.Infrastructure;
using Squidex.Infrastructure.Commands;
@ -12,6 +13,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Commands
{
public abstract class AppCommand : SquidexCommand, IAggregateCommand
{
[IgnoreDataMember]
public abstract DomainId AggregateId { get; }
}
}

2
backend/src/Squidex.Domain.Apps.Entities/Apps/Commands/AppUpdateCommand.cs

@ -5,6 +5,7 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Runtime.Serialization;
using Squidex.Infrastructure;
namespace Squidex.Domain.Apps.Entities.Apps.Commands
@ -13,6 +14,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Commands
{
public NamedId<DomainId> AppId { get; set; }
[IgnoreDataMember]
public override DomainId AggregateId
{
get { return AppId.Id; }

2
backend/src/Squidex.Domain.Apps.Entities/Apps/Commands/CreateApp.cs

@ -5,6 +5,7 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Runtime.Serialization;
using Squidex.Infrastructure;
using Squidex.Infrastructure.Commands;
@ -18,6 +19,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Commands
public string? Template { get; set; }
[IgnoreDataMember]
public override DomainId AggregateId
{
get { return AppId; }

2
backend/src/Squidex.Domain.Apps.Entities/Apps/State/AppState.cs

@ -6,6 +6,7 @@
// ==========================================================================
using System;
using System.Runtime.Serialization;
using Squidex.Domain.Apps.Core.Apps;
using Squidex.Domain.Apps.Core.Contents;
using Squidex.Domain.Apps.Events.Apps;
@ -46,6 +47,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.State
public bool IsArchived { get; set; }
[IgnoreDataMember]
public DomainId UniqueId
{
get { return Id; }

2
backend/src/Squidex.Domain.Apps.Entities/Assets/Commands/AssetCommand.cs

@ -5,6 +5,7 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Runtime.Serialization;
using Squidex.Infrastructure;
using Squidex.Infrastructure.Commands;
@ -16,6 +17,7 @@ namespace Squidex.Domain.Apps.Entities.Assets.Commands
public DomainId AssetId { get; set; }
[IgnoreDataMember]
public DomainId AggregateId
{
get { return DomainId.Combine(AppId, AssetId); }

2
backend/src/Squidex.Domain.Apps.Entities/Assets/Commands/AssetFolderCommand.cs

@ -5,6 +5,7 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Runtime.Serialization;
using Squidex.Infrastructure;
using Squidex.Infrastructure.Commands;
@ -16,6 +17,7 @@ namespace Squidex.Domain.Apps.Entities.Assets.Commands
public DomainId AssetFolderId { get; set; }
[IgnoreDataMember]
public DomainId AggregateId
{
get { return DomainId.Combine(AppId, AssetFolderId); }

2
backend/src/Squidex.Domain.Apps.Entities/Assets/State/AssetFolderState.cs

@ -5,6 +5,7 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Runtime.Serialization;
using Squidex.Domain.Apps.Events.Assets;
using Squidex.Infrastructure;
using Squidex.Infrastructure.Commands;
@ -23,6 +24,7 @@ namespace Squidex.Domain.Apps.Entities.Assets.State
public DomainId ParentId { get; set; }
[IgnoreDataMember]
public DomainId UniqueId
{
get { return DomainId.Combine(AppId, Id); }

3
backend/src/Squidex.Domain.Apps.Entities/Assets/State/AssetState.cs

@ -6,6 +6,7 @@
// ==========================================================================
using System.Collections.Generic;
using System.Runtime.Serialization;
using Squidex.Domain.Apps.Core.Assets;
using Squidex.Domain.Apps.Events.Assets;
using Squidex.Infrastructure;
@ -45,11 +46,13 @@ namespace Squidex.Domain.Apps.Entities.Assets.State
public AssetType Type { get; set; }
[IgnoreDataMember]
public DomainId AssetId
{
get { return Id; }
}
[IgnoreDataMember]
public DomainId UniqueId
{
get { return DomainId.Combine(AppId, Id); }

2
backend/src/Squidex.Domain.Apps.Entities/Contents/Commands/ContentCommand.cs

@ -5,6 +5,7 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Runtime.Serialization;
using Squidex.Infrastructure;
using Squidex.Infrastructure.Commands;
@ -20,6 +21,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Commands
public bool DoNotScript { get; set; }
[IgnoreDataMember]
public DomainId AggregateId
{
get { return DomainId.Combine(AppId, ContentId); }

6
backend/src/Squidex.Domain.Apps.Entities/Contents/State/ContentState.cs

@ -5,6 +5,7 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Runtime.Serialization;
using Squidex.Domain.Apps.Core.Contents;
using Squidex.Domain.Apps.Events.Contents;
using Squidex.Infrastructure;
@ -27,26 +28,31 @@ namespace Squidex.Domain.Apps.Entities.Contents.State
public ScheduleJob? ScheduleJob { get; set; }
[IgnoreDataMember]
public DomainId UniqueId
{
get { return DomainId.Combine(AppId, Id); }
}
[IgnoreDataMember]
public NamedContentData Data
{
get { return NewVersion?.Data ?? CurrentVersion.Data; }
}
[IgnoreDataMember]
public Status EditingStatus
{
get { return NewStatus ?? Status; }
}
[IgnoreDataMember]
public Status Status
{
get { return CurrentVersion.Status; }
}
[IgnoreDataMember]
public Status? NewStatus
{
get { return NewVersion?.Status; }

3
backend/src/Squidex.Domain.Apps.Entities/Rules/State/RuleState.cs

@ -5,6 +5,8 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Runtime.Serialization;
using Squidex.Domain.Apps.Core.Rules;
using Squidex.Domain.Apps.Events.Rules;
using Squidex.Infrastructure;
@ -22,6 +24,7 @@ namespace Squidex.Domain.Apps.Entities.Rules.State
public Rule RuleDef { get; set; }
[IgnoreDataMember]
public DomainId UniqueId
{
get { return DomainId.Combine(AppId, Id); }

2
backend/src/Squidex.Domain.Apps.Entities/Schemas/Commands/CreateSchema.cs

@ -6,6 +6,7 @@
// ==========================================================================
using System.Collections.Generic;
using System.Runtime.Serialization;
using Squidex.Domain.Apps.Core.Schemas;
using Squidex.Infrastructure;
using Squidex.Infrastructure.Commands;
@ -39,6 +40,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.Commands
public Dictionary<string, string>? PreviewUrls { get; set; }
[IgnoreDataMember]
public override DomainId AggregateId
{
get { return DomainId.Combine(AppId, SchemaId); }

2
backend/src/Squidex.Domain.Apps.Entities/Schemas/Commands/SchemaUpdateCommand.cs

@ -5,6 +5,7 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Runtime.Serialization;
using Squidex.Infrastructure;
namespace Squidex.Domain.Apps.Entities.Schemas.Commands
@ -13,6 +14,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.Commands
{
public NamedId<DomainId> SchemaId { get; set; }
[IgnoreDataMember]
public override DomainId AggregateId
{
get { return DomainId.Combine(AppId, SchemaId.Id); }

2
backend/src/Squidex.Domain.Apps.Entities/Schemas/State/SchemaState.cs

@ -7,6 +7,7 @@
using System;
using System.Linq;
using System.Runtime.Serialization;
using Squidex.Domain.Apps.Core;
using Squidex.Domain.Apps.Core.Schemas;
using Squidex.Domain.Apps.Events.Schemas;
@ -27,6 +28,7 @@ namespace Squidex.Domain.Apps.Entities.Schemas.State
public long SchemaFieldsTotal { get; set; }
[IgnoreDataMember]
public DomainId UniqueId
{
get { return DomainId.Combine(AppId, Id); }

16
backend/src/Squidex/Areas/Api/Controllers/Assets/AssetContentController.cs

@ -80,7 +80,12 @@ namespace Squidex.Areas.Api.Controllers.Assets
asset = await assetRepository.FindAssetBySlugAsync(AppId, idOrSlug);
}
return await DeliverAssetAsync(asset, queries);
if (asset != null && queries.Version > EtagVersion.Any && asset.Version != queries.Version)
{
asset = await assetLoader.GetAsync(App.Id, asset.Id, queries.Version);
}
return DeliverAsset(asset, queries);
}
/// <summary>
@ -103,10 +108,10 @@ namespace Squidex.Areas.Api.Controllers.Assets
{
var asset = await assetRepository.FindAssetAsync(id);
return await DeliverAssetAsync(asset, queries);
return DeliverAsset(asset, queries);
}
private async Task<IActionResult> DeliverAssetAsync(IAssetEntity? asset, AssetContentQueryDto queries)
private IActionResult DeliverAsset(IAssetEntity? asset, AssetContentQueryDto queries)
{
queries ??= new AssetContentQueryDto();
@ -122,11 +127,6 @@ namespace Squidex.Areas.Api.Controllers.Assets
return StatusCode(403);
}
if (queries.Version > EtagVersion.Any && asset.Version != queries.Version)
{
asset = await assetLoader.GetAsync(App.Id, asset.Id, queries.Version);
}
var resizeOptions = queries.ToResizeOptions(asset);
FileCallback callback;

Loading…
Cancel
Save