2024-04-19 14:59:45 +08:00
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
2024-04-22 21:26:34 +08:00
|
|
|
|
using Canon.Server.Entities;
|
2024-04-19 14:59:45 +08:00
|
|
|
|
|
2024-04-22 21:26:34 +08:00
|
|
|
|
namespace Canon.Server.DataTransferObjects;
|
2024-04-19 14:59:45 +08:00
|
|
|
|
|
|
|
|
|
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; }
|
|
|
|
|
|
2024-04-22 21:26:34 +08:00
|
|
|
|
[Required]
|
|
|
|
|
public string CompileTime { get; set; }
|
|
|
|
|
|
2024-04-19 14:59:45 +08:00
|
|
|
|
public CompileResponse()
|
|
|
|
|
{
|
|
|
|
|
Id = string.Empty;
|
|
|
|
|
SourceCode = string.Empty;
|
|
|
|
|
CompiledCode = string.Empty;
|
|
|
|
|
ImageAddress = string.Empty;
|
2024-04-22 21:26:34 +08:00
|
|
|
|
CompileTime = string.Empty;
|
2024-04-19 14:59:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public CompileResponse(CompileResult result)
|
|
|
|
|
{
|
|
|
|
|
Id = result.CompileId;
|
|
|
|
|
SourceCode = result.SourceCode;
|
|
|
|
|
CompiledCode = result.CompiledCode;
|
|
|
|
|
ImageAddress = $"/api/file/{result.SytaxTreeImageFilename}";
|
2024-04-22 21:26:34 +08:00
|
|
|
|
CompileTime = result.CompileTime.AddHours(8).ToString("yyyy-MM-dd HH:mm:ss");
|
2024-04-19 14:59:45 +08:00
|
|
|
|
}
|
|
|
|
|
}
|