diff --git a/Directory.Packages.props b/Directory.Packages.props index 0bf3d86..4aa0045 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -2,7 +2,7 @@ true true - 8.1.24 + 8.1.25 4.7.2 @@ -31,18 +31,18 @@ - - - + + + - - - - + + + + - + - + @@ -51,16 +51,16 @@ - - + + - - - + + + - - + + @@ -102,9 +102,9 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Documents/SCRIPTS_PGSQL.md b/Documents/SCRIPTS_PGSQL.md index b0aa356..626f8a4 100644 --- a/Documents/SCRIPTS_PGSQL.md +++ b/Documents/SCRIPTS_PGSQL.md @@ -11,8 +11,7 @@ CREATE TABLE "public"."operate_log" ( "Error" varchar(2000) COLLATE "pg_catalog"."default", "RequestTraceId" varchar(40) COLLATE "pg_catalog"."default" NOT NULL, PRIMARY KEY ("Id") -) -; +); CREATE INDEX "IDX_OPERATE_LOG_MODULE" ON "public"."operate_log" USING btree ( "Module" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST @@ -40,7 +39,7 @@ CREATE TABLE "public"."configuration" ( "CreateTime" timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP, "UpdateTime" timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP, "CreatedBy" varchar(255) COLLATE "pg_catalog"."default" NOT NULL, - "UpdatedBy" date NOT NULL, + "UpdatedBy" varchar(255) COLLATE "pg_catalog"."default" NOT NULL, PRIMARY KEY ("Id") ); @@ -61,14 +60,11 @@ CREATE UNIQUE INDEX "IDX_CONFIG_UNIQUE" ON "public"."configuration" USING btree ```sql CREATE TABLE "public"."configuration_archive" ( "Id" varchar(32) COLLATE "pg_catalog"."default" NOT NULL, - "AppId" varchar(32) COLLATE "pg_catalog"."default" NOT NULL, - "Environment" varchar(50) COLLATE "pg_catalog"."default" NOT NULL, "Data" text COLLATE "pg_catalog"."default", "Operator" varchar(64) COLLATE "pg_catalog"."default" NOT NULL, "ArchiveTime" timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY ("Id") -) -; +); ``` # configuration_item @@ -79,11 +75,8 @@ CREATE TABLE "public"."configuration_item" ( "ConfigurationId" varchar(32) COLLATE "pg_catalog"."default" NOT NULL, "Key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL, "Value" text COLLATE "pg_catalog"."default", - "UpdatedTime" timestamp(6) NOT NULL, - "UpdatedBy" varchar(64) COLLATE "pg_catalog"."default" NOT NULL, PRIMARY KEY ("Id") -) -; +); CREATE INDEX "IDX_CONFIG_ITEM_FK" ON "public"."configuration_item" USING btree ( "ConfigurationId" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST @@ -106,8 +99,7 @@ CREATE TABLE "public"."configuration_revision" ( "Operator" varchar(64) COLLATE "pg_catalog"."default" NOT NULL, "CreateTime" timestamp(6) NOT NULL, PRIMARY KEY ("Id") -) -; +); CREATE INDEX "IDS_CONFIG_REVISION_FK" ON "public"."configuration_revision" USING btree ( "ConfigurationId" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST diff --git a/Source/Starfish.Client/StarfishConfigurationProvider.cs b/Source/Starfish.Client/StarfishConfigurationProvider.cs index 14dd668..b1716c3 100644 --- a/Source/Starfish.Client/StarfishConfigurationProvider.cs +++ b/Source/Starfish.Client/StarfishConfigurationProvider.cs @@ -55,11 +55,16 @@ public override void Load() private async void OnHostChanged(object sender, HostChangedEventArgs args) { + if (string.IsNullOrWhiteSpace(args.Host)) + { + return; + } + var uri = new Uri(args.Host); IConfigurationClient client = uri.Scheme switch { - "http" or "https" => new HttpConfigurationClient(uri, _options.Id, _options.Secret), - "ws" or "wss" => new SocketConfigurationClient(uri, _options.Id, _options.Secret), + "http" or "https" => new HttpConfigurationClient(uri, _options.Id, _options.Secret), + "ws" or "wss" => new SocketConfigurationClient(uri, _options.Id, _options.Secret), _ => throw new NotSupportedException(string.Format(Resources.IDS_ERROR_SCHEMA_NOT_SUPPORTED, uri.Scheme)), }; try diff --git a/Source/Starfish.Common/EnumExtensions.cs b/Source/Starfish.Common/EnumExtensions.cs index 6944f14..6c088a4 100644 --- a/Source/Starfish.Common/EnumExtensions.cs +++ b/Source/Starfish.Common/EnumExtensions.cs @@ -5,13 +5,22 @@ internal static class EnumExtensions { + /// + /// 获取枚举字段描述 + /// + /// + /// + /// + /// + /// public static string GetDescription(this Enum @enum, ResourceManager resourceManager, CultureInfo resourceCulture) { var field = @enum.GetType().GetField(@enum.ToString()); if (field == null) { - throw new NullReferenceException("field"); + throw new NullReferenceException($"Field ‘{@enum}’ not defined."); } + var attribute = field.GetCustomAttribute(); var key = attribute?.Description ?? @enum.ToString(); var value = resourceManager.GetString(key, resourceCulture); diff --git a/Source/Starfish.Common/GzipHelper.cs b/Source/Starfish.Common/GzipHelper.cs index c798f11..7c91f62 100644 --- a/Source/Starfish.Common/GzipHelper.cs +++ b/Source/Starfish.Common/GzipHelper.cs @@ -1,8 +1,16 @@ using System.IO.Compression; +// ReSharper disable MemberCanBePrivate.Global + namespace Nerosoft.Starfish.Common; + public static class GzipHelper { + /// + /// 使用Gzip压缩字符串并转换为Base64字符串 + /// + /// + /// public static string CompressToBase64(string source) { var buffer = Compress(source); @@ -10,6 +18,11 @@ public static string CompressToBase64(string source) return Convert.ToBase64String(buffer); } + /// + /// 使用Gzip压缩字符串 + /// + /// + /// public static byte[] Compress(string source) { var data = Encoding.UTF8.GetBytes(source); @@ -26,17 +39,36 @@ public static byte[] Compress(string source) return buffer; } + /// + /// 解压Base64字符串 + /// + /// + /// + /// + /// 此操作将Base64字符串解码为字节数组,然后解压缩 + /// public static string DecompressFromBase64(string base64Data) { var data = Convert.FromBase64String(base64Data); return Decompress(data); } + /// + /// 解压Gzip压缩的字节数组 + /// + /// + /// public static string Decompress(byte[] data) { return Decompress(data, data.Length); } + /// + /// 解压Gzip压缩的字节数组 + /// + /// + /// + /// public static string Decompress(byte[] data, int count) { var stream = new MemoryStream(data, 0, count); @@ -61,4 +93,4 @@ public static string Decompress(byte[] data, int count) destStream.Close(); return Encoding.UTF8.GetString(buffer); } -} +} \ No newline at end of file diff --git a/Source/Starfish.Common/ObservableRangeCollection.cs b/Source/Starfish.Common/ObservableRangeCollection.cs index fcba41a..1b92c00 100644 --- a/Source/Starfish.Common/ObservableRangeCollection.cs +++ b/Source/Starfish.Common/ObservableRangeCollection.cs @@ -51,12 +51,9 @@ public void AddRange(IEnumerable collection, NotifyCollectionChangedAction no return; } - var changedItems = collection is List - ? (List)collection - : new List(collection); + var changedItems = collection as List ?? [..collection]; - RaiseChangeNotificationEvents( - action: NotifyCollectionChangedAction.Add, + RaiseChangeNotificationEvents(action: NotifyCollectionChangedAction.Add, changedItems: changedItems, startingIndex: startIndex); } diff --git a/Source/Starfish.Common/UuidGenerator.cs b/Source/Starfish.Common/UuidGenerator.cs index 67e58db..3cca2a9 100644 --- a/Source/Starfish.Common/UuidGenerator.cs +++ b/Source/Starfish.Common/UuidGenerator.cs @@ -3,7 +3,7 @@ internal class UuidGenerator { public static string New() - { + { var bytes = Guid.NewGuid().ToByteArray(); var longValue = BitConverter.ToInt64(bytes, 0); var shortUuid = Base62Encode(longValue); @@ -13,14 +13,15 @@ public static string New() private static string Base62Encode(long value) { const string chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - string result = ""; + var result = string.Empty; do { result = chars[(int)(value % 62)] + result; value /= 62; - } while (value > 0); + } + while (value > 0); return result; } -} +} \ No newline at end of file diff --git a/Source/Starfish.Service/Application/Commands/OperateLogCreateCommand.cs b/Source/Starfish.Service/Application/Commands/OperateLogCreateCommand.cs index ce96fae..f760d81 100644 --- a/Source/Starfish.Service/Application/Commands/OperateLogCreateCommand.cs +++ b/Source/Starfish.Service/Application/Commands/OperateLogCreateCommand.cs @@ -20,7 +20,7 @@ public class OperateLogCreateCommand : Command /// /// 描述 /// - public string Description { get; set; } + public string Content { get; set; } /// /// 用户名 diff --git a/Source/Starfish.Service/Application/Handlers/OperateLogCommandHandler.cs b/Source/Starfish.Service/Application/Handlers/OperateLogCommandHandler.cs index 7f2a8ec..549f56c 100644 --- a/Source/Starfish.Service/Application/Handlers/OperateLogCommandHandler.cs +++ b/Source/Starfish.Service/Application/Handlers/OperateLogCommandHandler.cs @@ -31,7 +31,7 @@ public Task HandleAsync(OperateLogCreateCommand message, MessageContext context, { return ExecuteAsync(async () => { - var entity = OperateLog.Create(message.Module, message.Type, message.Description, message.UserName, message.OperateTime, message.Error, message.RequestTraceId); + var entity = OperateLog.Create(message.Module, message.Type, message.Content, message.UserName, message.OperateTime, message.Error, message.RequestTraceId); await _repository.InsertAsync(entity, true, cancellationToken); }); } diff --git a/Source/Starfish.Service/Application/Mappings/LogsMappingProfile.cs b/Source/Starfish.Service/Application/Mappings/LogsMappingProfile.cs index 167682c..af4915b 100644 --- a/Source/Starfish.Service/Application/Mappings/LogsMappingProfile.cs +++ b/Source/Starfish.Service/Application/Mappings/LogsMappingProfile.cs @@ -1,6 +1,7 @@ using AutoMapper; using Nerosoft.Starfish.Domain; using Nerosoft.Starfish.Transit; +using Newtonsoft.Json; namespace Nerosoft.Starfish.Application; @@ -20,15 +21,24 @@ public LogsMappingProfile() private static string GetDescription(OperateLog source, OperateLogDto destination, object obj, ResolutionContext context) { - var key = $"IDS_LOG_MESSAGE_{source.Module}_{source.Type}".Normalize(TextCaseType.Upper).Replace(".", "_"); + var key = $"IDS_MESSAGE_LOGS_{source.Module}_{source.Type}".Normalize(TextCaseType.Upper).Replace(".", "_"); var value = Resources.ResourceManager.GetString(key); - if (string.IsNullOrEmpty(value)) + if (string.IsNullOrEmpty(value) || string.IsNullOrEmpty(source.Content)) { return value; } - return string.Format(value, source.Content); + try + { + var args = JsonConvert.DeserializeObject(source.Content); + + return string.Format(value, args); + } + catch + { + return value; + } } } \ No newline at end of file diff --git a/Source/Starfish.Service/Application/Subscribers/LoggingEventSubscriber.Auth.cs b/Source/Starfish.Service/Application/Subscribers/LoggingEventSubscriber.Auth.cs index b556022..17206ed 100644 --- a/Source/Starfish.Service/Application/Subscribers/LoggingEventSubscriber.Auth.cs +++ b/Source/Starfish.Service/Application/Subscribers/LoggingEventSubscriber.Auth.cs @@ -1,5 +1,4 @@ using Nerosoft.Euonia.Bus; -using Nerosoft.Starfish.Domain; namespace Nerosoft.Starfish.Application; @@ -23,7 +22,6 @@ public Task HandleAsync(UserAuthSucceedEvent @event, MessageContext context, Can Type = @event.AuthType, UserName = @event.UserName, OperateTime = DateTime.Now, - Description = Resources.IDS_MESSAGE_LOGS_AUTH_SUCCEED, RequestTraceId = context.RequestTraceId }; return _bus.SendAsync(command, new SendOptions { RequestTraceId = context.RequestTraceId }, null, cancellationToken); @@ -43,7 +41,7 @@ public Task HandleAsync(UserAuthFailedEvent @event, MessageContext context, Canc { Module = MODULE_AUTH, Type = @event.AuthType, - Description = Resources.IDS_MESSAGE_LOGS_AUTH_FAILED, + Content = Resources.IDS_MESSAGE_LOGS_AUTH_FAILED, OperateTime = DateTime.Now, RequestTraceId = context.RequestTraceId, Error = @event.Error diff --git a/Source/Starfish.Service/Application/Subscribers/LoggingEventSubscriber.Config.cs b/Source/Starfish.Service/Application/Subscribers/LoggingEventSubscriber.Config.cs index d309122..794df55 100644 --- a/Source/Starfish.Service/Application/Subscribers/LoggingEventSubscriber.Config.cs +++ b/Source/Starfish.Service/Application/Subscribers/LoggingEventSubscriber.Config.cs @@ -1,5 +1,6 @@ using Nerosoft.Euonia.Bus; using Nerosoft.Starfish.Domain; +using Newtonsoft.Json; namespace Nerosoft.Starfish.Application; @@ -22,7 +23,7 @@ public Task HandleAsync(ConfigurationEnabledEvent @event, MessageContext context { Module = MODULE_CONFIG, Type = "status.enable", - Description = string.Format(Resources.IDS_MESSAGE_LOGS_CONFIG_ENABLE, aggregate.Id, aggregate.Name), + Content = GenerateLogContent(aggregate.Id, aggregate.Name), OperateTime = DateTime.Now, RequestTraceId = context.RequestTraceId, UserName = context.User?.Identity?.Name @@ -46,7 +47,7 @@ public Task HandleAsync(ConfigurationDisableEvent @event, MessageContext context { Module = MODULE_CONFIG, Type = "status.disable", - Description = string.Format(Resources.IDS_MESSAGE_LOGS_CONFIG_DISABLE, aggregate.Id, aggregate.Name), + Content = GenerateLogContent(aggregate.Id, aggregate.Name), OperateTime = DateTime.Now, RequestTraceId = context.RequestTraceId, UserName = context.User?.Identity?.Name @@ -70,7 +71,7 @@ public Task HandleAsync(ConfigurationSecretChangedEvent @event, MessageContext c { Module = MODULE_CONFIG, Type = "secret", - Description = string.Format(Resources.IDS_MESSAGE_LOGS_CONFIG_RESET_SECRET, aggregate.Id, aggregate.Name), + Content = GenerateLogContent(aggregate.Id, aggregate.Name), OperateTime = DateTime.Now, RequestTraceId = context.RequestTraceId, UserName = context.User?.Identity?.Name @@ -94,7 +95,7 @@ public Task HandleAsync(ConfigurationUpdatedEvent @event, MessageContext context { Module = MODULE_CONFIG, Type = "update", - Description = string.Format(Resources.IDS_MESSAGE_LOGS_CONFIG_UPDATE, aggregate.Id, aggregate.Name), + Content = GenerateLogContent(aggregate.Id, aggregate.Name), OperateTime = DateTime.Now, RequestTraceId = context.RequestTraceId, UserName = context.User?.Identity?.Name @@ -113,13 +114,11 @@ public Task HandleAsync(ConfigurationUpdatedEvent @event, MessageContext context [Subscribe] public Task HandleAsync(ConfigurationCreatedEvent @event, MessageContext context, CancellationToken cancellationToken = default) { - var description = string.Format(Resources.IDS_MESSAGE_LOGS_CONFIG_CREATE, @event.Configuration.Id, @event.Configuration.Name); - var command = new OperateLogCreateCommand { Module = MODULE_CONFIG, Type = "create", - Description = description, + Content = GenerateLogContent(@event.Configuration.Id, @event.Configuration.Name), OperateTime = DateTime.Now, RequestTraceId = context.RequestTraceId, UserName = context.User?.Identity?.Name @@ -138,13 +137,12 @@ public Task HandleAsync(ConfigurationCreatedEvent @event, MessageContext context public Task HandleAsync(ConfigurationDeletedEvent @event, MessageContext context, CancellationToken cancellationToken = default) { var aggregate = @event.GetAggregate(); - var description = string.Format(Resources.IDS_MESSAGE_LOGS_CONFIG_DELETE, aggregate.Id, aggregate.Name); var command = new OperateLogCreateCommand { Module = MODULE_CONFIG, Type = "delete", - Description = description, + Content = GenerateLogContent(aggregate.Id, aggregate.Name), OperateTime = DateTime.Now, RequestTraceId = context.RequestTraceId, UserName = context.User?.Identity?.Name @@ -163,17 +161,28 @@ public Task HandleAsync(ConfigurationDeletedEvent @event, MessageContext context public Task HandleAsync(ConfigurationPublishedEvent @event, MessageContext context, CancellationToken cancellationToken = default) { var aggregate = @event.GetAggregate(); - var description = string.Format(Resources.IDS_MESSAGE_LOGS_CONFIG_PUBLISH, aggregate.Id, aggregate.Name); var command = new OperateLogCreateCommand { Module = MODULE_CONFIG, Type = "publish", - Description = description, + Content = GenerateLogContent(aggregate.Id, aggregate.Name), OperateTime = DateTime.Now, RequestTraceId = context.RequestTraceId, UserName = context.User?.Identity?.Name }; return _bus.SendAsync(command, new SendOptions { RequestTraceId = context.RequestTraceId }, null, cancellationToken); } -} + + private static string GenerateLogContent(params object[] args) + { + if (args == null || args.Length == 0) + { + return string.Empty; + } + + var items = args.Select(t => t.ToString()); + + return JsonConvert.SerializeObject(items); + } +} \ No newline at end of file diff --git a/Source/Starfish.Service/Domain/Aggregates/Configuration.cs b/Source/Starfish.Service/Domain/Aggregates/Configuration.cs index 7bfcb9a..50eac8c 100644 --- a/Source/Starfish.Service/Domain/Aggregates/Configuration.cs +++ b/Source/Starfish.Service/Domain/Aggregates/Configuration.cs @@ -137,10 +137,16 @@ internal void SetSecret(string secret) { throw new BadRequestException(Resources.IDS_ERROR_CONFIG_SECRET_NOT_MATCHES_RULE); } + + var secretHash = Cryptography.SHA.Encrypt(secret); if (!string.IsNullOrEmpty(Id)) { - RaiseEvent(new ConfigurationSecretChangedEvent(Cryptography.SHA.Encrypt(secret))); + RaiseEvent(new ConfigurationSecretChangedEvent(secretHash)); + } + else + { + Secret = secretHash; } } diff --git a/Source/Starfish.Service/Domain/Aggregates/TeamMember.cs b/Source/Starfish.Service/Domain/Aggregates/TeamMember.cs index 0fe0a00..4c0c3ae 100644 --- a/Source/Starfish.Service/Domain/Aggregates/TeamMember.cs +++ b/Source/Starfish.Service/Domain/Aggregates/TeamMember.cs @@ -5,7 +5,7 @@ namespace Nerosoft.Starfish.Domain; /// /// 团队成员实体 /// -public sealed class TeamMember : Entity, IHasCreateTime +public sealed class TeamMember : Entity, IHasCreateTime { private TeamMember() { @@ -17,10 +17,19 @@ private TeamMember(string userId) UserId = userId; } + /// + /// 用户Id + /// public string UserId { get; set; } + /// + /// 团队Id + /// public string TeamId { get; set; } + /// + /// 创建时间 + /// public DateTime CreateTime { get; set; } public User User { get; set; } diff --git a/Source/Starfish.Service/Domain/Business/ConfigurationPublishBusiness.cs b/Source/Starfish.Service/Domain/Business/ConfigurationPublishBusiness.cs index 5ade11e..31bb84b 100644 --- a/Source/Starfish.Service/Domain/Business/ConfigurationPublishBusiness.cs +++ b/Source/Starfish.Service/Domain/Business/ConfigurationPublishBusiness.cs @@ -29,7 +29,7 @@ protected async Task ExecuteAsync(string id, string version, string comment, Can throw new ConfigurationNotFoundException(id); } - var permission = await TeamRepository.CheckPermissionAsync(id, Identity.UserId, cancellationToken); + var permission = await TeamRepository.CheckPermissionAsync(aggregate.TeamId, Identity.UserId, cancellationToken); switch (permission) { diff --git a/Source/Starfish.Service/Properties/Resources.resx b/Source/Starfish.Service/Properties/Resources.resx index 45f5b53..9708595 100644 --- a/Source/Starfish.Service/Properties/Resources.resx +++ b/Source/Starfish.Service/Properties/Resources.resx @@ -258,42 +258,18 @@ UserName '{0}' not available. - + + User authenticate failed. + + Login with one-time-password - + Login with password - + Refresh token - - Create team - - - Add new member - - - Remove member - - - Update team - - - Create user - - - Change password - - - Reset password - - - Update user - - - User authenticate failed. - User authenticate successfully. @@ -318,4 +294,28 @@ Update configuration, [Id]:{0}, [Name]:{1}. + + Create user + + + Create team + + + Add new member + + + Remove member + + + Update team + + + Change password + + + Reset password + + + Update user + \ No newline at end of file diff --git a/Source/Starfish.Service/Properties/Resources.zh-Hans.resx b/Source/Starfish.Service/Properties/Resources.zh-Hans.resx index 42dc9ad..9dd6519 100644 --- a/Source/Starfish.Service/Properties/Resources.zh-Hans.resx +++ b/Source/Starfish.Service/Properties/Resources.zh-Hans.resx @@ -307,6 +307,15 @@ 用户认证失败。 + + 验证码登录 + + + 账号密码登录 + + + 令牌登录 + 用户认证成功。 @@ -339,4 +348,28 @@ 更新配置,[Id]:{0},[名称]:{1}。 + + 新增用户 + + + 新增团队 + + + 添加团队成员 + + + 移除团队成员 + + + 编辑团队信息 + + + 修改登录密码 + + + 重置登录密码 + + + 编辑用户信息 + \ No newline at end of file diff --git a/Source/Starfish.Service/Properties/Resources.zh-Hant.resx b/Source/Starfish.Service/Properties/Resources.zh-Hant.resx index c810ce7..b1ff373 100644 --- a/Source/Starfish.Service/Properties/Resources.zh-Hant.resx +++ b/Source/Starfish.Service/Properties/Resources.zh-Hant.resx @@ -339,4 +339,37 @@ 更新配置,[Id]:{0},[名稱]:{1}。 + + 驗證碼登錄 + + + 帳號密碼登錄 + + + 令牌登錄 + + + 創建用戶 + + + 創建團隊 + + + 添加新成員 + + + 移除團隊成員 + + + 編輯團隊訊息 + + + 更改密碼 + + + 重設密碼 + + + 編輯用戶訊息 + \ No newline at end of file diff --git a/Source/Starfish.Service/Repository/Contexts/DataContext.cs b/Source/Starfish.Service/Repository/Contexts/DataContext.cs index dd44186..afb916b 100644 --- a/Source/Starfish.Service/Repository/Contexts/DataContext.cs +++ b/Source/Starfish.Service/Repository/Contexts/DataContext.cs @@ -108,6 +108,15 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) base.OnModelCreating(modelBuilder); } + protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder) + { + base.ConfigureConventions(configurationBuilder); + configurationBuilder.Properties() + .HaveConversion(); + configurationBuilder.Properties() + .HaveConversion(); + } + private List GetTrackedEvents() { var entries = ChangeTracker.Entries(); diff --git a/Source/Starfish.Service/Repository/Contexts/RelationalDatabaseModelBuilder.cs b/Source/Starfish.Service/Repository/Contexts/RelationalDatabaseModelBuilder.cs index 3d0e0bb..6bd6686 100644 --- a/Source/Starfish.Service/Repository/Contexts/RelationalDatabaseModelBuilder.cs +++ b/Source/Starfish.Service/Repository/Contexts/RelationalDatabaseModelBuilder.cs @@ -31,7 +31,7 @@ protected override ModelBuilder ConfigureUser(ModelBuilder modelBuilder) .HasValueGenerator(); }); } - + protected override ModelBuilder ConfigureTeam(ModelBuilder modelBuilder) { modelBuilder.Entity(entity => diff --git a/Source/Starfish.Service/Seedwork/CommandHandlerBase.cs b/Source/Starfish.Service/Seedwork/CommandHandlerBase.cs index 9ff2d90..2e0e1fd 100644 --- a/Source/Starfish.Service/Seedwork/CommandHandlerBase.cs +++ b/Source/Starfish.Service/Seedwork/CommandHandlerBase.cs @@ -50,7 +50,7 @@ protected virtual async Task ExecuteAsync(string messageId, [No var response = new CommandResponse(messageId); try { - using (var uow = UnitOfWork.Begin()) + using (var uow = UnitOfWork.Begin(true, true)) { await action(); await uow.CommitAsync(); @@ -79,7 +79,7 @@ protected virtual async Task> ExecuteAsync(str try { TResult result; - using (var uow = UnitOfWork.Begin()) + using (var uow = UnitOfWork.Begin(true, true)) { result = await action(); await uow.CommitAsync(); @@ -102,7 +102,7 @@ protected virtual async Task> ExecuteAsync(str /// protected virtual async Task ExecuteAsync([NotNull] Func action) { - using var uow = UnitOfWork.Begin(); + using var uow = UnitOfWork.Begin(true, true); await action(); await uow.CommitAsync(); } @@ -116,7 +116,7 @@ protected virtual async Task ExecuteAsync([NotNull] Func action) /// protected virtual async Task ExecuteAsync([NotNull] Func> action, Action next) { - using var uow = UnitOfWork.Begin(); + using var uow = UnitOfWork.Begin(true, true); var result = await action(); await uow.CommitAsync(); next(result); diff --git a/Source/Starfish.Service/UseCases/Identity/GrantWithPasswordUseCase.cs b/Source/Starfish.Service/UseCases/Identity/GrantWithPasswordUseCase.cs index ae383bb..74b4022 100644 --- a/Source/Starfish.Service/UseCases/Identity/GrantWithPasswordUseCase.cs +++ b/Source/Starfish.Service/UseCases/Identity/GrantWithPasswordUseCase.cs @@ -66,7 +66,7 @@ public async Task ExecuteAsync(GrantWithPassword var passwordHash = Cryptography.DES.Encrypt(input.Password, Encoding.UTF8.GetBytes(user.PasswordSalt)); - if (string.Equals(user.PasswordHash, passwordHash)) + if (!string.Equals(user.PasswordHash, passwordHash)) { throw new AuthenticationException(Resources.IDS_ERROR_USER_USERNAME_OR_PASSWORD_IS_INVALID); } diff --git a/Source/Starfish.Webapp/Layout/MainLayout.razor b/Source/Starfish.Webapp/Layout/MainLayout.razor index 857d1b0..546d3b4 100644 --- a/Source/Starfish.Webapp/Layout/MainLayout.razor +++ b/Source/Starfish.Webapp/Layout/MainLayout.razor @@ -73,7 +73,7 @@ - +
Nerosoft © @(DateTime.Today.Year). All rights reserved.
diff --git a/Source/Starfish.Webapp/Pages/Configs/Edit.razor b/Source/Starfish.Webapp/Pages/Configs/Edit.razor index 19a73b5..7631b48 100644 --- a/Source/Starfish.Webapp/Pages/Configs/Edit.razor +++ b/Source/Starfish.Webapp/Pages/Configs/Edit.razor @@ -138,7 +138,7 @@ private async Task LoadTeamsAsync() { - await TeamApi.QueryAsync(new TeamCriteria(), 1, 100) + await TeamApi.QueryAsync(new TeamCriteria(), 0, 100) .EnsureSuccess(result => { if (result == null) diff --git a/Source/Starfish.Webapp/Pages/Configs/Index.razor b/Source/Starfish.Webapp/Pages/Configs/Index.razor index 15d4740..141dfd5 100644 --- a/Source/Starfish.Webapp/Pages/Configs/Index.razor +++ b/Source/Starfish.Webapp/Pages/Configs/Index.razor @@ -118,7 +118,7 @@ var title = string.IsNullOrEmpty(id) ? Resources.IDS_CONFIG_EDIT_DIALOG_TITLE_ADD : Resources.IDS_CONFIG_EDIT_DIALOG_TITLE_EDIT; var dialog = await DialogService.ShowDialogAsync(id, new DialogParameters { Title = title, PreventDismissOnOverlayClick = true }); var result = await dialog.Result; - if (result.Cancelled) + if (!result.Cancelled) { await Pagination.SetCurrentPageIndexAsync(0); } diff --git a/Source/Starfish.Webapp/Pages/Team/Index.razor b/Source/Starfish.Webapp/Pages/Team/Index.razor index b3def26..07d7d1e 100644 --- a/Source/Starfish.Webapp/Pages/Team/Index.razor +++ b/Source/Starfish.Webapp/Pages/Team/Index.razor @@ -99,7 +99,12 @@ private async Task OnEditClicked(string id) { var title = string.IsNullOrEmpty(id) ? Resources.IDS_TEAM_EDIT_TITLE_ADD : Resources.IDS_TEAM_EDIT_TITLE_EDIT; - await DialogService.ShowDialogAsync(id ?? string.Empty, new DialogParameters { Title = title, PreventDismissOnOverlayClick = true }); + var dialog = await DialogService.ShowDialogAsync(id ?? string.Empty, new DialogParameters { Title = title, PreventDismissOnOverlayClick = true }); + var result = await dialog.Result; + if (!result.Cancelled) + { + await Pagination.SetCurrentPageIndexAsync(0); + } } private async Task OnSearchClicked() diff --git a/global.props b/global.props index ad45b6d..f598b3e 100644 --- a/global.props +++ b/global.props @@ -1,6 +1,6 @@ - 1.0.5 + 1.0.6 damon Nerosoft Ltd. Starfish