Replace weather example with shared YouTube models

Removed WeatherForecast API and model. Added TuneRipper.Shared project with shared configuration and YouTube processing models. Updated solution and project references to enable code sharing between API and client. Explicitly included Controllers folder in API project.
This commit is contained in:
Michal Vrba
2025-12-11 14:11:46 +01:00
parent b5376f342a
commit 5230bddc03
9 changed files with 71 additions and 39 deletions
@@ -1,26 +0,0 @@
using Microsoft.AspNetCore.Mvc;
namespace TuneRipper.Api.Controllers
{
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries =
[
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
];
[HttpGet(Name = "GetWeatherForecast")]
public IEnumerable<WeatherForecast> Get()
{
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
})
.ToArray();
}
}
}
+8
View File
@@ -10,4 +10,12 @@
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\TuneRipper.Shared\TuneRipper.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Controllers\" />
</ItemGroup>
</Project>
-13
View File
@@ -1,13 +0,0 @@
namespace TuneRipper.Api
{
public class WeatherForecast
{
public DateOnly Date { get; set; }
public int TemperatureC { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
public string? Summary { get; set; }
}
}
@@ -0,0 +1,11 @@
namespace TuneRipper.Shared.Configuration;
public class ApiSettings
{
public const string SectionName = "ApiSettings";
public string? BaseUrl { get; set; }
public string? ApiKey { get; set; }
public int TimeoutSeconds { get; set; } = 30;
public bool EnableLogging { get; set; } = true;
}
@@ -0,0 +1,24 @@
namespace TuneRipper.Shared.Models;
public class ProcessVideoRequest
{
public string? Url { get; set; }
public string? Format { get; set; } = "mp3";
public string? Quality { get; set; } = "128";
}
public class ProcessVideoResponse
{
public bool Success { get; set; }
public string? Message { get; set; }
public string? FileName { get; set; }
public string? DownloadUrl { get; set; }
public YouTubeVideoDetails? VideoDetails { get; set; }
}
public class DownloadProgress
{
public int PercentageComplete { get; set; }
public string? Status { get; set; }
public string? Message { get; set; }
}
@@ -0,0 +1,14 @@
namespace TuneRipper.Shared.Models;
public class YouTubeVideoDetails
{
public string? Id { get; set; }
public string? Title { get; set; }
public string? Description { get; set; }
public string? ThumbnailUrl { get; set; }
public TimeSpan Duration { get; set; }
public string? Author { get; set; }
public int ViewCount { get; set; }
public DateTime UploadDate { get; set; }
public List<string> Tags { get; set; } = new();
}
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
+1
View File
@@ -1,4 +1,5 @@
<Solution>
<Project Path="TuneRipper.Api/TuneRipper.Api.csproj" Id="ce3f450f-2f3f-4f1f-b69e-87de38ffa5e1" />
<Project Path="TuneRipper.Shared/TuneRipper.Shared.csproj" Id="23c2e670-ff0c-4942-91f0-0642c1b7e23c" />
<Project Path="TuneRipper/TuneRipper.csproj" Id="7ee898fc-5be1-418a-b88d-405301a767e6" />
</Solution>
+4
View File
@@ -12,4 +12,8 @@
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="10.0.1" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\TuneRipper.Shared\TuneRipper.Shared.csproj" />
</ItemGroup>
</Project>