diff --git a/README.md b/README.md
index 94970bd..5fcb780 100644
--- a/README.md
+++ b/README.md
@@ -14,11 +14,11 @@ Starfish是一个轻量但功能强大的分布式 .NET 应用程序配置中心
> 💚 Completed/已完成 ⌛ In progress/进行中 🕝 Planned/计划中
- [ ] ⌛ Support multiple data sources/支持多种数据源
- - [ ] ⌛ MySQL
+ - [x] 💚 MySQL
- [ ] ⌛ SqlServer
- [ ] ⌛ PostgreSQL
- [ ] 🕝 MongoDB
- - [ ] ⌛ Sqlite
+ - [x] 💚 Sqlite
- [ ] ⌛ Support multiple platforms/支持多种平台
- [x] 💚 Web API/Web Application/gRPC Service in .NET6/7/8
- [x] 💚 .NET MAUI
@@ -36,7 +36,7 @@ Starfish是一个轻量但功能强大的分布式 .NET 应用程序配置中心
- [ ] ⌛ Support multiple languages admin panel/支持多语言管理面板
- [x] 💚 en/英语
- [x] 💚 zh-Hans/简体中文
- - [ ] 🕝 zh-Hant/繁体中文
+ - [ ] ⌛ zh-Hant/繁体中文
## 💰 Donate/捐助
@@ -72,10 +72,6 @@ This project is licensed under the AGPL-3.0 License - see the [LICENSE](LICENSE)
```
Starfish
-├──Sample
-├ ├──Starfish.Sample.Blazor
-├ ├──Starfish.Sample.MauiApp
-├ ├──Starfish.Sample.Webapi
├──Source
├ ├──Starfish.Client
├ ├──Starfish.Common
diff --git a/Source/Starfish.Client/Properties/Resources.zh-Hant.resx b/Source/Starfish.Client/Properties/Resources.zh-Hant.resx
new file mode 100644
index 0000000..3c47deb
--- /dev/null
+++ b/Source/Starfish.Client/Properties/Resources.zh-Hant.resx
@@ -0,0 +1,112 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 1.3
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 沒有在Starfish找到App配置項目。
+
+
+ 沒有在Starfish找到Host配置項目。
+
+
+ 不支援協定{0}。
+
+
+ 沒有找到Starfish配置項。
+
+
\ No newline at end of file
diff --git a/Source/Starfish.Service/Application/ApplicationServiceModule.cs b/Source/Starfish.Service/Application/ApplicationServiceModule.cs
index 4e072b9..cd10f2a 100644
--- a/Source/Starfish.Service/Application/ApplicationServiceModule.cs
+++ b/Source/Starfish.Service/Application/ApplicationServiceModule.cs
@@ -45,18 +45,8 @@ public override void ConfigureServices(ServiceConfigurationContext context)
context.Services.AddSingleton();
- context.Services.AddSingleton();
- context.Services.AddSingleton();
-
- context.Services.AddNamedService((name, provider) =>
- {
- return name switch
- {
- "json" => provider.GetService(),
- "text" => provider.GetService(),
- _ => throw new NotSupportedException()
- };
- });
+ context.Services.AddKeyedSingleton("json");
+ context.Services.AddKeyedSingleton("text");
ConfigureCachingServices(context.Services);
diff --git a/Source/Starfish.Service/Application/Commands/Identity/ChangePasswordCommand.cs b/Source/Starfish.Service/Application/Commands/Identity/ChangePasswordCommand.cs
index a2a981b..d61d8be 100644
--- a/Source/Starfish.Service/Application/Commands/Identity/ChangePasswordCommand.cs
+++ b/Source/Starfish.Service/Application/Commands/Identity/ChangePasswordCommand.cs
@@ -11,7 +11,7 @@ public ChangePasswordCommand()
{
}
- public ChangePasswordCommand(int userId, string password)
+ public ChangePasswordCommand(long userId, string password)
: this()
{
UserId = userId;
@@ -21,7 +21,7 @@ public ChangePasswordCommand(int userId, string password)
///
/// 用户Id
///
- public int UserId { get; set; }
+ public long UserId { get; set; }
///
/// 新密码
diff --git a/Source/Starfish.Service/Application/Commands/Identity/UserDeleteCommand.cs b/Source/Starfish.Service/Application/Commands/Identity/UserDeleteCommand.cs
index 101ff35..3d57bcf 100644
--- a/Source/Starfish.Service/Application/Commands/Identity/UserDeleteCommand.cs
+++ b/Source/Starfish.Service/Application/Commands/Identity/UserDeleteCommand.cs
@@ -5,13 +5,13 @@ namespace Nerosoft.Starfish.Application;
///
/// 用户删除命令
///
-public sealed class UserDeleteCommand : Command
+public sealed class UserDeleteCommand : Command
{
///
/// 初始化实例。
///
///
- public UserDeleteCommand(int userId)
+ public UserDeleteCommand(long userId)
: base(userId)
{
}
diff --git a/Source/Starfish.Service/Application/Commands/Identity/UserRoleSetCommand.cs b/Source/Starfish.Service/Application/Commands/Identity/UserRoleSetCommand.cs
index cb33507..0341177 100644
--- a/Source/Starfish.Service/Application/Commands/Identity/UserRoleSetCommand.cs
+++ b/Source/Starfish.Service/Application/Commands/Identity/UserRoleSetCommand.cs
@@ -2,9 +2,9 @@
namespace Nerosoft.Starfish.Application;
-public class UserRoleSetCommand : Command>
+public class UserRoleSetCommand : Command>
{
- public UserRoleSetCommand(int id, List roles)
+ public UserRoleSetCommand(long id, List roles)
: base(id, roles)
{
}
diff --git a/Source/Starfish.Service/Application/Commands/Identity/UserUpdateCommand.cs b/Source/Starfish.Service/Application/Commands/Identity/UserUpdateCommand.cs
index 108b44e..3be9ed9 100644
--- a/Source/Starfish.Service/Application/Commands/Identity/UserUpdateCommand.cs
+++ b/Source/Starfish.Service/Application/Commands/Identity/UserUpdateCommand.cs
@@ -6,9 +6,9 @@ namespace Nerosoft.Starfish.Application;
///
/// 用户更新命令
///
-public sealed class UserUpdateCommand : Command
+public sealed class UserUpdateCommand : Command
{
- public UserUpdateCommand(int userId, UserUpdateDto data)
+ public UserUpdateCommand(long userId, UserUpdateDto data)
: base(userId, data)
{
}
diff --git a/Source/Starfish.Service/Application/Commands/Setting/SettingDeleteCommand.cs b/Source/Starfish.Service/Application/Commands/Setting/SettingDeleteCommand.cs
index 6fad445..3792542 100644
--- a/Source/Starfish.Service/Application/Commands/Setting/SettingDeleteCommand.cs
+++ b/Source/Starfish.Service/Application/Commands/Setting/SettingDeleteCommand.cs
@@ -1,6 +1,4 @@
-using Nerosoft.Euonia.Domain;
-
-namespace Nerosoft.Starfish.Application;
+namespace Nerosoft.Starfish.Application;
///
/// 删除配置节点命令
diff --git a/Source/Starfish.Service/Application/Commands/Setting/SettingPublishCommand.cs b/Source/Starfish.Service/Application/Commands/Setting/SettingPublishCommand.cs
index d21b639..ac9fbdb 100644
--- a/Source/Starfish.Service/Application/Commands/Setting/SettingPublishCommand.cs
+++ b/Source/Starfish.Service/Application/Commands/Setting/SettingPublishCommand.cs
@@ -1,6 +1,4 @@
-using Nerosoft.Euonia.Domain;
-
-namespace Nerosoft.Starfish.Application;
+namespace Nerosoft.Starfish.Application;
///
/// 配置节点发布命令
diff --git a/Source/Starfish.Service/Application/Commands/Setting/SettingUpdateCommand.cs b/Source/Starfish.Service/Application/Commands/Setting/SettingUpdateCommand.cs
index 65ed58d..4de2c33 100644
--- a/Source/Starfish.Service/Application/Commands/Setting/SettingUpdateCommand.cs
+++ b/Source/Starfish.Service/Application/Commands/Setting/SettingUpdateCommand.cs
@@ -1,6 +1,4 @@
-using Nerosoft.Euonia.Domain;
-
-namespace Nerosoft.Starfish.Application;
+namespace Nerosoft.Starfish.Application;
public class SettingUpdateCommand : SettingAbstractCommand
{
diff --git a/Source/Starfish.Service/Application/Commands/Team/TeamMemberEditCommand.cs b/Source/Starfish.Service/Application/Commands/Team/TeamMemberEditCommand.cs
index 42dbf11..7e94bff 100644
--- a/Source/Starfish.Service/Application/Commands/Team/TeamMemberEditCommand.cs
+++ b/Source/Starfish.Service/Application/Commands/Team/TeamMemberEditCommand.cs
@@ -4,16 +4,16 @@ namespace Nerosoft.Starfish.Application;
public class TeamMemberEditCommand : Command
{
- public TeamMemberEditCommand(int teamId, List userIds, string type)
+ public TeamMemberEditCommand(long teamId, List userIds, string type)
{
TeamId = teamId;
UserIds = userIds;
Type = type;
}
- public int TeamId { get; set; }
+ public long TeamId { get; set; }
- public List UserIds { get; set; }
+ public List UserIds { get; set; }
public string Type { get; set; }
}
\ No newline at end of file
diff --git a/Source/Starfish.Service/Application/Commands/Team/TeamUpdateCommand.cs b/Source/Starfish.Service/Application/Commands/Team/TeamUpdateCommand.cs
index fa583ae..ea79d99 100644
--- a/Source/Starfish.Service/Application/Commands/Team/TeamUpdateCommand.cs
+++ b/Source/Starfish.Service/Application/Commands/Team/TeamUpdateCommand.cs
@@ -5,13 +5,13 @@ namespace Nerosoft.Starfish.Application;
public class TeamUpdateCommand : Command
{
- public TeamUpdateCommand(int id, TeamEditDto data)
+ public TeamUpdateCommand(long id, TeamEditDto data)
{
Id = id;
Data = data;
}
- public int Id { get; set; }
+ public long Id { get; set; }
public TeamEditDto Data { get; set; }
}
\ No newline at end of file
diff --git a/Source/Starfish.Service/Application/Contracts/ISettingApplicationService.cs b/Source/Starfish.Service/Application/Contracts/ISettingApplicationService.cs
index e039b65..ae69ccb 100644
--- a/Source/Starfish.Service/Application/Contracts/ISettingApplicationService.cs
+++ b/Source/Starfish.Service/Application/Contracts/ISettingApplicationService.cs
@@ -98,5 +98,13 @@ public interface ISettingApplicationService : IApplicationService
///
Task GetSettingRawAsync(long appId, string environment, CancellationToken cancellationToken = default);
- Task GetItemsInTextAsync(long appId, string environment, string type, CancellationToken cancellationToken = default);
+ ///
+ /// 获取指定格式的配置
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ Task GetItemsInTextAsync(long appId, string environment, string format, CancellationToken cancellationToken = default);
}
\ No newline at end of file
diff --git a/Source/Starfish.Service/Application/Contracts/ITeamApplicationService.cs b/Source/Starfish.Service/Application/Contracts/ITeamApplicationService.cs
index 2b68004..4e594c4 100644
--- a/Source/Starfish.Service/Application/Contracts/ITeamApplicationService.cs
+++ b/Source/Starfish.Service/Application/Contracts/ITeamApplicationService.cs
@@ -9,17 +9,17 @@ public interface ITeamApplicationService : IApplicationService
Task CountAsync(TeamCriteria criteria, CancellationToken cancellationToken = default);
- Task GetAsync(int id, CancellationToken cancellationToken = default);
+ Task GetAsync(long id, CancellationToken cancellationToken = default);
- Task CreateAsync(TeamEditDto data, CancellationToken cancellationToken = default);
+ Task CreateAsync(TeamEditDto data, CancellationToken cancellationToken = default);
- Task UpdateAsync(int id, TeamEditDto data, CancellationToken cancellationToken = default);
+ Task UpdateAsync(long id, TeamEditDto data, CancellationToken cancellationToken = default);
- Task> QueryMembersAsync(int id, CancellationToken cancellationToken = default);
+ Task> QueryMembersAsync(long id, CancellationToken cancellationToken = default);
- Task AppendMembersAsync(int id, List userIds, CancellationToken cancellationToken = default);
+ Task AppendMembersAsync(long id, List userIds, CancellationToken cancellationToken = default);
- Task RemoveMembersAsync(int id, List userIds, CancellationToken cancellationToken = default);
+ Task RemoveMembersAsync(long id, List userIds, CancellationToken cancellationToken = default);
- Task QuitAsync(int id, CancellationToken cancellationToken = default);
+ Task QuitAsync(long id, CancellationToken cancellationToken = default);
}
\ No newline at end of file
diff --git a/Source/Starfish.Service/Application/Contracts/IUserApplicationService.cs b/Source/Starfish.Service/Application/Contracts/IUserApplicationService.cs
index 27ff1b8..7cb317b 100644
--- a/Source/Starfish.Service/Application/Contracts/IUserApplicationService.cs
+++ b/Source/Starfish.Service/Application/Contracts/IUserApplicationService.cs
@@ -14,7 +14,7 @@ public interface IUserApplicationService : IApplicationService
///
///
///
- Task CreateAsync(UserCreateDto data, CancellationToken cancellationToken = default);
+ Task CreateAsync(UserCreateDto data, CancellationToken cancellationToken = default);
///
/// 编辑用户
@@ -23,7 +23,7 @@ public interface IUserApplicationService : IApplicationService
///
///
///
- Task UpdateAsync(int id, UserUpdateDto data, CancellationToken cancellationToken = default);
+ Task UpdateAsync(long id, UserUpdateDto data, CancellationToken cancellationToken = default);
///
/// 查询符合条件的用户列表
@@ -49,7 +49,7 @@ public interface IUserApplicationService : IApplicationService
///
///
///
- Task GetAsync(int id, CancellationToken cancellationToken = default);
+ Task GetAsync(long id, CancellationToken cancellationToken = default);
///
/// 删除用户
@@ -57,7 +57,7 @@ public interface IUserApplicationService : IApplicationService
///
///
///
- Task DeleteAsync(int id, CancellationToken cancellationToken = default);
+ Task DeleteAsync(long id, CancellationToken cancellationToken = default);
///
/// 设置用户角色
@@ -66,7 +66,7 @@ public interface IUserApplicationService : IApplicationService
///
///
///
- Task SetRolesAsync(int id, List roles, CancellationToken cancellationToken = default);
+ Task SetRolesAsync(long id, List roles, CancellationToken cancellationToken = default);
///
/// 修改密码
@@ -84,5 +84,5 @@ public interface IUserApplicationService : IApplicationService
///
///
///
- Task ResetPasswordAsync(int id, string password, CancellationToken cancellationToken = default);
+ Task ResetPasswordAsync(long id, string password, CancellationToken cancellationToken = default);
}
\ No newline at end of file
diff --git a/Source/Starfish.Service/Application/Events/UserAuthSucceedEvent.cs b/Source/Starfish.Service/Application/Events/UserAuthSucceedEvent.cs
index fa001db..bb66a66 100644
--- a/Source/Starfish.Service/Application/Events/UserAuthSucceedEvent.cs
+++ b/Source/Starfish.Service/Application/Events/UserAuthSucceedEvent.cs
@@ -20,7 +20,7 @@ public UserAuthSucceedEvent()
///
///
///
- public UserAuthSucceedEvent(string authType, Dictionary data, int userId)
+ public UserAuthSucceedEvent(string authType, Dictionary data, long userId)
{
AuthType = authType;
Data = data;
@@ -40,7 +40,7 @@ public UserAuthSucceedEvent(string authType, Dictionary data, in
///
/// 用户Id
///
- public int UserId { get; set; }
+ public long UserId { get; set; }
///
/// 用户名
diff --git a/Source/Starfish.Service/Application/Handlers/AppInfoCommandHandler.cs b/Source/Starfish.Service/Application/Handlers/AppInfoCommandHandler.cs
index 1a13369..32a3835 100644
--- a/Source/Starfish.Service/Application/Handlers/AppInfoCommandHandler.cs
+++ b/Source/Starfish.Service/Application/Handlers/AppInfoCommandHandler.cs
@@ -16,18 +16,14 @@ public class AppInfoCommandHandler : CommandHandlerBase,
IHandler,
IHandler
{
- private readonly IAppInfoRepository _repository;
-
///
/// 构造函数
///
///
///
- ///
- public AppInfoCommandHandler(IUnitOfWorkManager unitOfWork, IObjectFactory factory, IAppInfoRepository repository)
+ public AppInfoCommandHandler(IUnitOfWorkManager unitOfWork, IObjectFactory factory)
: base(unitOfWork, factory)
{
- _repository = repository;
}
///
diff --git a/Source/Starfish.Service/Application/Implements/DictionaryApplicationService.cs b/Source/Starfish.Service/Application/Implements/DictionaryApplicationService.cs
index 96afdbd..1f49f04 100644
--- a/Source/Starfish.Service/Application/Implements/DictionaryApplicationService.cs
+++ b/Source/Starfish.Service/Application/Implements/DictionaryApplicationService.cs
@@ -1,5 +1,4 @@
using Nerosoft.Euonia.Application;
-using Nerosoft.Starfish.Domain;
using Nerosoft.Starfish.Transit;
namespace Nerosoft.Starfish.Application;
diff --git a/Source/Starfish.Service/Application/Implements/SettingApplicationService.cs b/Source/Starfish.Service/Application/Implements/SettingApplicationService.cs
index 02af483..65492b9 100644
--- a/Source/Starfish.Service/Application/Implements/SettingApplicationService.cs
+++ b/Source/Starfish.Service/Application/Implements/SettingApplicationService.cs
@@ -1,5 +1,4 @@
-using System.Globalization;
-using Nerosoft.Euonia.Application;
+using Nerosoft.Euonia.Application;
using Nerosoft.Starfish.Common;
using Nerosoft.Starfish.Transit;
using Nerosoft.Starfish.UseCases;
@@ -85,9 +84,11 @@ public Task GetSettingRawAsync(long appId, string environment, Cancellat
.ContinueWith(t => t.Result.Result, cancellationToken);
}
- public Task GetItemsInTextAsync(long appId, string environment, string type, CancellationToken cancellationToken = default)
+ ///
+ public Task GetItemsInTextAsync(long appId, string environment, string format, CancellationToken cancellationToken = default)
{
- var parser = LazyServiceProvider.GetRequiredService().GetNamedService(type.ToLower(CultureInfo.CurrentCulture));
+ var parser = LazyServiceProvider.GetRequiredService()
+ .GetKeyedService(format.Normalize(TextCaseType.Lower));
return GetItemListAsync(appId, environment, 0, int.MaxValue, cancellationToken)
.ContinueWith(task =>
{
diff --git a/Source/Starfish.Service/Application/Implements/TeamApplicationService.cs b/Source/Starfish.Service/Application/Implements/TeamApplicationService.cs
index dd0d365..17f778d 100644
--- a/Source/Starfish.Service/Application/Implements/TeamApplicationService.cs
+++ b/Source/Starfish.Service/Application/Implements/TeamApplicationService.cs
@@ -22,7 +22,7 @@ public Task CountAsync(TeamCriteria criteria, CancellationToken cancellatio
.ContinueWith(task => task.Result.Result, cancellationToken);
}
- public Task GetAsync(int id, CancellationToken cancellationToken = default)
+ public Task GetAsync(long id, CancellationToken cancellationToken = default)
{
var useCase = LazyServiceProvider.GetService();
var input = new TeamDetailInput(id);
@@ -30,7 +30,7 @@ public Task GetAsync(int id, CancellationToken cancellationToken
.ContinueWith(task => task.Result.Result, cancellationToken);
}
- public Task CreateAsync(TeamEditDto data, CancellationToken cancellationToken = default)
+ public Task CreateAsync(TeamEditDto data, CancellationToken cancellationToken = default)
{
var useCase = LazyServiceProvider.GetService();
var input = new TeamCreateInput(data);
@@ -38,14 +38,14 @@ public Task CreateAsync(TeamEditDto data, CancellationToken cancellationTok
.ContinueWith(task => task.Result.Result, cancellationToken);
}
- public Task UpdateAsync(int id, TeamEditDto data, CancellationToken cancellationToken = default)
+ public Task UpdateAsync(long id, TeamEditDto data, CancellationToken cancellationToken = default)
{
var useCase = LazyServiceProvider.GetService();
var input = new TeamUpdateInput(id, data);
return useCase.ExecuteAsync(input, cancellationToken);
}
- public Task> QueryMembersAsync(int id, CancellationToken cancellationToken = default)
+ public Task> QueryMembersAsync(long id, CancellationToken cancellationToken = default)
{
var useCase = LazyServiceProvider.GetService();
var input = new TeamMemberQueryInput(id);
@@ -53,24 +53,24 @@ public Task> QueryMembersAsync(int id, CancellationToken can
.ContinueWith(task => task.Result.Result, cancellationToken);
}
- public Task AppendMembersAsync(int id, List userIds, CancellationToken cancellationToken = default)
+ public Task AppendMembersAsync(long id, List userIds, CancellationToken cancellationToken = default)
{
var useCase = LazyServiceProvider.GetService();
var input = new TeamMemberAppendInput(id, userIds);
return useCase.ExecuteAsync(input, cancellationToken);
}
- public Task RemoveMembersAsync(int id, List userIds, CancellationToken cancellationToken = default)
+ public Task RemoveMembersAsync(long id, List userIds, CancellationToken cancellationToken = default)
{
var useCase = LazyServiceProvider.GetService();
var input = new TeamMemberRemoveInput(id, userIds);
return useCase.ExecuteAsync(input, cancellationToken);
}
- public Task QuitAsync(int id, CancellationToken cancellationToken = default)
+ public Task QuitAsync(long id, CancellationToken cancellationToken = default)
{
var useCase = LazyServiceProvider.GetService();
- var input = new TeamMemberQuitInput(id, User.GetUserIdOfInt32());
+ var input = new TeamMemberQuitInput(id, User.GetUserIdOfInt64());
return useCase.ExecuteAsync(input, cancellationToken);
}
}
\ No newline at end of file
diff --git a/Source/Starfish.Service/Application/Implements/UserApplicationService.cs b/Source/Starfish.Service/Application/Implements/UserApplicationService.cs
index 58f0bf8..55e0841 100644
--- a/Source/Starfish.Service/Application/Implements/UserApplicationService.cs
+++ b/Source/Starfish.Service/Application/Implements/UserApplicationService.cs
@@ -10,7 +10,7 @@ namespace Nerosoft.Starfish.Application;
public class UserApplicationService : BaseApplicationService, IUserApplicationService
{
///
- public Task CreateAsync(UserCreateDto data, CancellationToken cancellationToken = default)
+ public Task CreateAsync(UserCreateDto data, CancellationToken cancellationToken = default)
{
var useCase = LazyServiceProvider.GetService();
var input = new UserCreateInput(data);
@@ -19,7 +19,7 @@ public Task CreateAsync(UserCreateDto data, CancellationToken cancellationT
}
///
- public Task UpdateAsync(int id, UserUpdateDto data, CancellationToken cancellationToken = default)
+ public Task UpdateAsync(long id, UserUpdateDto data, CancellationToken cancellationToken = default)
{
var useCase = LazyServiceProvider.GetService();
var input = new UserUpdateInput(id, data);
@@ -43,7 +43,7 @@ public Task CountAsync(UserCriteria criteria, CancellationToken cancellatio
}
///
- public Task GetAsync(int id, CancellationToken cancellationToken = default)
+ public Task GetAsync(long id, CancellationToken cancellationToken = default)
{
var useCase = LazyServiceProvider.GetService();
var input = new UserDetailInput(id);
@@ -52,7 +52,7 @@ public Task GetAsync(int id, CancellationToken cancellationToken
}
///
- public Task DeleteAsync(int id, CancellationToken cancellationToken = default)
+ public Task DeleteAsync(long id, CancellationToken cancellationToken = default)
{
var useCase = LazyServiceProvider.GetService();
var input = new UserDeleteInput(id);
@@ -60,7 +60,7 @@ public Task DeleteAsync(int id, CancellationToken cancellationToken = default)
}
///
- public Task SetRolesAsync(int id, List roles, CancellationToken cancellationToken = default)
+ public Task SetRolesAsync(long id, List roles, CancellationToken cancellationToken = default)
{
var useCase = LazyServiceProvider.GetService();
var input = new UserSetRoleInput(id, roles);
@@ -74,7 +74,7 @@ public Task ChangePasswordAsync(string oldPassword, string newPassword, Cancella
return useCase.ExecuteAsync(input, cancellationToken);
}
- public Task ResetPasswordAsync(int id, string password, CancellationToken cancellationToken = default)
+ public Task ResetPasswordAsync(long id, string password, CancellationToken cancellationToken = default)
{
var useCase = LazyServiceProvider.GetService();
var input = new ResetPasswordInput(id, password);
diff --git a/Source/Starfish.Service/Domain/Aggregates/AppInfo.cs b/Source/Starfish.Service/Domain/Aggregates/AppInfo.cs
index 4fdc5c9..ec92dd8 100644
--- a/Source/Starfish.Service/Domain/Aggregates/AppInfo.cs
+++ b/Source/Starfish.Service/Domain/Aggregates/AppInfo.cs
@@ -20,7 +20,7 @@ private AppInfo()
{
}
- private AppInfo(int teamId)
+ private AppInfo(long teamId)
: this()
{
TeamId = teamId;
@@ -29,7 +29,7 @@ private AppInfo(int teamId)
///
/// 团队Id
///
- public int TeamId { get; set; }
+ public long TeamId { get; set; }
///
/// 名称
@@ -73,7 +73,7 @@ private AppInfo(int teamId)
///
///
///
- internal static AppInfo Create(int teamId, string name, string code)
+ internal static AppInfo Create(long teamId, string name, string code)
{
var entity = new AppInfo(teamId);
entity.SetCode(code);
diff --git a/Source/Starfish.Service/Domain/Aggregates/Team.cs b/Source/Starfish.Service/Domain/Aggregates/Team.cs
index 4f09bd3..06cff70 100644
--- a/Source/Starfish.Service/Domain/Aggregates/Team.cs
+++ b/Source/Starfish.Service/Domain/Aggregates/Team.cs
@@ -6,7 +6,7 @@ namespace Nerosoft.Starfish.Domain;
///
/// 团队聚合根对象
///
-public sealed class Team : Aggregate,
+public sealed class Team : Aggregate,
IAuditing
{
public string Alias { get; set; }
@@ -15,7 +15,7 @@ public sealed class Team : Aggregate,
public string Description { get; set; }
- public int OwnerId { get; set; }
+ public long OwnerId { get; set; }
public int MemberCount { get; set; }
@@ -29,7 +29,7 @@ public sealed class Team : Aggregate,
public HashSet Members { get; set; }
- internal static Team Create(string name, string description, int ownerId)
+ internal static Team Create(string name, string description, long ownerId)
{
var team = new Team
{
@@ -72,7 +72,7 @@ internal void SetDescription(string description)
Description = description;
}
- internal void AddMember(int userId)
+ internal void AddMember(long userId)
{
Members ??= [];
@@ -86,7 +86,7 @@ internal void AddMember(int userId)
MemberCount++;
}
- internal void RemoveMember(int userId)
+ internal void RemoveMember(long userId)
{
if (Members == null || Members.All(t => t.UserId != userId))
{
diff --git a/Source/Starfish.Service/Domain/Aggregates/TeamMember.cs b/Source/Starfish.Service/Domain/Aggregates/TeamMember.cs
index ea07b0d..4a689e4 100644
--- a/Source/Starfish.Service/Domain/Aggregates/TeamMember.cs
+++ b/Source/Starfish.Service/Domain/Aggregates/TeamMember.cs
@@ -5,21 +5,21 @@ namespace Nerosoft.Starfish.Domain;
///
/// 团队成员实体
///
-public sealed class TeamMember : Entity, IHasCreateTime
+public sealed class TeamMember : Entity, IHasCreateTime
{
private TeamMember()
{
}
- private TeamMember(int userId)
+ private TeamMember(long userId)
: this()
{
UserId = userId;
}
- public int UserId { get; set; }
+ public long UserId { get; set; }
- public int TeamId { get; set; }
+ public long TeamId { get; set; }
public DateTime CreateTime { get; set; }
@@ -27,7 +27,7 @@ private TeamMember(int userId)
public Team Team { get; set; }
- internal static TeamMember Create(int userId)
+ internal static TeamMember Create(long userId)
{
return new TeamMember(userId);
}
diff --git a/Source/Starfish.Service/Domain/Aggregates/Token.cs b/Source/Starfish.Service/Domain/Aggregates/Token.cs
index b73741b..80ec73c 100644
--- a/Source/Starfish.Service/Domain/Aggregates/Token.cs
+++ b/Source/Starfish.Service/Domain/Aggregates/Token.cs
@@ -6,7 +6,7 @@ namespace Nerosoft.Starfish.Domain;
///
/// 令牌
///
-public class Token : Entity
+public class Token : Entity
{
///
/// 初始化实例。
diff --git a/Source/Starfish.Service/Domain/Aggregates/User.cs b/Source/Starfish.Service/Domain/Aggregates/User.cs
index d6289df..c35c38b 100644
--- a/Source/Starfish.Service/Domain/Aggregates/User.cs
+++ b/Source/Starfish.Service/Domain/Aggregates/User.cs
@@ -6,7 +6,7 @@ namespace Nerosoft.Starfish.Domain;
///
/// 用户聚合根
///
-public sealed class User : Aggregate, IHasCreateTime, IHasUpdateTime, ITombstone
+public sealed class User : Aggregate, IHasCreateTime, IHasUpdateTime, ITombstone
{
///
/// 初始化实例
@@ -17,7 +17,7 @@ public sealed class User : Aggregate, IHasCreateTime, IHasUpdateTime, ITomb
private User()
{
}
-
+
///
/// 初始化用户聚合根
///
@@ -78,6 +78,11 @@ private User(string userName, string passwordHash, string passwordSalt)
/// 预留账号不允许删除、设置角色等
public bool Reserved { get; set; }
+ ///
+ /// 来源
+ ///
+ public int Source { get; set; }
+
///
/// 创建时间
///
diff --git a/Source/Starfish.Service/Domain/Aggregates/UserRole.cs b/Source/Starfish.Service/Domain/Aggregates/UserRole.cs
index b12e645..b3b71ce 100644
--- a/Source/Starfish.Service/Domain/Aggregates/UserRole.cs
+++ b/Source/Starfish.Service/Domain/Aggregates/UserRole.cs
@@ -5,7 +5,7 @@ namespace Nerosoft.Starfish.Domain;
///
/// 用户角色
///
-public class UserRole : Entity
+public class UserRole : Entity
{
private UserRole()
{
@@ -20,7 +20,7 @@ private UserRole(string name)
///
/// 用户Id
///
- public int UserId { get; set; }
+ public long UserId { get; set; }
///
/// 角色名称
diff --git a/Source/Starfish.Service/Domain/Business/AppInfoGeneralBusiness.cs b/Source/Starfish.Service/Domain/Business/AppInfoGeneralBusiness.cs
index 7558fa8..b570538 100644
--- a/Source/Starfish.Service/Domain/Business/AppInfoGeneralBusiness.cs
+++ b/Source/Starfish.Service/Domain/Business/AppInfoGeneralBusiness.cs
@@ -18,7 +18,7 @@ public class AppInfoGeneralBusiness : EditableObjectBase
internal AppInfo Aggregate { get; private set; }
public static readonly PropertyInfo IdProperty = RegisterProperty(p => p.Id);
- public static readonly PropertyInfo TeamIdProperty = RegisterProperty(p => p.TeamId);
+ public static readonly PropertyInfo TeamIdProperty = RegisterProperty(p => p.TeamId);
public static readonly PropertyInfo NameProperty = RegisterProperty(p => p.Name);
public static readonly PropertyInfo CodeProperty = RegisterProperty(p => p.Code);
public static readonly PropertyInfo SecretProperty = RegisterProperty(p => p.Secret);
@@ -30,7 +30,7 @@ public long Id
set => LoadProperty(IdProperty, value);
}
- public int TeamId
+ public long TeamId
{
get => GetProperty(TeamIdProperty);
set => SetProperty(TeamIdProperty, value);
@@ -73,7 +73,7 @@ protected override Task CreateAsync(CancellationToken cancellationToken = defaul
}
[FactoryFetch]
- protected async Task FetchAsync(int id, CancellationToken cancellationToken = default)
+ protected async Task FetchAsync(long id, CancellationToken cancellationToken = default)
{
var aggregate = await AppInfoRepository.GetAsync(id, true, [], cancellationToken);
@@ -148,7 +148,7 @@ public override async Task ExecuteAsync(IRuleContext context, CancellationToken
}
var team = await target.TeamRepository.GetAsync(target.TeamId, false, cancellationToken);
- if (team.OwnerId != target.Identity.GetUserIdOfInt32())
+ if (team.OwnerId != target.Identity.GetUserIdOfInt64())
{
context.AddErrorResult(Resources.IDS_ERROR_TEAM_ONLY_ALLOW_OWNER_CHANGE_MEMBER);
}
diff --git a/Source/Starfish.Service/Domain/Business/AppInfoSecretBusiness.cs b/Source/Starfish.Service/Domain/Business/AppInfoSecretBusiness.cs
index a312429..1bca7e3 100644
--- a/Source/Starfish.Service/Domain/Business/AppInfoSecretBusiness.cs
+++ b/Source/Starfish.Service/Domain/Business/AppInfoSecretBusiness.cs
@@ -25,7 +25,7 @@ protected async Task ExecuteAsync(long id, string secret, CancellationToken canc
}
var team = await TeamRepository.GetAsync(aggregate.TeamId, false, cancellationToken);
- if (team.OwnerId != Identity.GetUserIdOfInt32())
+ if (team.OwnerId != Identity.GetUserIdOfInt64())
{
throw new UnauthorizedAccessException(Resources.IDS_ERROR_TEAM_ONLY_ALLOW_OWNER_CHANGE_MEMBER);
}
diff --git a/Source/Starfish.Service/Domain/Business/AppInfoStatusBusiness.cs b/Source/Starfish.Service/Domain/Business/AppInfoStatusBusiness.cs
index 798eafc..8637292 100644
--- a/Source/Starfish.Service/Domain/Business/AppInfoStatusBusiness.cs
+++ b/Source/Starfish.Service/Domain/Business/AppInfoStatusBusiness.cs
@@ -25,7 +25,7 @@ protected async Task ExecuteAsync(long id, AppStatus status, CancellationToken c
}
var team = await TeamRepository.GetAsync(aggregate.TeamId, false, cancellationToken);
- if (team.OwnerId != Identity.GetUserIdOfInt32())
+ if (team.OwnerId != Identity.GetUserIdOfInt64())
{
throw new UnauthorizedAccessException(Resources.IDS_ERROR_TEAM_ONLY_ALLOW_OWNER_CHANGE_MEMBER);
}
@@ -40,7 +40,7 @@ protected async Task ExecuteAsync(long id, AppStatus status, CancellationToken c
break;
case AppStatus.None:
default:
- throw new InvalidAppInfoStatusException(Resources.IDS_ERROR_APPINFO_STATUS_INVALID);
+ throw new ArgumentOutOfRangeException(Resources.IDS_ERROR_APPINFO_STATUS_INVALID);
}
await AppInfoRepository.UpdateAsync(aggregate, true, cancellationToken);
diff --git a/Source/Starfish.Service/Domain/Business/SettingGeneralBusiness.cs b/Source/Starfish.Service/Domain/Business/SettingGeneralBusiness.cs
index e7f8ec0..f89bdf8 100644
--- a/Source/Starfish.Service/Domain/Business/SettingGeneralBusiness.cs
+++ b/Source/Starfish.Service/Domain/Business/SettingGeneralBusiness.cs
@@ -88,6 +88,17 @@ protected async Task FetchAsync(long appId, string environment, CancellationToke
protected override async Task InsertAsync(CancellationToken cancellationToken = default)
{
var appInfo = await AppInfoRepository.GetAsync(AppId, cancellationToken);
+
+ if (appInfo == null)
+ {
+ throw new AppInfoNotFoundException(AppId);
+ }
+
+ if (appInfo.Status != AppStatus.Enabled)
+ {
+ throw new AppInfoNotEnabledException(AppId);
+ }
+
var aggregate = Setting.Create(AppId, Environment, Items);
await SettingRepository.InsertAsync(aggregate, true, cancellationToken);
Id = aggregate.Id;
diff --git a/Source/Starfish.Service/Domain/Business/TeamGeneralBusiness.cs b/Source/Starfish.Service/Domain/Business/TeamGeneralBusiness.cs
index 5dd8fd3..b61e433 100644
--- a/Source/Starfish.Service/Domain/Business/TeamGeneralBusiness.cs
+++ b/Source/Starfish.Service/Domain/Business/TeamGeneralBusiness.cs
@@ -13,12 +13,12 @@ public class TeamGeneralBusiness : EditableObjectBase, IDom
private Team Aggregate { get; set; }
- public static readonly PropertyInfo IdProperty = RegisterProperty(p => p.Id);
+ public static readonly PropertyInfo IdProperty = RegisterProperty(p => p.Id);
public static readonly PropertyInfo NameProperty = RegisterProperty(p => p.Name);
public static readonly PropertyInfo AliasProperty = RegisterProperty(p => p.Alias);
public static readonly PropertyInfo DescriptionProperty = RegisterProperty(p => p.Description);
- public int Id
+ public long Id
{
get => GetProperty(IdProperty);
private set => LoadProperty(IdProperty, value);
@@ -54,7 +54,7 @@ protected override Task CreateAsync(CancellationToken cancellationToken = defaul
}
[FactoryFetch]
- protected async Task FetchAsync(int id, CancellationToken cancellationToken = default)
+ protected async Task FetchAsync(long id, CancellationToken cancellationToken = default)
{
var aggregate = await TeamRepository.GetAsync(id, true, [], cancellationToken);
@@ -72,7 +72,7 @@ protected async Task FetchAsync(int id, CancellationToken cancellationToken = de
[FactoryInsert]
protected override Task InsertAsync(CancellationToken cancellationToken = default)
{
- var team = Team.Create(Name, Description, Identity.GetUserIdOfInt32());
+ var team = Team.Create(Name, Description, Identity.GetUserIdOfInt64());
if (!string.IsNullOrWhiteSpace(Alias))
{
team.SetAlias(Alias);
@@ -115,7 +115,7 @@ public override Task ExecuteAsync(IRuleContext context, CancellationToken cancel
if (!target.IsInsert)
{
- if (target.Aggregate.OwnerId != target.Identity.GetUserIdOfInt32())
+ if (target.Aggregate.OwnerId != target.Identity.GetUserIdOfInt64())
{
context.AddErrorResult(Resources.IDS_ERROR_TEAM_ONLY_ALLOW_OWNER_UPDATE);
}
diff --git a/Source/Starfish.Service/Domain/Business/TeamMemberBusiness.cs b/Source/Starfish.Service/Domain/Business/TeamMemberBusiness.cs
index 626692c..1ce1019 100644
--- a/Source/Starfish.Service/Domain/Business/TeamMemberBusiness.cs
+++ b/Source/Starfish.Service/Domain/Business/TeamMemberBusiness.cs
@@ -16,9 +16,9 @@ public class TeamMemberBusiness : EditableObjectBase
private Team Aggregate { get; set; }
- public static readonly PropertyInfo UserIdsProperty = RegisterProperty(p => p.UserIds);
+ public static readonly PropertyInfo UserIdsProperty = RegisterProperty(p => p.UserIds);
- public int[] UserIds
+ public long[] UserIds
{
get => GetProperty(UserIdsProperty);
set => SetProperty(UserIdsProperty, value);
@@ -31,7 +31,7 @@ protected override void AddRules()
}
[FactoryFetch]
- protected async Task FetchAsync(int id, CancellationToken cancellationToken = default)
+ protected async Task FetchAsync(long id, CancellationToken cancellationToken = default)
{
var aggregate = await TeamRepository.GetAsync(id, true, [nameof(Team.Members)], cancellationToken);
@@ -87,7 +87,7 @@ public override Task ExecuteAsync(IRuleContext context, CancellationToken cancel
{
var target = (TeamMemberBusiness)context.Target;
- if (target.Aggregate.OwnerId != target.Identity.GetUserIdOfInt32())
+ if (target.Aggregate.OwnerId != target.Identity.GetUserIdOfInt64())
{
context.AddErrorResult(Resources.IDS_ERROR_TEAM_ONLY_ALLOW_OWNER_CHANGE_MEMBER);
}
diff --git a/Source/Starfish.Service/Domain/Business/UserGeneralBusiness.cs b/Source/Starfish.Service/Domain/Business/UserGeneralBusiness.cs
index 9939d2e..4bdd1e8 100644
--- a/Source/Starfish.Service/Domain/Business/UserGeneralBusiness.cs
+++ b/Source/Starfish.Service/Domain/Business/UserGeneralBusiness.cs
@@ -22,7 +22,7 @@ public UserGeneralBusiness(IServiceProvider provider)
private User Aggregate { get; set; }
- public static readonly PropertyInfo IdProperty = RegisterProperty(p => p.Id);
+ public static readonly PropertyInfo IdProperty = RegisterProperty(p => p.Id);
public static readonly PropertyInfo UserNameProperty = RegisterProperty(p => p.UserName);
public static readonly PropertyInfo PasswordProperty = RegisterProperty(p => p.Password);
public static readonly PropertyInfo NickNameProperty = RegisterProperty(p => p.NickName);
@@ -30,7 +30,7 @@ public UserGeneralBusiness(IServiceProvider provider)
public static readonly PropertyInfo PhoneProperty = RegisterProperty(p => p.Phone);
public static readonly PropertyInfo> RolesProperty = RegisterProperty>(p => p.Roles);
- public int Id
+ public long Id
{
get => GetProperty(IdProperty);
private set => LoadProperty(IdProperty, value);
@@ -87,7 +87,7 @@ protected override Task CreateAsync(CancellationToken cancellationToken = defaul
}
[FactoryFetch]
- protected async Task FetchAsync(int id, CancellationToken cancellationToken = default)
+ protected async Task FetchAsync(long id, CancellationToken cancellationToken = default)
{
var user = await Repository.GetAsync(id, query => query.AsTracking().Include(nameof(User.Roles)), cancellationToken);
diff --git a/Source/Starfish.Service/Domain/Exceptions/AppInfoNotEnabledException.cs b/Source/Starfish.Service/Domain/Exceptions/AppInfoNotEnabledException.cs
new file mode 100644
index 0000000..4323a70
--- /dev/null
+++ b/Source/Starfish.Service/Domain/Exceptions/AppInfoNotEnabledException.cs
@@ -0,0 +1,9 @@
+namespace Nerosoft.Starfish.Domain;
+
+public class AppInfoNotEnabledException : BadRequestException
+{
+ public AppInfoNotEnabledException(long appId)
+ : base(string.Format(Resources.IDS_ERROR_APPINFO_NOT_ENABLED, appId))
+ {
+ }
+}
\ No newline at end of file
diff --git a/Source/Starfish.Service/Domain/Exceptions/InvalidAppInfoStatusException.cs b/Source/Starfish.Service/Domain/Exceptions/InvalidAppInfoStatusException.cs
index 32f0c90..7ff95d2 100644
--- a/Source/Starfish.Service/Domain/Exceptions/InvalidAppInfoStatusException.cs
+++ b/Source/Starfish.Service/Domain/Exceptions/InvalidAppInfoStatusException.cs
@@ -5,10 +5,11 @@
///
public class InvalidAppInfoStatusException : BadRequestException
{
- ///
- /// 构造函数
- ///
- ///
+ public InvalidAppInfoStatusException()
+ : base(Resources.IDS_ERROR_APPINFO_STATUS_INVALID)
+ {
+ }
+
public InvalidAppInfoStatusException(string message)
: base(message)
{
diff --git a/Source/Starfish.Service/Domain/Exceptions/TeamNotFoundException.cs b/Source/Starfish.Service/Domain/Exceptions/TeamNotFoundException.cs
index 536be5c..712a71e 100644
--- a/Source/Starfish.Service/Domain/Exceptions/TeamNotFoundException.cs
+++ b/Source/Starfish.Service/Domain/Exceptions/TeamNotFoundException.cs
@@ -2,7 +2,7 @@
public class TeamNotFoundException : NotFoundException
{
- public TeamNotFoundException(int id)
+ public TeamNotFoundException(long id)
: base(string.Format(Resources.IDS_ERROR_TEAM_NOT_EXISTS, id))
{
}
diff --git a/Source/Starfish.Service/Domain/Exceptions/UserNotFoundException.cs b/Source/Starfish.Service/Domain/Exceptions/UserNotFoundException.cs
index e93b63b..812baf5 100644
--- a/Source/Starfish.Service/Domain/Exceptions/UserNotFoundException.cs
+++ b/Source/Starfish.Service/Domain/Exceptions/UserNotFoundException.cs
@@ -9,7 +9,7 @@ public class UserNotFoundException : NotFoundException
/// 初始化实例。
///
///
- public UserNotFoundException(int id)
+ public UserNotFoundException(long id)
: base(string.Format(Resources.IDS_ERROR_USER_NOT_EXISTS, id))
{
}
diff --git a/Source/Starfish.Service/Domain/Repositories/ITeamRepository.cs b/Source/Starfish.Service/Domain/Repositories/ITeamRepository.cs
index 92add5a..915678b 100644
--- a/Source/Starfish.Service/Domain/Repositories/ITeamRepository.cs
+++ b/Source/Starfish.Service/Domain/Repositories/ITeamRepository.cs
@@ -3,7 +3,7 @@
namespace Nerosoft.Starfish.Domain;
-public interface ITeamRepository : IBaseRepository
+public interface ITeamRepository : IBaseRepository
{
///
/// 查询指定用户所属团队
@@ -11,7 +11,7 @@ public interface ITeamRepository : IBaseRepository
///
///
///
- Task> GetTeamsOfUserAsync(int userId, CancellationToken cancellationToken = default);
+ Task> GetTeamsOfUserAsync(long userId, CancellationToken cancellationToken = default);
- Task> GetMembersAsync(int id, CancellationToken cancellationToken = default);
+ Task> GetMembersAsync(long id, CancellationToken cancellationToken = default);
}
\ No newline at end of file
diff --git a/Source/Starfish.Service/Domain/Repositories/ITokenRepository.cs b/Source/Starfish.Service/Domain/Repositories/ITokenRepository.cs
index fd52f36..f9e19c2 100644
--- a/Source/Starfish.Service/Domain/Repositories/ITokenRepository.cs
+++ b/Source/Starfish.Service/Domain/Repositories/ITokenRepository.cs
@@ -6,6 +6,6 @@ namespace Nerosoft.Starfish.Domain;
///
/// 令牌仓储接口
///
-public interface ITokenRepository : IBaseRepository
+public interface ITokenRepository : IBaseRepository
{
}
\ No newline at end of file
diff --git a/Source/Starfish.Service/Domain/Repositories/IUserRepository.cs b/Source/Starfish.Service/Domain/Repositories/IUserRepository.cs
index 60d3953..3046704 100644
--- a/Source/Starfish.Service/Domain/Repositories/IUserRepository.cs
+++ b/Source/Starfish.Service/Domain/Repositories/IUserRepository.cs
@@ -6,7 +6,7 @@ namespace Nerosoft.Starfish.Domain;
///
/// 用户仓储接口
///
-public interface IUserRepository : IBaseRepository
+public interface IUserRepository : IBaseRepository
{
///
/// 根据用户名查询用户
@@ -32,7 +32,7 @@ public interface IUserRepository : IBaseRepository
///
///
///
- Task CheckEmailExistsAsync(string email, int ignoreId, CancellationToken cancellationToken = default);
+ Task CheckEmailExistsAsync(string email, long ignoreId, CancellationToken cancellationToken = default);
///
/// 检查手机号是否存在
@@ -41,5 +41,5 @@ public interface IUserRepository : IBaseRepository
///
///
///
- Task CheckPhoneExistsAsync(string phone, int ignoreId, CancellationToken cancellationToken = default);
+ Task CheckPhoneExistsAsync(string phone, long ignoreId, CancellationToken cancellationToken = default);
}
\ No newline at end of file
diff --git a/Source/Starfish.Service/Properties/Resources.resx b/Source/Starfish.Service/Properties/Resources.resx
index 10e1a50..226887b 100644
--- a/Source/Starfish.Service/Properties/Resources.resx
+++ b/Source/Starfish.Service/Properties/Resources.resx
@@ -159,6 +159,9 @@
App unique code is not available.
+
+ App not enabled, [Id]:{0}.
+
App not exists, [Id]:{0}.
diff --git a/Source/Starfish.Service/Properties/Resources.zh-Hans.resx b/Source/Starfish.Service/Properties/Resources.zh-Hans.resx
index 4b2eb0c..ff081b8 100644
--- a/Source/Starfish.Service/Properties/Resources.zh-Hans.resx
+++ b/Source/Starfish.Service/Properties/Resources.zh-Hans.resx
@@ -159,6 +159,9 @@
应用唯一编码不可用。
+
+ 应用没有启用,[Id]:{0}。
+
应用不存在,[Id]:{0}。
diff --git a/Source/Starfish.Service/Properties/Resources.zh-Hant.resx b/Source/Starfish.Service/Properties/Resources.zh-Hant.resx
index e210119..2dd7315 100644
--- a/Source/Starfish.Service/Properties/Resources.zh-Hant.resx
+++ b/Source/Starfish.Service/Properties/Resources.zh-Hant.resx
@@ -139,6 +139,9 @@
應用程式唯一代碼不可用。
+
+ 應用程式沒有啟用,[Id]:{0}。
+
應用程式不存在,[Id]:{0}。
diff --git a/Source/Starfish.Service/Repository/Contexts/InMemoryModelBuilder.cs b/Source/Starfish.Service/Repository/Contexts/InMemoryModelBuilder.cs
index 357f7ed..46d663a 100644
--- a/Source/Starfish.Service/Repository/Contexts/InMemoryModelBuilder.cs
+++ b/Source/Starfish.Service/Repository/Contexts/InMemoryModelBuilder.cs
@@ -13,12 +13,191 @@ public class InMemoryModelBuilder : IModelBuilder
///
public void Configure(ModelBuilder modelBuilder)
{
- modelBuilder.Entity()
- .Property(t => t.Id);
- modelBuilder.Entity()
- .Property(t => t.Id);
- modelBuilder.Entity()
- .Property(t => t.Id)
- .HasValueGenerator();
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("user");
+
+ entity.HasKey(t => t.Id);
+
+ entity.HasIndex(t => t.UserName)
+ .IsUnique();
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
+ entity.HasMany(t => t.Roles)
+ .WithOne(t => t.User)
+ .HasForeignKey(t => t.UserId);
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("user_role");
+
+ entity.HasKey(t => t.Id);
+
+ entity.HasIndex([nameof(UserRole.UserId), nameof(UserRole.Name)], "IDX_USER_ROLE_UNIQUE")
+ .IsUnique();
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
+ entity.HasOne(t => t.User)
+ .WithMany(t => t.Roles)
+ .HasForeignKey(t => t.UserId);
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("token");
+
+ entity.HasKey(t => t.Id);
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+ });
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("operate_log");
+
+ entity.HasKey(t => t.Id);
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+ });
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("app_info");
+ entity.HasKey(t => t.Id);
+ entity.HasIndex(t => t.Code);
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("setting");
+ entity.HasKey(t => t.Id);
+ entity.HasIndex(t => t.AppId);
+ entity.HasIndex(t => t.Environment);
+
+ entity.HasIndex([nameof(Setting.AppId), nameof(Setting.Environment)], "IDX_SETTING_UNIQUE")
+ .IsUnique();
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
+ entity.HasOne(t => t.App)
+ .WithMany()
+ .HasForeignKey(t => t.AppId)
+ .OnDelete(DeleteBehavior.Cascade);
+
+ entity.HasMany(t => t.Items)
+ .WithOne()
+ .HasForeignKey(t => t.SettingId)
+ .OnDelete(DeleteBehavior.Cascade);
+
+ entity.HasMany(t => t.Revisions)
+ .WithOne()
+ .HasForeignKey(t => t.SettingId)
+ .OnDelete(DeleteBehavior.Cascade);
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("setting_item");
+ entity.HasKey(t => t.Id);
+ entity.HasIndex(t => t.SettingId);
+
+ entity.HasIndex(t => t.Key);
+
+ entity.HasIndex([nameof(SettingItem.SettingId), nameof(SettingItem.Key)], "IDX_SETTING_ITEM_UNIQUE")
+ .IsUnique();
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
+ entity.HasOne(t => t.Setting)
+ .WithMany(t => t.Items)
+ .HasForeignKey(t => t.SettingId)
+ .OnDelete(DeleteBehavior.Cascade);
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("setting_revision");
+ entity.HasKey(t => t.Id);
+ entity.HasIndex(t => t.SettingId);
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
+ entity.HasOne(t => t.Setting)
+ .WithMany(t => t.Revisions)
+ .HasForeignKey(t => t.SettingId)
+ .OnDelete(DeleteBehavior.Cascade);
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("setting_archive");
+ entity.HasKey(t => t.Id);
+ entity.HasIndex(t => t.AppId)
+ .HasDatabaseName("IDX_SETTING_ARCHIVE_APP_ID");
+ entity.HasIndex([nameof(SettingArchive.AppId), nameof(SettingArchive.Environment)], "IDX_SETTING_ARCHIVE_UNIQUE")
+ .IsUnique();
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("team");
+ entity.HasKey(t => t.Id);
+
+ entity.HasIndex(t => t.Alias).HasDatabaseName("IDX_TEAM_ALIAS").IsUnique();
+ entity.HasIndex(t => t.Name).HasDatabaseName("IDX_TEAM_NAME");
+ entity.HasIndex(t => t.OwnerId).HasDatabaseName("IDX_TEAM_OWNER");
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
+ entity.HasMany(t => t.Members)
+ .WithOne(t => t.Team)
+ .HasForeignKey(t => t.TeamId);
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("team_member");
+ entity.HasKey(t => t.Id);
+
+ entity.HasIndex([nameof(TeamMember.TeamId), nameof(TeamMember.UserId)], "IDX_TEAM_MEMBER_UNIQUE")
+ .IsUnique();
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
+ entity.HasOne(t => t.Team)
+ .WithMany(t => t.Members)
+ .HasForeignKey(t => t.TeamId);
+
+ entity.HasOne(t => t.User)
+ .WithMany()
+ .HasForeignKey(t => t.UserId);
+ });
}
}
\ No newline at end of file
diff --git a/Source/Starfish.Service/Repository/Contexts/MssqlModelBuilder.cs b/Source/Starfish.Service/Repository/Contexts/MssqlModelBuilder.cs
index ce5fb1e..3c3b15e 100644
--- a/Source/Starfish.Service/Repository/Contexts/MssqlModelBuilder.cs
+++ b/Source/Starfish.Service/Repository/Contexts/MssqlModelBuilder.cs
@@ -1,4 +1,6 @@
using Microsoft.EntityFrameworkCore;
+using Nerosoft.Euonia.Repository.EfCore;
+using Nerosoft.Starfish.Domain;
using Nerosoft.Starfish.Service;
namespace Nerosoft.Starfish.Repository;
@@ -7,6 +9,191 @@ internal class MssqlModelBuilder : IModelBuilder
{
public void Configure(ModelBuilder modelBuilder)
{
- throw new NotImplementedException();
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("user");
+
+ entity.HasKey(t => t.Id);
+
+ entity.HasIndex(t => t.UserName)
+ .IsUnique();
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
+ entity.HasMany(t => t.Roles)
+ .WithOne(t => t.User)
+ .HasForeignKey(t => t.UserId);
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("user_role");
+
+ entity.HasKey(t => t.Id);
+
+ entity.HasIndex([nameof(UserRole.UserId), nameof(UserRole.Name)], "IDX_USER_ROLE_UNIQUE")
+ .IsUnique();
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
+ entity.HasOne(t => t.User)
+ .WithMany(t => t.Roles)
+ .HasForeignKey(t => t.UserId);
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("token");
+
+ entity.HasKey(t => t.Id);
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+ });
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("operate_log");
+
+ entity.HasKey(t => t.Id);
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+ });
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("app_info");
+ entity.HasKey(t => t.Id);
+ entity.HasIndex(t => t.Code);
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("setting");
+ entity.HasKey(t => t.Id);
+ entity.HasIndex(t => t.AppId);
+ entity.HasIndex(t => t.Environment);
+
+ entity.HasIndex([nameof(Setting.AppId), nameof(Setting.Environment)], "IDX_SETTING_UNIQUE")
+ .IsUnique();
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
+ entity.HasOne(t => t.App)
+ .WithMany()
+ .HasForeignKey(t => t.AppId)
+ .OnDelete(DeleteBehavior.Cascade);
+
+ entity.HasMany(t => t.Items)
+ .WithOne()
+ .HasForeignKey(t => t.SettingId)
+ .OnDelete(DeleteBehavior.Cascade);
+
+ entity.HasMany(t => t.Revisions)
+ .WithOne()
+ .HasForeignKey(t => t.SettingId)
+ .OnDelete(DeleteBehavior.Cascade);
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("setting_item");
+ entity.HasKey(t => t.Id);
+ entity.HasIndex(t => t.SettingId);
+
+ entity.HasIndex(t => t.Key);
+
+ entity.HasIndex([nameof(SettingItem.SettingId), nameof(SettingItem.Key)], "IDX_SETTING_ITEM_UNIQUE")
+ .IsUnique();
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
+ entity.HasOne(t => t.Setting)
+ .WithMany(t => t.Items)
+ .HasForeignKey(t => t.SettingId)
+ .OnDelete(DeleteBehavior.Cascade);
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("setting_revision");
+ entity.HasKey(t => t.Id);
+ entity.HasIndex(t => t.SettingId);
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
+ entity.HasOne(t => t.Setting)
+ .WithMany(t => t.Revisions)
+ .HasForeignKey(t => t.SettingId)
+ .OnDelete(DeleteBehavior.Cascade);
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("setting_archive");
+ entity.HasKey(t => t.Id);
+ entity.HasIndex(t => t.AppId)
+ .HasDatabaseName("IDX_SETTING_ARCHIVE_APP_ID");
+ entity.HasIndex([nameof(SettingArchive.AppId), nameof(SettingArchive.Environment)], "IDX_SETTING_ARCHIVE_UNIQUE")
+ .IsUnique();
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("team");
+ entity.HasKey(t => t.Id);
+
+ entity.HasIndex(t => t.Alias).IsUnique();
+ entity.HasIndex(t => t.Name);
+ entity.HasIndex(t => t.OwnerId);
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
+ entity.HasMany(t => t.Members)
+ .WithOne(t => t.Team)
+ .HasForeignKey(t => t.TeamId);
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("team_member");
+ entity.HasKey(t => t.Id);
+
+ entity.HasIndex([nameof(TeamMember.TeamId), nameof(TeamMember.UserId)], "IDX_TEAM_MEMBER_UNIQUE")
+ .IsUnique();
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
+ entity.HasOne(t => t.Team)
+ .WithMany(t => t.Members)
+ .HasForeignKey(t => t.TeamId);
+
+ entity.HasOne(t => t.User)
+ .WithMany()
+ .HasForeignKey(t => t.UserId);
+ });
}
}
diff --git a/Source/Starfish.Service/Repository/Contexts/MysqlModelBuilder.cs b/Source/Starfish.Service/Repository/Contexts/MysqlModelBuilder.cs
index ec0bef2..d03c984 100644
--- a/Source/Starfish.Service/Repository/Contexts/MysqlModelBuilder.cs
+++ b/Source/Starfish.Service/Repository/Contexts/MysqlModelBuilder.cs
@@ -1,4 +1,6 @@
using Microsoft.EntityFrameworkCore;
+using Nerosoft.Euonia.Repository.EfCore;
+using Nerosoft.Starfish.Domain;
using Nerosoft.Starfish.Service;
namespace Nerosoft.Starfish.Repository;
@@ -7,6 +9,191 @@ internal class MysqlModelBuilder : IModelBuilder
{
public void Configure(ModelBuilder modelBuilder)
{
- throw new NotImplementedException();
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("user");
+
+ entity.HasKey(t => t.Id);
+
+ entity.HasIndex(t => t.UserName)
+ .IsUnique();
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
+ entity.HasMany(t => t.Roles)
+ .WithOne(t => t.User)
+ .HasForeignKey(t => t.UserId);
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("user_role");
+
+ entity.HasKey(t => t.Id);
+
+ entity.HasIndex([nameof(UserRole.UserId), nameof(UserRole.Name)], "IDX_USER_ROLE_UNIQUE")
+ .IsUnique();
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
+ entity.HasOne(t => t.User)
+ .WithMany(t => t.Roles)
+ .HasForeignKey(t => t.UserId);
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("token");
+
+ entity.HasKey(t => t.Id);
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+ });
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("operate_log");
+
+ entity.HasKey(t => t.Id);
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+ });
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("app_info");
+ entity.HasKey(t => t.Id);
+ entity.HasIndex(t => t.Code);
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("setting");
+ entity.HasKey(t => t.Id);
+ entity.HasIndex(t => t.AppId);
+ entity.HasIndex(t => t.Environment);
+
+ entity.HasIndex([nameof(Setting.AppId), nameof(Setting.Environment)], "IDX_SETTING_UNIQUE")
+ .IsUnique();
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
+ entity.HasOne(t => t.App)
+ .WithMany()
+ .HasForeignKey(t => t.AppId)
+ .OnDelete(DeleteBehavior.Cascade);
+
+ entity.HasMany(t => t.Items)
+ .WithOne()
+ .HasForeignKey(t => t.SettingId)
+ .OnDelete(DeleteBehavior.Cascade);
+
+ entity.HasMany(t => t.Revisions)
+ .WithOne()
+ .HasForeignKey(t => t.SettingId)
+ .OnDelete(DeleteBehavior.Cascade);
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("setting_item");
+ entity.HasKey(t => t.Id);
+ entity.HasIndex(t => t.SettingId);
+
+ entity.HasIndex(t => t.Key);
+
+ entity.HasIndex([nameof(SettingItem.SettingId), nameof(SettingItem.Key)], "IDX_SETTING_ITEM_UNIQUE")
+ .IsUnique();
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
+ entity.HasOne(t => t.Setting)
+ .WithMany(t => t.Items)
+ .HasForeignKey(t => t.SettingId)
+ .OnDelete(DeleteBehavior.Cascade);
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("setting_revision");
+ entity.HasKey(t => t.Id);
+ entity.HasIndex(t => t.SettingId);
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
+ entity.HasOne(t => t.Setting)
+ .WithMany(t => t.Revisions)
+ .HasForeignKey(t => t.SettingId)
+ .OnDelete(DeleteBehavior.Cascade);
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("setting_archive");
+ entity.HasKey(t => t.Id);
+ entity.HasIndex(t => t.AppId)
+ .HasDatabaseName("IDX_SETTING_ARCHIVE_APP_ID");
+ entity.HasIndex([nameof(SettingArchive.AppId), nameof(SettingArchive.Environment)], "IDX_SETTING_ARCHIVE_UNIQUE")
+ .IsUnique();
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("team");
+ entity.HasKey(t => t.Id);
+
+ entity.HasIndex(t => t.Alias).IsUnique();
+ entity.HasIndex(t => t.Name);
+ entity.HasIndex(t => t.OwnerId);
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
+ entity.HasMany(t => t.Members)
+ .WithOne(t => t.Team)
+ .HasForeignKey(t => t.TeamId);
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("team_member");
+ entity.HasKey(t => t.Id);
+
+ entity.HasIndex([nameof(TeamMember.TeamId), nameof(TeamMember.UserId)], "IDX_TEAM_MEMBER_UNIQUE")
+ .IsUnique();
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
+ entity.HasOne(t => t.Team)
+ .WithMany(t => t.Members)
+ .HasForeignKey(t => t.TeamId);
+
+ entity.HasOne(t => t.User)
+ .WithMany()
+ .HasForeignKey(t => t.UserId);
+ });
}
}
diff --git a/Source/Starfish.Service/Repository/Contexts/PgsqlModelBuilder.cs b/Source/Starfish.Service/Repository/Contexts/PgsqlModelBuilder.cs
index ebe4e6b..23d5213 100644
--- a/Source/Starfish.Service/Repository/Contexts/PgsqlModelBuilder.cs
+++ b/Source/Starfish.Service/Repository/Contexts/PgsqlModelBuilder.cs
@@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore;
+using Nerosoft.Euonia.Repository.EfCore;
using Nerosoft.Starfish.Domain;
using Nerosoft.Starfish.Service;
@@ -11,6 +12,188 @@ public void Configure(ModelBuilder modelBuilder)
modelBuilder.Entity(entity =>
{
entity.ToTable("user");
+
+ entity.HasKey(t => t.Id);
+
+ entity.HasIndex(t => t.UserName)
+ .IsUnique();
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
+ entity.HasMany(t => t.Roles)
+ .WithOne(t => t.User)
+ .HasForeignKey(t => t.UserId);
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("user_role");
+
+ entity.HasKey(t => t.Id);
+
+ entity.HasIndex([nameof(UserRole.UserId), nameof(UserRole.Name)], "IDX_USER_ROLE_UNIQUE")
+ .IsUnique();
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
+ entity.HasOne(t => t.User)
+ .WithMany(t => t.Roles)
+ .HasForeignKey(t => t.UserId);
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("token");
+
+ entity.HasKey(t => t.Id);
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+ });
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("operate_log");
+
+ entity.HasKey(t => t.Id);
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+ });
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("app_info");
+ entity.HasKey(t => t.Id);
+ entity.HasIndex(t => t.Code);
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("setting");
+ entity.HasKey(t => t.Id);
+ entity.HasIndex(t => t.AppId);
+ entity.HasIndex(t => t.Environment);
+
+ entity.HasIndex([nameof(Setting.AppId), nameof(Setting.Environment)], "IDX_SETTING_UNIQUE")
+ .IsUnique();
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
+ entity.HasOne(t => t.App)
+ .WithMany()
+ .HasForeignKey(t => t.AppId)
+ .OnDelete(DeleteBehavior.Cascade);
+
+ entity.HasMany(t => t.Items)
+ .WithOne()
+ .HasForeignKey(t => t.SettingId)
+ .OnDelete(DeleteBehavior.Cascade);
+
+ entity.HasMany(t => t.Revisions)
+ .WithOne()
+ .HasForeignKey(t => t.SettingId)
+ .OnDelete(DeleteBehavior.Cascade);
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("setting_item");
+ entity.HasKey(t => t.Id);
+ entity.HasIndex(t => t.SettingId);
+
+ entity.HasIndex(t => t.Key);
+
+ entity.HasIndex([nameof(SettingItem.SettingId), nameof(SettingItem.Key)], "IDX_SETTING_ITEM_UNIQUE")
+ .IsUnique();
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
+ entity.HasOne(t => t.Setting)
+ .WithMany(t => t.Items)
+ .HasForeignKey(t => t.SettingId)
+ .OnDelete(DeleteBehavior.Cascade);
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("setting_revision");
+ entity.HasKey(t => t.Id);
+ entity.HasIndex(t => t.SettingId);
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
+ entity.HasOne(t => t.Setting)
+ .WithMany(t => t.Revisions)
+ .HasForeignKey(t => t.SettingId)
+ .OnDelete(DeleteBehavior.Cascade);
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("setting_archive");
+ entity.HasKey(t => t.Id);
+ entity.HasIndex(t => t.AppId)
+ .HasDatabaseName("IDX_SETTING_ARCHIVE_APP_ID");
+ entity.HasIndex([nameof(SettingArchive.AppId), nameof(SettingArchive.Environment)], "IDX_SETTING_ARCHIVE_UNIQUE")
+ .IsUnique();
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("team");
+ entity.HasKey(t => t.Id);
+
+ entity.HasIndex(t => t.Alias).IsUnique();
+ entity.HasIndex(t => t.Name);
+ entity.HasIndex(t => t.OwnerId);
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
+ entity.HasMany(t => t.Members)
+ .WithOne(t => t.Team)
+ .HasForeignKey(t => t.TeamId);
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("team_member");
+ entity.HasKey(t => t.Id);
+
+ entity.HasIndex([nameof(TeamMember.TeamId), nameof(TeamMember.UserId)], "IDX_TEAM_MEMBER_UNIQUE")
+ .IsUnique();
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
+ entity.HasOne(t => t.Team)
+ .WithMany(t => t.Members)
+ .HasForeignKey(t => t.TeamId);
+
+ entity.HasOne(t => t.User)
+ .WithMany()
+ .HasForeignKey(t => t.UserId);
});
}
}
\ No newline at end of file
diff --git a/Source/Starfish.Service/Repository/Contexts/SqliteModelBuilder.cs b/Source/Starfish.Service/Repository/Contexts/SqliteModelBuilder.cs
index 6c8dd8b..d666629 100644
--- a/Source/Starfish.Service/Repository/Contexts/SqliteModelBuilder.cs
+++ b/Source/Starfish.Service/Repository/Contexts/SqliteModelBuilder.cs
@@ -22,6 +22,10 @@ public void Configure(ModelBuilder modelBuilder)
entity.HasIndex(t => t.UserName)
.IsUnique();
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
entity.HasMany(t => t.Roles)
.WithOne(t => t.User)
.HasForeignKey(t => t.UserId);
@@ -36,6 +40,10 @@ public void Configure(ModelBuilder modelBuilder)
entity.HasIndex([nameof(UserRole.UserId), nameof(UserRole.Name)], "IDX_USER_ROLE_UNIQUE")
.IsUnique();
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
entity.HasOne(t => t.User)
.WithMany(t => t.Roles)
.HasForeignKey(t => t.UserId);
@@ -44,10 +52,22 @@ public void Configure(ModelBuilder modelBuilder)
modelBuilder.Entity(entity =>
{
entity.ToTable("token");
+
+ entity.HasKey(t => t.Id);
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
});
modelBuilder.Entity(entity =>
{
entity.ToTable("operate_log");
+
+ entity.HasKey(t => t.Id);
+
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
});
modelBuilder.Entity(entity =>
{
@@ -150,6 +170,10 @@ public void Configure(ModelBuilder modelBuilder)
entity.HasIndex(t => t.Name);
entity.HasIndex(t => t.OwnerId);
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
entity.HasMany(t => t.Members)
.WithOne(t => t.Team)
.HasForeignKey(t => t.TeamId);
@@ -163,6 +187,10 @@ public void Configure(ModelBuilder modelBuilder)
entity.HasIndex([nameof(TeamMember.TeamId), nameof(TeamMember.UserId)], "IDX_TEAM_MEMBER_UNIQUE")
.IsUnique();
+ entity.Property(t => t.Id)
+ .IsRequired()
+ .HasValueGenerator();
+
entity.HasOne(t => t.Team)
.WithMany(t => t.Members)
.HasForeignKey(t => t.TeamId);
diff --git a/Source/Starfish.Service/Repository/Repositories/TeamRepository.cs b/Source/Starfish.Service/Repository/Repositories/TeamRepository.cs
index d53eede..a5740d6 100644
--- a/Source/Starfish.Service/Repository/Repositories/TeamRepository.cs
+++ b/Source/Starfish.Service/Repository/Repositories/TeamRepository.cs
@@ -5,14 +5,14 @@
namespace Nerosoft.Starfish.Repository;
-public class TeamRepository : BaseRepository, ITeamRepository
+public class TeamRepository : BaseRepository, ITeamRepository
{
public TeamRepository(IContextProvider provider)
: base(provider)
{
}
- public Task> GetTeamsOfUserAsync(int userId, CancellationToken cancellationToken = default)
+ public Task> GetTeamsOfUserAsync(long userId, CancellationToken cancellationToken = default)
{
var memberSet = Context.Set();
var teamSet = Context.Set();
@@ -23,7 +23,7 @@ join member in memberSet on team.Id equals member.TeamId
return query.ToListAsync(cancellationToken);
}
- public Task> GetMembersAsync(int id, CancellationToken cancellationToken = default)
+ public Task> GetMembersAsync(long id, CancellationToken cancellationToken = default)
{
var query = Context.Set()
.Include(t => t.User)
diff --git a/Source/Starfish.Service/Repository/Repositories/TokenRepository.cs b/Source/Starfish.Service/Repository/Repositories/TokenRepository.cs
index ca8dc89..9f40883 100644
--- a/Source/Starfish.Service/Repository/Repositories/TokenRepository.cs
+++ b/Source/Starfish.Service/Repository/Repositories/TokenRepository.cs
@@ -7,7 +7,7 @@ namespace Nerosoft.Starfish.Repository;
///
/// 令牌仓储
///
-public class TokenRepository : BaseRepository, ITokenRepository
+public class TokenRepository : BaseRepository, ITokenRepository
{
///
/// 初始化
diff --git a/Source/Starfish.Service/Repository/Repositories/UserRepository.cs b/Source/Starfish.Service/Repository/Repositories/UserRepository.cs
index 56cb227..1776344 100644
--- a/Source/Starfish.Service/Repository/Repositories/UserRepository.cs
+++ b/Source/Starfish.Service/Repository/Repositories/UserRepository.cs
@@ -8,7 +8,7 @@ namespace Nerosoft.Starfish.Repository;
///
/// 用户仓储
///
-public sealed class UserRepository : BaseRepository, IUserRepository
+public sealed class UserRepository : BaseRepository, IUserRepository
{
///
/// 初始化.
@@ -34,7 +34,7 @@ public Task CheckUserNameExistsAsync(string userName, CancellationToken ca
}
///
- public Task CheckEmailExistsAsync(string email, int ignoreId, CancellationToken cancellationToken = default)
+ public Task CheckEmailExistsAsync(string email, long ignoreId, CancellationToken cancellationToken = default)
{
ISpecification[] specifications =
[
@@ -45,7 +45,7 @@ public Task CheckEmailExistsAsync(string email, int ignoreId, Cancellation
return AnyAsync(predicate, null, cancellationToken);
}
- public Task CheckPhoneExistsAsync(string phone, int ignoreId, CancellationToken cancellationToken = default)
+ public Task CheckPhoneExistsAsync(string phone, long ignoreId, CancellationToken cancellationToken = default)
{
ISpecification[] specifications =
[
diff --git a/Source/Starfish.Service/Repository/Specifications/TeamSpecification.cs b/Source/Starfish.Service/Repository/Specifications/TeamSpecification.cs
index 268be5f..abe3985 100644
--- a/Source/Starfish.Service/Repository/Specifications/TeamSpecification.cs
+++ b/Source/Starfish.Service/Repository/Specifications/TeamSpecification.cs
@@ -5,7 +5,7 @@ namespace Nerosoft.Starfish.Repository;
internal static class TeamSpecification
{
- public static Specification