Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #16

Merged
merged 10 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -36,7 +36,7 @@ Starfish是一个轻量但功能强大的分布式 .NET 应用程序配置中心
- [ ] ⌛ Support multiple languages admin panel/支持多语言管理面板
- [x] 💚 en/英语
- [x] 💚 zh-Hans/简体中文
- [ ] 🕝 zh-Hant/繁体中文
- [ ] zh-Hant/繁体中文

## 💰 Donate/捐助
<img alt="" title="donate" width="512" src="https://qiniu-cdn.zhaorong.pro/images/donate.png" />
Expand Down Expand Up @@ -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
Expand Down
112 changes: 112 additions & 0 deletions Source/Starfish.Client/Properties/Resources.zh-Hant.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema

Version 1.3

The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.

Example:

... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>

There are any number of "resheader" rows that contain simple
name/value pairs.

Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.

The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:

Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.

mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="IDS_ERROR_APP_SECTION_NOT_FOUND" xml:space="preserve">
<value>沒有在Starfish找到App配置項目。</value>
</data>
<data name="IDS_ERROR_HOST_SECTION_NOT_FOUND" xml:space="preserve">
<value>沒有在Starfish找到Host配置項目。</value>
</data>
<data name="IDS_ERROR_SCHEMA_NOT_SUPPORTED" xml:space="preserve">
<value>不支援協定{0}。</value>
</data>
<data name="IDS_ERROR_STARFISH_SECTION_NOT_FOUND" xml:space="preserve">
<value>沒有找到Starfish配置項。</value>
</data>
</root>
14 changes: 2 additions & 12 deletions Source/Starfish.Service/Application/ApplicationServiceModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,8 @@ public override void ConfigureServices(ServiceConfigurationContext context)

context.Services.AddSingleton<ConnectionContainer>();

context.Services.AddSingleton<JsonConfigurationParser>();
context.Services.AddSingleton<TextConfigurationParser>();

context.Services.AddNamedService<IConfigurationParser>((name, provider) =>
{
return name switch
{
"json" => provider.GetService<JsonConfigurationParser>(),
"text" => provider.GetService<TextConfigurationParser>(),
_ => throw new NotSupportedException()
};
});
context.Services.AddKeyedSingleton<IConfigurationParser, JsonConfigurationParser>("json");
context.Services.AddKeyedSingleton<IConfigurationParser, TextConfigurationParser>("text");

ConfigureCachingServices(context.Services);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public ChangePasswordCommand()
{
}

