Skip to content

Commit

Permalink
resolve #579; resolve #580; resolve #578; resolve #581; resolve #582; r…
Browse files Browse the repository at this point in the history
…esolve #585; fix #577; fix #583; fix #584;
  • Loading branch information
anobaka committed Oct 5, 2024
1 parent 92a4343 commit 9898050
Show file tree
Hide file tree
Showing 318 changed files with 8,279 additions and 7,982 deletions.
17 changes: 17 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
## [1.9.0-beta8](https://cdn-public.anobaka.com/app/bakabase/inside-world/1.9.0-beta8/installer/Bakabase.InsideWorld.zip) (2024-10-07)

### Features

* 扩大资源列表页中资源播放按钮和菜单的点击区域 ([#579](https://github.com/anobaka/InsideWorld/issues/579))
* 在资源有多个可播放文件时,显示完整的文件名 ([#580](https://github.com/anobaka/InsideWorld/issues/580))
* 屏蔽部分数据库错误 ([#578](https://github.com/anobaka/InsideWorld/issues/578))
* 增加资源列表封面的展示模式:填充空余部分 ([#581](https://github.com/anobaka/InsideWorld/issues/581))
* 将日期时间编辑器变更为24小时制 ([#582](https://github.com/anobaka/InsideWorld/issues/582))
* 资源搜索条件增加【分类】 ([#585](https://github.com/anobaka/InsideWorld/issues/585))

### Bug Fixes

* 在资源列表页更改资源列数后单个资源高度未更新 ([#577](https://github.com/anobaka/InsideWorld/issues/577))
* 在编辑数字类自定义属性时,按下回车或使其失去焦点未能触发保存操作 ([#583](https://github.com/anobaka/InsideWorld/issues/583))
* 编辑标签数据时无法多选 ([#584](https://github.com/anobaka/InsideWorld/issues/584))

## [1.9.0-beta7](https://cdn-public.anobaka.com/app/bakabase/inside-world/1.9.0-beta7/installer/Bakabase.InsideWorld.zip) (2024-09-23)

### Features
Expand Down
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
| 版本 | 发布时间 | 下载地址 | 更新说明 |
| ------------- | ------------- | ------------- | ------------- |
| [v2.0.0](https://github.com/anobaka/InsideWorld/milestone/51) | 2024 ETA | / | / |
| [v1.9.0-beta8](./CHANGELOG.md) | 2024-10-07 | [下载](https://cdn-public.anobaka.com/app/bakabase/inside-world-dev-test/1.9.0-beta8/installer/Bakabase.zip) | [1.9.0以前的版本升级前必看](/guide/v190/v1.9.0) |
| [v1.9.0-beta7](./CHANGELOG.md) | 2024-09-23 | [下载](https://cdn-public.anobaka.com/app/bakabase/inside-world-dev-test/1.9.0-beta7/installer/Bakabase.zip) | [1.9.0以前的版本升级前必看](/guide/v190/v1.9.0) |
| [v1.9.0-beta6](./CHANGELOG.md) | 2024-09-13 | [下载](https://cdn-public.anobaka.com/app/bakabase/inside-world-dev-test/1.9.0-beta6/installer/Bakabase.zip) | [1.9.0以前的版本升级前必看](/guide/v190/v1.9.0) |
| [v1.9.0-beta5](./CHANGELOG.md) | 2024-09-12 | [下载](https://cdn-public.anobaka.com/app/bakabase/inside-world-dev-test/1.9.0-beta5/installer/Bakabase.zip) | [1.9.0以前的版本升级前必看](/guide/v190/v1.9.0) |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Threading.Tasks;
using Bakabase.Abstractions.Models.Domain;
using Bakabase.Abstractions.Services;
using Bakabase.InsideWorld.Business.Components;
using Bakabase.InsideWorld.Business.Components.BulkModification.Abstractions;
using Bakabase.InsideWorld.Business.Components.BulkModification.Abstractions.Models;
using Bakabase.InsideWorld.Business.Components.BulkModification.Abstractions.Models.Dtos;
Expand Down
71 changes: 35 additions & 36 deletions src/Bakabase.Service/Controllers/CustomPropertyController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@
using Bakabase.InsideWorld.Models.Constants;
using Bakabase.InsideWorld.Models.Constants.AdditionalItems;
using Bakabase.InsideWorld.Models.Models.Aos;
using Bakabase.Modules.CustomProperty.Abstractions.Components;
using Bakabase.Modules.CustomProperty.Abstractions.Configurations;
using Bakabase.Modules.CustomProperty.Abstractions.Models.Domain.Constants;
using Bakabase.Modules.CustomProperty.Abstractions.Services;
using Bakabase.Modules.CustomProperty.Components;
using Bakabase.Modules.CustomProperty.Extensions;
using Bakabase.Modules.CustomProperty.Models.Input;
using Bakabase.Modules.CustomProperty.Models.View;
using Bakabase.Modules.Property.Abstractions.Components;
using Bakabase.Modules.Property.Abstractions.Services;
using Bakabase.Modules.Property.Components;
using Bakabase.Modules.Property.Extensions;
using Bakabase.Modules.Property.Models.Input;
using Bakabase.Modules.Property.Models.View;
using Bakabase.Modules.StandardValue.Abstractions.Components;
using Bakabase.Modules.StandardValue.Abstractions.Configurations;
using Bakabase.Modules.StandardValue.Abstractions.Models.Domain.Constants;
Expand All @@ -26,6 +24,8 @@
using Bakabase.Modules.StandardValue.Models.Domain;
using Bakabase.Modules.StandardValue.Models.View;
using Bakabase.Modules.StandardValue.Services;
using Bakabase.Service.Extensions;
using Bakabase.Service.Models.View;
using Bootstrap.Extensions;
using Bootstrap.Models.ResponseModels;
using Microsoft.AspNetCore.Mvc;
Expand All @@ -37,26 +37,30 @@ namespace Bakabase.Service.Controllers
public class CustomPropertyController(
ICustomPropertyService service,
ICustomPropertyValueService propertyValueService,
ICustomPropertyDescriptors customPropertyDescriptors,
IStandardValueService standardValueService,
IStandardValueLocalizer standardValueLocalizer
IStandardValueLocalizer standardValueLocalizer,
IPropertyLocalizer propertyLocalizer
)
: Controller
{
[HttpGet("all")]
[SwaggerOperation(OperationId = "GetAllCustomProperties")]
public async Task<ListResponse<CustomProperty>> GetAll(
public async Task<ListResponse<CustomPropertyViewModel>> GetAll(
CustomPropertyAdditionalItem additionalItems = CustomPropertyAdditionalItem.None)
{
return new ListResponse<CustomProperty>(await service.GetAll(null, additionalItems, false));
var cps = await service.GetAll(null, additionalItems, false);
var vms = cps.Select(c => c.ToViewModel(propertyLocalizer)).ToList();
return new ListResponse<CustomPropertyViewModel>(vms);
}

[HttpGet("ids")]
[SwaggerOperation(OperationId = "GetCustomPropertyByKeys")]
public async Task<ListResponse<CustomProperty>> GetByKeys(int[] ids,
public async Task<ListResponse<CustomPropertyViewModel>> GetByKeys(int[] ids,
CustomPropertyAdditionalItem additionalItems = CustomPropertyAdditionalItem.None)
{
return new ListResponse<CustomProperty>(await service.GetByKeys(ids, additionalItems, false));
var cps = await service.GetByKeys(ids, additionalItems, false);
var vms = cps.Select(c => c.ToViewModel(propertyLocalizer)).ToList();
return new ListResponse<CustomPropertyViewModel>(vms);
}

[HttpPost]
Expand All @@ -83,7 +87,7 @@ public async Task<BaseResponse> Remove(int id)
[HttpPost("{sourceCustomPropertyId:int}/{targetType}/conversion-preview")]
[SwaggerOperation(OperationId = "PreviewCustomPropertyTypeConversion")]
public async Task<SingletonResponse<CustomPropertyTypeConversionPreviewViewModel>> PreviewTypeConversion(
int sourceCustomPropertyId, CustomPropertyType targetType)
int sourceCustomPropertyId, PropertyType targetType)
{
return new SingletonResponse<CustomPropertyTypeConversionPreviewViewModel>(
await service.PreviewTypeConversion(sourceCustomPropertyId, targetType));
Expand All @@ -99,14 +103,14 @@ public async Task<SingletonResponse<
Dictionary<int, Dictionary<int, List<StandardValueConversionRuleViewModel>>>>>
GetConversionRules()
{
var customPropertyTypes = SpecificEnumUtils<CustomPropertyType>.Values;
var customPropertyTypes = SpecificEnumUtils<PropertyType>.Values;
var ruleMap = customPropertyTypes.ToDictionary(v => (int) v, v => customPropertyTypes.ToDictionary(
d => (int) d,
d =>
{
var fromStdType = customPropertyDescriptors[(int) v].BizValueType;
var toStdType = customPropertyDescriptors[(int) d].BizValueType;
var rulesFlag = StandardValueOptions.ConversionRules[fromStdType][toStdType];
var fromStdType = PropertyInternals.DescriptorMap[v].BizValueType;
var toStdType = PropertyInternals.DescriptorMap[d].BizValueType;
var rulesFlag = StandardValueInternals.ConversionRules[fromStdType][toStdType];
return SpecificEnumUtils<StandardValueConversionRule>.Values.Select(x =>
{
if (!rulesFlag.HasFlag(x))
Expand All @@ -128,7 +132,7 @@ public async Task<SingletonResponse<

[HttpPut("{id:int}/{type}")]
[SwaggerOperation(OperationId = "ChangeCustomPropertyType")]
public async Task<BaseResponse> ChangeType(int id, CustomPropertyType type)
public async Task<BaseResponse> ChangeType(int id, PropertyType type)
{
return await service.ChangeType(id, type);
}
Expand All @@ -145,21 +149,17 @@ public async Task<BaseResponse> EnableAddingNewDataDynamically(int id)
public async Task<SingletonResponse<int>> GetValueUsage(int id, [FromQuery] string value)
{
var property = await service.GetByKey(id);
if (!property.EnumType.IsReferenceValueType())
if (!property.Type.IsReferenceValueType())
{
return new(data: 0);
}

var values = await propertyValueService.GetAll(x => x.PropertyId == id,
CustomPropertyValueAdditionalItem.None, false);
var pd = customPropertyDescriptors[property.Type];
var count = values.Count(v => pd.IsMatch(v, new ResourceSearchFilter
{
DbValue = value.SerializeAsStandardValue(StandardValueType.String),
Operation = property.EnumType == CustomPropertyType.SingleChoice
? SearchOperation.Equals
: SearchOperation.Contains
}));
var psh = PropertyInternals.PropertySearchHandlerMap[property.Type];
var count = values.Count(v => psh.IsMatch(v, property.Type == PropertyType.SingleChoice
? SearchOperation.Equals
: SearchOperation.Contains, value));

return new(data: count);
}
Expand All @@ -169,7 +169,7 @@ public async Task<SingletonResponse<int>> GetValueUsage(int id, [FromQuery] stri
public async Task<SingletonResponse<CustomPropertyTypeConversionExampleViewModel>>
CheckTypeConversionOverview()
{
var testData = StandardValueOptions.ExpectedConversions.SelectMany(x =>
var testData = StandardValueInternals.ExpectedConversions.SelectMany(x =>
(x.Key.GetCompatibleCustomPropertyTypes() ?? []).SelectMany(cpt =>
x.Value.SelectMany(y => y.Value.Select(z => z.FromValue).Distinct().Select(a =>
new CustomPropertyTypeConversionExampleInputModel.T()
Expand All @@ -182,7 +182,7 @@ public async Task<SingletonResponse<CustomPropertyTypeConversionExampleViewModel

foreach (var @in in testData)
{
var inPropertyDescriptor = customPropertyDescriptors[(int) @in.Type];
var inPropertyDescriptor = PropertyInternals.DescriptorMap[@in.Type];

var valueResult = new CustomPropertyTypeConversionExampleViewModel.Tin
{
Expand All @@ -192,22 +192,21 @@ public async Task<SingletonResponse<CustomPropertyTypeConversionExampleViewModel
BizValueType = inPropertyDescriptor.BizValueType
};

var fakeInProperty = inPropertyDescriptor.ToDomainModel(new Abstractions.Models.Db.CustomProperty()
{Type = (int) @in.Type})!;
var fakeInProperty = new Property(PropertyPool.Custom, 0, @in.Type);
fakeInProperty.SetAllowAddingNewDataDynamically(true);

var inBizValue = @in.SerializedBizValue?.DeserializeAsStandardValue(inPropertyDescriptor.BizValueType);

foreach (var outType in SpecificEnumUtils<CustomPropertyType>.Values)
foreach (var outType in SpecificEnumUtils<PropertyType>.Values)
{
if (@in.Type == CustomPropertyType.Number && outType == CustomPropertyType.SingleLineText)
if (@in.Type == PropertyType.Number && outType == PropertyType.SingleLineText)
{

}

var outBizType = outType.GetBizValueType();
var nv =
await standardValueService.Convert(inBizValue, fakeInProperty.BizValueType,
await standardValueService.Convert(inBizValue, fakeInProperty.Type.GetBizValueType(),
outBizType);

valueResult.Outputs.Add(new CustomPropertyTypeConversionExampleViewModel.Tout
Expand Down
3 changes: 2 additions & 1 deletion src/Bakabase.Service/Controllers/DashboardController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
using System.Linq;
using System.Threading.Tasks;
using Bakabase.Abstractions.Services;
using Bakabase.InsideWorld.Business.Components;
using Bakabase.InsideWorld.Business.Components.ThirdParty.Services;
using Bakabase.InsideWorld.Business.Services;
using Bakabase.InsideWorld.Models.Configs;
using Bakabase.InsideWorld.Models.Constants.AdditionalItems;
using Bakabase.InsideWorld.Models.Models.Dtos;
using Bakabase.Modules.Alias.Abstractions.Services;
using Bakabase.Modules.CustomProperty.Abstractions.Services;
using Bakabase.Modules.Property.Abstractions.Services;
using Bakabase.Modules.ThirdParty.Abstractions.Http;
using Bootstrap.Components.Configuration.Abstractions;
using Bootstrap.Extensions;
Expand Down
8 changes: 5 additions & 3 deletions src/Bakabase.Service/Controllers/EnhancementController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
using System.Threading;
using System.Threading.Tasks;
using Bakabase.Abstractions.Services;
using Bakabase.InsideWorld.Business.Components;
using Bakabase.InsideWorld.Models.Constants.AdditionalItems;
using Bakabase.Modules.Enhancer.Abstractions.Components;
using Bakabase.Modules.Enhancer.Abstractions.Models.Domain.Constants;
using Bakabase.Modules.Enhancer.Abstractions.Services;
using Bakabase.Modules.Enhancer.Models.View;
using Bakabase.Service.Extensions;
using Bakabase.Service.Models.View;
using Bootstrap.Components.Miscellaneous.ResponseBuilders;
using Bootstrap.Models.ResponseModels;
using Humanizer.Localisation;
Expand Down Expand Up @@ -65,15 +67,15 @@ public async Task<ListResponse<ResourceEnhancements>> GetResourceEnhancementReco
var e = es.FirstOrDefault(e => e.Target == targetId);
return new ResourceEnhancements.TargetEnhancement
{
Enhancement = e,
Enhancement = e?.ToViewModel(),
Target = targetId,
TargetName = t.Name
};
}).ToArray(),
DynamicTargets = ed.Targets.Where(x => x.IsDynamic).Select(t =>
{
var targetId = Convert.ToInt32(t.Id);
var e = es.Where(e => e.Target == targetId).ToList();
var e = es.Where(e => e.Target == targetId).Select(e => e.ToViewModel()).ToList();
return new ResourceEnhancements.DynamicTargetEnhancements()
{
Enhancements = e,
Expand Down
6 changes: 4 additions & 2 deletions src/Bakabase.Service/Controllers/OptionsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
using Bakabase.InsideWorld.Business.Components.Dependency.Implementations.FfMpeg;
using Bakabase.InsideWorld.Business.Configurations;
using Bakabase.InsideWorld.Business.Configurations.Models.Domain;
using Bakabase.InsideWorld.Business.Configurations.Models.Input;
using Bakabase.InsideWorld.Business.Extensions;
using Bakabase.InsideWorld.Models.Configs;
using Bakabase.InsideWorld.Models.RequestModels;
using Bakabase.InsideWorld.Models.RequestModels.Options;
using Bakabase.Modules.Property.Extensions;
using Bakabase.Service.Extensions;
using Bakabase.Service.Models.Input;
using Bootstrap.Components.Configuration.Abstractions;
using Bootstrap.Components.Miscellaneous.ResponseBuilders;
using Bootstrap.Extensions;
Expand Down Expand Up @@ -422,7 +424,7 @@ await _insideWorldOptionsManager.Resource.SaveAsync(options =>

if (model.SearchCriteria != null)
{
options.LastSearchV2 = model.SearchCriteria;
options.LastSearchV2 = model.SearchCriteria.ToDbModel();
}

});
Expand Down
1 change: 1 addition & 0 deletions src/Bakabase.Service/Controllers/PlayListController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using System.Threading.Tasks;
using Bakabase.Abstractions.Services;
using Bakabase.InsideWorld.Business.Components;
using Bakabase.InsideWorld.Business.Services;
using Bakabase.InsideWorld.Models.Constants.AdditionalItems;
using Bakabase.InsideWorld.Models.Extensions;
Expand Down
22 changes: 17 additions & 5 deletions src/Bakabase.Service/Controllers/PropertyController.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
using System.Threading.Tasks;
using System.Linq;
using System.Threading.Tasks;
using Bakabase.Abstractions.Models.Domain;
using Bakabase.Modules.CustomProperty.Abstractions.Services;
using Bakabase.Abstractions.Models.Domain.Constants;
using Bakabase.Modules.Property.Abstractions.Components;
using Bakabase.Modules.Property.Abstractions.Services;
using Bakabase.Service.Extensions;
using Bakabase.Service.Models.View;
using Bootstrap.Models.ResponseModels;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;

namespace Bakabase.Service.Controllers
{
[Route("~/property")]
public class PropertyController(ICustomPropertyService customPropertyService) : Controller
public class PropertyController(IPropertyService propertyService, IPropertyLocalizer propertyLocalizer) : Controller
{
private ICustomPropertyService _customPropertyService = customPropertyService;
[HttpGet("pool/{pool}")]
[SwaggerOperation(OperationId = "GetPropertiesByPool")]
public async Task<ListResponse<PropertyViewModel>> GetByPool(PropertyPool pool)
{
return new ListResponse<PropertyViewModel>(
(await propertyService.GetProperties(pool)).Select(x => x.ToViewModel(propertyLocalizer)));
}
}
}
}
Loading

0 comments on commit 9898050

Please sign in to comment.