Skip to content

Commit

Permalink
rebase more
Browse files Browse the repository at this point in the history
  • Loading branch information
Hona committed Oct 7, 2023
1 parent 4e14fdf commit ab891ac
Show file tree
Hide file tree
Showing 18 changed files with 116 additions and 161 deletions.
8 changes: 3 additions & 5 deletions src/TimesheetGPT.Core/ConfigureServices.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Graph.Models.ExternalConnectors;
using System.Reflection;
using TimesheetGPT.Application.Interfaces;
using TimesheetGPT.Application.Services;
using TimesheetGPT.Core.Interfaces;
using TimesheetGPT.Core.Services;

namespace TimesheetGPT.Application;
namespace TimesheetGPT.Core;

public static class ConfigureServices
{
Expand Down
2 changes: 1 addition & 1 deletion src/TimesheetGPT.Core/Interfaces/IAiService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace TimesheetGPT.Application.Interfaces;
namespace TimesheetGPT.Core.Interfaces;

public interface IAiService
{
Expand Down
6 changes: 3 additions & 3 deletions src/TimesheetGPT.Core/Interfaces/IGraphService.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using TimesheetGPT.Application.Models;
using TimesheetGPT.Application.Services;
using TimesheetGPT.Core.Models;
using TimesheetGPT.Core.Services;

namespace TimesheetGPT.Application.Interfaces;
namespace TimesheetGPT.Core.Interfaces;

public interface IGraphService
{
Expand Down
2 changes: 1 addition & 1 deletion src/TimesheetGPT.Core/Models/Meeting.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace TimesheetGPT.Application.Models;
namespace TimesheetGPT.Core.Models;

public class Meeting
{
Expand Down
2 changes: 1 addition & 1 deletion src/TimesheetGPT.Core/Models/Summary.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace TimesheetGPT.Application.Models;
namespace TimesheetGPT.Core.Models;

public class SummaryWithRaw
{
Expand Down
2 changes: 1 addition & 1 deletion src/TimesheetGPT.Core/Prompts.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace TimesheetGPT.Application;
namespace TimesheetGPT.Core;

public static class Prompts
{
Expand Down
6 changes: 3 additions & 3 deletions src/TimesheetGPT.Core/Services/GraphService.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Microsoft.Graph;
using Microsoft.Graph.Models;
using TimesheetGPT.Application.Interfaces;
using TimesheetGPT.Application.Models;
using TimesheetGPT.Core.Interfaces;
using TimesheetGPT.Core.Models;

namespace TimesheetGPT.Application.Services;
namespace TimesheetGPT.Core.Services;

public class GraphService : IGraphService
{
Expand Down
4 changes: 2 additions & 2 deletions src/TimesheetGPT.Core/Services/LangChainAiService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using TimesheetGPT.Application.Interfaces;
using TimesheetGPT.Core.Interfaces;

namespace TimesheetGPT.Application.Services;
namespace TimesheetGPT.Core.Services;

public class LangChainAiService : IAiService
{
Expand Down
8 changes: 3 additions & 5 deletions src/TimesheetGPT.Core/Services/SemKerAiService.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.Orchestration;
using TimesheetGPT.Application.Interfaces;

namespace TimesheetGPT.Application.Services;
using Microsoft.Extensions.Configuration;
using Microsoft.SemanticKernel;
using TimesheetGPT.Core.Interfaces;

namespace TimesheetGPT.Core.Services;

public class SemKerAiService : IAiService
{
Expand Down
6 changes: 3 additions & 3 deletions src/TimesheetGPT.Core/Services/TimesheetService.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using Microsoft.Graph;
using TimesheetGPT.Application.Interfaces;
using TimesheetGPT.Application.Models;
using TimesheetGPT.Core.Interfaces;
using TimesheetGPT.Core.Models;

namespace TimesheetGPT.Application.Services;
namespace TimesheetGPT.Core.Services;

public class TimesheetService
{
Expand Down
1 change: 0 additions & 1 deletion src/TimesheetGPT.Gateway/TimesheetGPT.Gateway.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

<ItemGroup>
<AdditionalFiles Include="Pages\Error.cshtml" />
<AdditionalFiles Include="Pages\Index.razor" />
<AdditionalFiles Include="Pages\_Host.cshtml" />
</ItemGroup>

Expand Down
73 changes: 73 additions & 0 deletions src/TimesheetGPT.WebUI/DependencyInjection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Identity.Web;
using Microsoft.Identity.Web.UI;
using MudBlazor;
using MudBlazor.Services;
using TimesheetGPT.Core;
using TimesheetGPT.Core.Services;
using TimesheetGPT.WebUI.Services;

namespace TimesheetGPT.WebUI;

public static class DependencyInjection
{
public static IServiceCollection AddTimesheetGptUi(this IServiceCollection services, IConfiguration config)
{
// Add services to the container.
var initialScopes = config["DownstreamApi:Scopes"]?.Split(' ');

services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApp(config.GetSection("AzureAd"))
.EnableTokenAcquisitionToCallDownstreamApi(initialScopes)
.AddMicrosoftGraph(config.GetSection("DownstreamApi"))
.AddInMemoryTokenCaches();
services.AddControllersWithViews()
.AddMicrosoftIdentityUI();

services.AddAuthorization(options =>
{
// By default, all incoming requests will be authorized according to the default policy
options.FallbackPolicy = options.DefaultPolicy;
});

services.AddRazorPages();
services.AddServerSideBlazor()
.AddMicrosoftIdentityConsentHandler();
services.AddMudServices();
services.AddMudMarkdownServices();

services.AddApplication();

services.AddScoped<ClipboardService>();
services.AddScoped<TimesheetService>();

return services;
}

public static WebApplication UseTimesheetGptUi(this WebApplication app)
{
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}

app.UseHttpsRedirection();

app.UseStaticFiles();

app.UseRouting();

app.MapControllers();
app.MapBlazorHub();
app.MapFallbackToPage("/_Host");

return app;
}
}
42 changes: 0 additions & 42 deletions src/TimesheetGPT.WebUI/Pages/Error.cshtml

This file was deleted.

26 changes: 0 additions & 26 deletions src/TimesheetGPT.WebUI/Pages/Error.cshtml.cs

This file was deleted.

4 changes: 2 additions & 2 deletions src/TimesheetGPT.WebUI/Pages/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

@using Microsoft.Identity.Web
@using Microsoft.Graph
@using TimesheetGPT.Application.Models
@using TimesheetGPT.Application.Services
@using TimesheetGPT.Core.Models
@using TimesheetGPT.Core.Services
@using TimesheetGPT.WebUI.Services
@inject GraphServiceClient GraphServiceClient
@inject MicrosoftIdentityConsentAndConditionalAccessHandler ConsentHandler
Expand Down
60 changes: 0 additions & 60 deletions src/TimesheetGPT.WebUI/Program.cs

This file was deleted.

1 change: 0 additions & 1 deletion src/TimesheetGPT.WebUI/Shared/ResultCard.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@using TimesheetGPT.WebUI.Services
@using TimesheetGPT.Application.Services
@inject ClipboardService ClipboardService
@inject ISnackbar Snackbar

Expand Down
24 changes: 20 additions & 4 deletions src/TimesheetGPT.WebUI/TimesheetGPT.WebUI.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>aspnet-TimesheetGPT.WebUI-f72d98b5-4902-4ced-bf99-37fba899ba41</UserSecretsId>
<UserSecretsId>0984693a-b881-43ca-b901-493776cefa32</UserSecretsId>
<WebProject_DirectoryAccessLevelKey>0</WebProject_DirectoryAccessLevelKey>
</PropertyGroup>


<ItemGroup>
<SupportedPlatform Include="browser"/>
</ItemGroup>


<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.0-rc.1.23421.29" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.0-rc.1.23421.29" NoWarn="NU1605" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.0-rc.1.23421.29" NoWarn="NU1605" />
<PackageReference Include="Microsoft.Identity.Web" Version="2.13.4" />
Expand All @@ -19,7 +26,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\TimesheetGPT.Application\TimesheetGPT.Application.csproj" />
<ProjectReference Include="..\TimesheetGPT.Core\TimesheetGPT.Core.csproj" />
</ItemGroup>

<ItemGroup>
Expand All @@ -37,5 +44,14 @@
<_ContentIncludedByDefault Remove="wwwroot\css\site.css" />
</ItemGroup>

<ItemGroup>
<None Remove="Properties\launchSettings.json" />
</ItemGroup>

<ItemGroup>
<UpToDateCheckInput Remove="Pages\Index.razor" />
<UpToDateCheckInput Remove="Pages\Error.cshtml" />
<UpToDateCheckInput Remove="Pages\_Host.cshtml" />
</ItemGroup>

</Project>
</Project>

0 comments on commit ab891ac

Please sign in to comment.