public ChangePasswordCommand(int userId, string password)
public ChangePasswordCommand(long userId, string password)
: this()
{
UserId = userId;
Expand All @@ -21,7 +21,7 @@ public ChangePasswordCommand(int userId, string password)
/// <summary>
/// 用户Id
/// </summary>
public int UserId { get; set; }
public long UserId { get; set; }

/// <summary>
/// 新密码
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ namespace Nerosoft.Starfish.Application;
/// <summary>
/// 用户删除命令
/// </summary>
public sealed class UserDeleteCommand : Command<int>
public sealed class UserDeleteCommand : Command<long>
{
/// <summary>
/// 初始化<see cref="UserDeleteCommand"/>实例。
/// </summary>
/// <param name="userId"></param>
public UserDeleteCommand(int userId)
public UserDeleteCommand(long userId)
: base(userId)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Nerosoft.Starfish.Application;

public class UserRoleSetCommand : Command<int, List<string>>
public class UserRoleSetCommand : Command<long, List<string>>
{
public UserRoleSetCommand(int id, List<string> roles)
public UserRoleSetCommand(long id, List<string> roles)
: base(id, roles)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ namespace Nerosoft.Starfish.Application;
/// <summary>
/// 用户更新命令
/// </summary>
public sealed class UserUpdateCommand : Command<int, UserUpdateDto>
public sealed class UserUpdateCommand : Command<long, UserUpdateDto>
{
public UserUpdateCommand(int userId, UserUpdateDto data)
public UserUpdateCommand(long userId, UserUpdateDto data)
: base(userId, data)
{
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Nerosoft.Euonia.Domain;

namespace Nerosoft.Starfish.Application;
namespace Nerosoft.Starfish.Application;

/// <summary>
/// 删除配置节点命令
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Nerosoft.Euonia.Domain;

namespace Nerosoft.Starfish.Application;
namespace Nerosoft.Starfish.Application;

/// <summary>
/// 配置节点发布命令
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Nerosoft.Euonia.Domain;

namespace Nerosoft.Starfish.Application;
namespace Nerosoft.Starfish.Application;

public class SettingUpdateCommand : SettingAbstractCommand
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ namespace Nerosoft.Starfish.Application;

public class TeamMemberEditCommand : Command
{
public TeamMemberEditCommand(int teamId, List<int> userIds, string type)
public TeamMemberEditCommand(long teamId, List<long> userIds, string type)
{
TeamId = teamId;
UserIds = userIds;
Type = type;
}

public int TeamId { get; set; }
public long TeamId { get; set; }

public List<int> UserIds { get; set; }
public List<long> UserIds { get; set; }

public string Type { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,13 @@ public interface ISettingApplicationService : IApplicationService
/// <returns></returns>
Task<string> GetSettingRawAsync(long appId, string environment, CancellationToken cancellationToken = default);

Task<string> GetItemsInTextAsync(long appId, string environment, string type, CancellationToken cancellationToken = default);
/// <summary>
/// 获取指定格式的配置
/// </summary>
/// <param name="appId"></param>
/// <param name="environment"></param>
/// <param name="format"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<string> GetItemsInTextAsync(long appId, string environment, string format, CancellationToken cancellationToken = default);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ public interface ITeamApplicationService : IApplicationService

Task<int> CountAsync(TeamCriteria criteria, CancellationToken cancellationToken = default);

Task<TeamDetailDto> GetAsync(int id, CancellationToken cancellationToken = default);
Task<TeamDetailDto> GetAsync(long id, CancellationToken cancellationToken = default);

Task<int> CreateAsync(TeamEditDto data, CancellationToken cancellationToken = default);
Task<long> 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<List<TeamMemberDto>> QueryMembersAsync(int id, CancellationToken cancellationToken = default);
Task<List<TeamMemberDto>> QueryMembersAsync(long id, CancellationToken cancellationToken = default);

Task AppendMembersAsync(int id, List<int> userIds, CancellationToken cancellationToken = default);
Task AppendMembersAsync(long id, List<long> userIds, CancellationToken cancellationToken = default);

Task RemoveMembersAsync(int id, List<int> userIds, CancellationToken cancellationToken = default);
Task RemoveMembersAsync(long id, List<long> userIds, CancellationToken cancellationToken = default);

Task QuitAsync(int id, CancellationToken cancellationToken = default);
Task QuitAsync(long id, CancellationToken cancellationToken = default);
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public interface IUserApplicationService : IApplicationService
/// <param name="data"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<int> CreateAsync(UserCreateDto data, CancellationToken cancellationToken = default);
Task<long> CreateAsync(UserCreateDto data, CancellationToken cancellationToken = default);

/// <summary>
/// 编辑用户
Expand All @@ -23,7 +23,7 @@ public interface IUserApplicationService : IApplicationService
/// <param name="data"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task UpdateAsync(int id, UserUpdateDto data, CancellationToken cancellationToken = default);
Task UpdateAsync(long id, UserUpdateDto data, CancellationToken cancellationToken = default);

/// <summary>
/// 查询符合条件的用户列表
Expand All @@ -49,15 +49,15 @@ public interface IUserApplicationService : IApplicationService
/// <param name="id"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<UserDetailDto> GetAsync(int id, CancellationToken cancellationToken = default);
Task<UserDetailDto> GetAsync(long id, CancellationToken cancellationToken = default);

/// <summary>
/// 删除用户
/// </summary>
/// <param name="id"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task DeleteAsync(int id, CancellationToken cancellationToken = default);
Task DeleteAsync(long id, CancellationToken cancellationToken = default);

/// <summary>
/// 设置用户角色
Expand All @@ -66,7 +66,7 @@ public interface IUserApplicationService : IApplicationService
/// <param name="roles"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task SetRolesAsync(int id, List<string> roles, CancellationToken cancellationToken = default);
Task SetRolesAsync(long id, List<string> roles, CancellationToken cancellationToken = default);

/// <summary>
/// 修改密码
Expand All @@ -84,5 +84,5 @@ public interface IUserApplicationService : IApplicationService
/// <param name="password"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task ResetPasswordAsync(int id, string password, CancellationToken cancellationToken = default);
Task ResetPasswordAsync(long id, string password, CancellationToken cancellationToken = default);
}
Loading
Loading