diff --git a/Contracts/.idea/.idea.Contracts/.idea/.gitignore b/Contracts/.idea/.idea.Contracts/.idea/.gitignore new file mode 100644 index 0000000..e5b1972 --- /dev/null +++ b/Contracts/.idea/.idea.Contracts/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/modules.xml +/contentModel.xml +/.idea.Contracts.iml +/projectSettingsUpdater.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/Contracts/.idea/.idea.Contracts/.idea/encodings.xml b/Contracts/.idea/.idea.Contracts/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/Contracts/.idea/.idea.Contracts/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Contracts/.idea/.idea.Contracts/.idea/indexLayout.xml b/Contracts/.idea/.idea.Contracts/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/Contracts/.idea/.idea.Contracts/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Contracts/.idea/.idea.Contracts/.idea/vcs.xml b/Contracts/.idea/.idea.Contracts/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/Contracts/.idea/.idea.Contracts/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Contracts/.idea/config/applicationhost.config b/Contracts/.idea/config/applicationhost.config new file mode 100644 index 0000000..0fb98dd --- /dev/null +++ b/Contracts/.idea/config/applicationhost.config @@ -0,0 +1,995 @@ + + + + + + +
+
+
+
+
+
+
+
+ + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+ +
+
+ +
+
+ +
+
+
+ + +
+
+
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Contracts/Api/Api.csproj b/Contracts/Api/Api.csproj new file mode 100644 index 0000000..0eae008 --- /dev/null +++ b/Contracts/Api/Api.csproj @@ -0,0 +1,14 @@ + + + + net8.0 + enable + enable + + + + + + + + diff --git a/Contracts/Api/Controllers/BaseController.cs b/Contracts/Api/Controllers/BaseController.cs new file mode 100644 index 0000000..9a07fa9 --- /dev/null +++ b/Contracts/Api/Controllers/BaseController.cs @@ -0,0 +1,25 @@ +using Microsoft.AspNetCore.Mvc; + +namespace Api.Controllers; + +[ApiController] +[Route("api/[controller]")] +public abstract class BaseController : Controller +{ + [HttpGet(nameof(Create))] + public async Task Create() + { + //await $"scripts/00magic.sh --param ".Bash(); + return Ok(new {id = 1}); + } + + /*public async Task Get(T model) + { + + } + + public async Task Update(T model) + { + + }*/ +} \ No newline at end of file diff --git a/Contracts/Api/Controllers/UserController.cs b/Contracts/Api/Controllers/UserController.cs new file mode 100644 index 0000000..cb563d2 --- /dev/null +++ b/Contracts/Api/Controllers/UserController.cs @@ -0,0 +1,8 @@ +using Api.Models; + +namespace Api.Controllers; + +public class UserController : BaseController +{ + +} \ No newline at end of file diff --git a/Contracts/Api/Ebasher.cs b/Contracts/Api/Ebasher.cs new file mode 100644 index 0000000..8e6d63f --- /dev/null +++ b/Contracts/Api/Ebasher.cs @@ -0,0 +1,25 @@ +using System.Diagnostics; + +namespace Api; + +public static class Ebasher +{ + public static string Bash(this string cmd) + { + cmd = cmd.Replace("\"", "\\\""); + var proc = new Process + { + StartInfo = new ProcessStartInfo + { + FileName = "bin/bash", + Arguments = $"-c \"{cmd}\"", + UseShellExecute = false, + RedirectStandardOutput = true, + CreateNoWindow = true + } + }; + proc.Start(); + proc.WaitForExit(); + return proc.StandardOutput.ReadToEnd(); + } +} \ No newline at end of file diff --git a/Contracts/Api/Models/User.cs b/Contracts/Api/Models/User.cs new file mode 100644 index 0000000..bebbc4f --- /dev/null +++ b/Contracts/Api/Models/User.cs @@ -0,0 +1,9 @@ +namespace Api.Models; + +public class User +{ + public string Name { get; set; } + public string Surname { get; set; } + public string Login { get; set; } + public string Password { get; set; } +} \ No newline at end of file diff --git a/Contracts/Api/Program.cs b/Contracts/Api/Program.cs new file mode 100644 index 0000000..628c506 --- /dev/null +++ b/Contracts/Api/Program.cs @@ -0,0 +1,16 @@ +using System.Diagnostics; +using Api; + +var builder = WebApplication.CreateBuilder(args); + +builder.Services.AddControllers(); +var app = builder.Build(); + +app.Lifetime.ApplicationStarted.Register(() => +{ + Console.WriteLine("neo-go contract compile -i User/user.go -c User/user.yml -m User/user.json".Bash()); +}); + +app.MapControllers(); + +app.Run(); \ No newline at end of file diff --git a/Contracts/Api/Properties/launchSettings.json b/Contracts/Api/Properties/launchSettings.json new file mode 100644 index 0000000..1ff5d31 --- /dev/null +++ b/Contracts/Api/Properties/launchSettings.json @@ -0,0 +1,38 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:51796", + "sslPort": 44377 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "http://localhost:5236", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "https://localhost:7236;http://localhost:5236", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/Contracts/Api/appsettings.Development.json b/Contracts/Api/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/Contracts/Api/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/Contracts/Api/appsettings.json b/Contracts/Api/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/Contracts/Api/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/Contracts/Contracts.sln b/Contracts/Contracts.sln new file mode 100644 index 0000000..e9d7f40 --- /dev/null +++ b/Contracts/Contracts.sln @@ -0,0 +1,16 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Api", "Api\Api.csproj", "{72B65D87-F9E3-44C4-955F-4FC1581647AA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {72B65D87-F9E3-44C4-955F-4FC1581647AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {72B65D87-F9E3-44C4-955F-4FC1581647AA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {72B65D87-F9E3-44C4-955F-4FC1581647AA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {72B65D87-F9E3-44C4-955F-4FC1581647AA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal