diff --git a/src/WorkFlowCheck.API/Program.cs b/src/WorkFlowCheck.API/Program.cs new file mode 100644 index 0000000..d3b48c9 --- /dev/null +++ b/src/WorkFlowCheck.API/Program.cs @@ -0,0 +1,35 @@ +using System.Text.Json.Serialization; + +var builder = WebApplication.CreateSlimBuilder(args); + +builder.Services.ConfigureHttpJsonOptions(options => +{ + options.SerializerOptions.TypeInfoResolverChain.Insert(0, AppJsonSerializerContext.Default); +}); + +var app = builder.Build(); + +var sampleTodos = new Todo[] { + new(1, "Walk the dog"), + new(2, "Do the dishes", DateOnly.FromDateTime(DateTime.Now)), + new(3, "Do the laundry", DateOnly.FromDateTime(DateTime.Now.AddDays(1))), + new(4, "Clean the bathroom"), + new(5, "Clean the car", DateOnly.FromDateTime(DateTime.Now.AddDays(2))) +}; + +var todosApi = app.MapGroup("/todos"); +todosApi.MapGet("/", () => sampleTodos); +todosApi.MapGet("/{id}", (int id) => + sampleTodos.FirstOrDefault(a => a.Id == id) is { } todo + ? Results.Ok(todo) + : Results.NotFound()); + +app.Run(); + +public record Todo(int Id, string? Title, DateOnly? DueBy = null, bool IsComplete = false); + +[JsonSerializable(typeof(Todo[]))] +internal partial class AppJsonSerializerContext : JsonSerializerContext +{ + +} diff --git a/src/WorkFlowCheck.API/Properties/launchSettings.json b/src/WorkFlowCheck.API/Properties/launchSettings.json new file mode 100644 index 0000000..08a8bf8 --- /dev/null +++ b/src/WorkFlowCheck.API/Properties/launchSettings.json @@ -0,0 +1,15 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "todos", + "applicationUrl": "http://localhost:5069", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/src/WorkFlowCheck.API/WorkFlowCheck.API.csproj b/src/WorkFlowCheck.API/WorkFlowCheck.API.csproj new file mode 100644 index 0000000..8186e5b --- /dev/null +++ b/src/WorkFlowCheck.API/WorkFlowCheck.API.csproj @@ -0,0 +1,11 @@ + + + + net8.0 + enable + enable + true + true + + + diff --git a/src/WorkFlowCheck.API/WorkFlowCheck.API.http b/src/WorkFlowCheck.API/WorkFlowCheck.API.http new file mode 100644 index 0000000..06acd63 --- /dev/null +++ b/src/WorkFlowCheck.API/WorkFlowCheck.API.http @@ -0,0 +1,11 @@ +@WorkFlowCheck.API_HostAddress = http://localhost:5069 + +GET {{WorkFlowCheck.API_HostAddress}}/todos/ +Accept: application/json + +### + +GET {{WorkFlowCheck.API_HostAddress}}/todos/1 +Accept: application/json + +### diff --git a/src/WorkFlowCheck.API/appsettings.Development.json b/src/WorkFlowCheck.API/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/src/WorkFlowCheck.API/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/src/WorkFlowCheck.API/appsettings.json b/src/WorkFlowCheck.API/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/src/WorkFlowCheck.API/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/src/WorkFlowCheck.MAUI/App.xaml b/src/WorkFlowCheck.MAUI/App.xaml new file mode 100644 index 0000000..620a39e --- /dev/null +++ b/src/WorkFlowCheck.MAUI/App.xaml @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/src/WorkFlowCheck.MAUI/App.xaml.cs b/src/WorkFlowCheck.MAUI/App.xaml.cs new file mode 100644 index 0000000..83841dd --- /dev/null +++ b/src/WorkFlowCheck.MAUI/App.xaml.cs @@ -0,0 +1,12 @@ +namespace WorkFlowCheck.MAUI +{ + public partial class App : Application + { + public App() + { + InitializeComponent(); + + MainPage = new AppShell(); + } + } +} diff --git a/src/WorkFlowCheck.MAUI/AppShell.xaml b/src/WorkFlowCheck.MAUI/AppShell.xaml new file mode 100644 index 0000000..b26fd5d --- /dev/null +++ b/src/WorkFlowCheck.MAUI/AppShell.xaml @@ -0,0 +1,15 @@ + + + + + + diff --git a/src/WorkFlowCheck.MAUI/AppShell.xaml.cs b/src/WorkFlowCheck.MAUI/AppShell.xaml.cs new file mode 100644 index 0000000..2542af7 --- /dev/null +++ b/src/WorkFlowCheck.MAUI/AppShell.xaml.cs @@ -0,0 +1,10 @@ +namespace WorkFlowCheck.MAUI +{ + public partial class AppShell : Shell + { + public AppShell() + { + InitializeComponent(); + } + } +} diff --git a/src/WorkFlowCheck.MAUI/MainPage.xaml b/src/WorkFlowCheck.MAUI/MainPage.xaml new file mode 100644 index 0000000..18d8034 --- /dev/null +++ b/src/WorkFlowCheck.MAUI/MainPage.xaml @@ -0,0 +1,36 @@ + + + + + + + +