feat: 编译历史记录和代码生成结果(#51)
地址已绑定编译结果,支持历史记录切换功能 Co-authored-by: jackfiled <xcrenchangjun@outlook.com> Reviewed-on: PostGuard/Canon#51 Co-authored-by: Ichirinko <1621543655@qq.com> Co-committed-by: Ichirinko <1621543655@qq.com>
This commit is contained in:
40
Canon.Server/DataTransferObjects/CompileResponse.cs
Normal file
40
Canon.Server/DataTransferObjects/CompileResponse.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Canon.Server.Entities;
|
||||
|
||||
namespace Canon.Server.DataTransferObjects;
|
||||
|
||||
public class CompileResponse
|
||||
{
|
||||
[Required]
|
||||
public string Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public string SourceCode { get; set; }
|
||||
|
||||
[Required]
|
||||
public string CompiledCode { get; set; }
|
||||
|
||||
[Required]
|
||||
public string ImageAddress { get; set; }
|
||||
|
||||
[Required]
|
||||
public string CompileTime { get; set; }
|
||||
|
||||
public CompileResponse()
|
||||
{
|
||||
Id = string.Empty;
|
||||
SourceCode = string.Empty;
|
||||
CompiledCode = string.Empty;
|
||||
ImageAddress = string.Empty;
|
||||
CompileTime = string.Empty;
|
||||
}
|
||||
|
||||
public CompileResponse(CompileResult result)
|
||||
{
|
||||
Id = result.CompileId;
|
||||
SourceCode = result.SourceCode;
|
||||
CompiledCode = result.CompiledCode;
|
||||
ImageAddress = $"/api/file/{result.SytaxTreeImageFilename}";
|
||||
CompileTime = result.CompileTime.AddHours(8).ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
}
|
9
Canon.Server/DataTransferObjects/SourceCode.cs
Normal file
9
Canon.Server/DataTransferObjects/SourceCode.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Canon.Server.DataTransferObjects;
|
||||
|
||||
public class SourceCode
|
||||
{
|
||||
[Required]
|
||||
public required string Code { get; set; }
|
||||
}
|
Reference in New Issue
Block a user