Add WmsLite monorepo with JWT auth, tenant context, and project READMEs.
Implement API security baseline (sys_user, JWT, audit fields, transactions, unique constraints) and Web real login with 401 handling. Document setup and development workflows in root, WmsLite.Api, and WmsLite.Web README files. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
commit
fa1b286463
241 files changed
+31188
No files matched your search
@@ -0,0 +1,35 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace WmsLite.Api.Common;
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="BusinessResult.Data"/> 为 object 时,默认序列化可能不会按运行时类型正确套用 long 转换器;
|
||||
/// 显式按运行时类型写出,确保嵌套 DTO 中的雪花 Id 以字符串输出。
|
||||
/// </summary>
|
||||
public sealed class BusinessResultJsonConverter : JsonConverter<BusinessResult>
|
||||
{
|
||||
public override BusinessResult Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
throw new JsonException("BusinessResult deserialization is not supported.");
|
||||
}
|
||||
|
||||
public override void Write(Utf8JsonWriter writer, BusinessResult value, JsonSerializerOptions options)
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
writer.WriteBoolean("success", value.Success);
|
||||
writer.WriteString("code", value.Code ?? string.Empty);
|
||||
writer.WriteString("message", value.Message ?? string.Empty);
|
||||
writer.WritePropertyName("data");
|
||||
if (value.Data is null)
|
||||
{
|
||||
writer.WriteNullValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
JsonSerializer.Serialize(writer, value.Data, value.Data.GetType(), options);
|
||||
}
|
||||
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user