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:
@@ -1,5 +1,6 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Canon.Core.Abstractions;
|
||||
using Canon.Server.DataTransferObjects;
|
||||
|
||||
namespace Canon.Server.Models;
|
||||
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Canon.Server.Models;
|
||||
|
||||
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; }
|
||||
|
||||
public CompileResponse()
|
||||
{
|
||||
Id = string.Empty;
|
||||
SourceCode = string.Empty;
|
||||
CompiledCode = string.Empty;
|
||||
ImageAddress = string.Empty;
|
||||
}
|
||||
|
||||
public CompileResponse(CompileResult result)
|
||||
{
|
||||
Id = result.CompileId;
|
||||
SourceCode = result.SourceCode;
|
||||
CompiledCode = result.CompiledCode;
|
||||
ImageAddress = $"/api/file/{result.SytaxTreeImageFilename}";
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using MongoDB.Bson;
|
||||
|
||||
namespace Canon.Server.Models;
|
||||
|
||||
public class CompileResult
|
||||
{
|
||||
public ObjectId Id { get; set; }
|
||||
|
||||
[MaxLength(40)]
|
||||
public string CompileId { get; set; } = string.Empty;
|
||||
|
||||
public string SourceCode { get; set; } = string.Empty;
|
||||
|
||||
[MaxLength(40)]
|
||||
public string SytaxTreeImageFilename { get; set; } = string.Empty;
|
||||
|
||||
public string CompiledCode { get; set; } = string.Empty;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Canon.Server.Models;
|
||||
|
||||
public class ImageResponse
|
||||
{
|
||||
[Required]
|
||||
public required string ResultId { get; set; }
|
||||
|
||||
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Canon.Server.Models;
|
||||
|
||||
public class SourceCode
|
||||
{
|
||||
[Required]
|
||||
public required string Code { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user