Repository navigation
Review settings and streamings #127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
6fdab7f
#124 - update to aspire latest version
albx 72f801a
#124 - update packages
albx fe945b7
#124 - refactor streaming info. removed unused entities
albx 34300a8
#124 - update to .net 10
albx d87bd74
#124 - update packages
albx 6eb8c42
#124 - removed old settings pages
albx d270aec
#124 - update aspire version
albx 18547cc
#124 - moving to extension blocks
albx 9b94d4e
#124 - setup UI for connected channels list
albx 43c84a2
#124 - update aspire and nuget packages
albx 18f347d
#124 - WIP channel form panel
albx 5c51ba7
#124 - edit UI for channels
albx b4e456b
#124 - WIP connected channels management
albx a5d97c3
#124 - connected channels can now be added
albx f8e81b2
#124 - edit connected channel
albx e5b95fa
#124 - fix reverse proxy, fix dialog close
albx 26b07d5
#124 - add channels page translations
albx 7705a6d
#124 - WIP new streaming form
albx 073ce23
#124 - refactor schedule streaming endpoint
albx 069dead
#124 - fix import streaming
albx 2018253
#124 - streaming detail and update packages
albx d60c5d5
#124 - fix prevent navigation message
albx 90348b8
#124 - update aspire version to 13.1.2
albx 94222b2
#124 - update aspire and all packages
albx 84649a1
#124 - add translations for channels form. update packages and aspire…
albx 0b5f47d
#124 - fix comments post review
albx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| <Solution> | ||
| <Configurations> | ||
| <Platform Name="Any CPU" /> | ||
| <Platform Name="x64" /> | ||
| <Platform Name="x86" /> | ||
| </Configurations> | ||
| <Folder Name="/src/"> | ||
| <Project Path="src/KITT.AppHost/KITT.AppHost.csproj" /> | ||
| <Project Path="src/KITT.ServiceDefaults/KITT.ServiceDefaults.csproj" /> | ||
| <Project Path="src/KITT.Services/KITT.Services.csproj" /> | ||
| </Folder> | ||
| <Folder Name="/src/KITT/"> | ||
| <Project Path="src/KITT.Core/KITT.Core.csproj" /> | ||
| <Project Path="src/KITT.Telegram.Messages/KITT.Telegram.Messages.csproj" /> | ||
| <Project Path="src/KITT.Web.App.UI/KITT.Web.App.UI.csproj" /> | ||
| <Project Path="src/KITT.Web.App/KITT.Web.App.Client/KITT.Web.App.Client.csproj" /> | ||
| <Project Path="src/KITT.Web.App/KITT.Web.App/KITT.Web.App.csproj" /> | ||
| <Project Path="src/KITT.Web.Models/KITT.Web.Models.csproj" /> | ||
| <Project Path="src/KITT.Web.Shared/KITT.Web.Shared.csproj" /> | ||
| </Folder> | ||
| <Folder Name="/src/KITT/Cms/"> | ||
| <Project Path="src/KITT.Cms.Settings/KITT.Cms.Settings.csproj" /> | ||
| <Project Path="src/KITT.Cms.Web.Api/KITT.Cms.Web.Api.csproj" /> | ||
| <Project Path="src/KITT.Cms.Web.App/KITT.Cms.Web.App.csproj" /> | ||
| <Project Path="src/KITT.Cms.Web.Models/KITT.Cms.Web.Models.csproj" /> | ||
| </Folder> | ||
| <Folder Name="/src/KITT/Proposals/"> | ||
| <Project Path="src/KITT.Proposals.Web.Api/KITT.Proposals.Web.Api.csproj" /> | ||
| <Project Path="src/KITT.Proposals.Web.App/KITT.Proposals.Web.App.csproj" /> | ||
| <Project Path="src/KITT.Proposals.Web.Models/KITT.Proposals.Web.Models.csproj" /> | ||
| </Folder> | ||
| <Folder Name="/src/KITT/Support/"> | ||
| <Project Path="src/KITT.Support.Seeder/KITT.Support.Seeder.csproj" /> | ||
| </Folder> | ||
| <Folder Name="/tests/"> | ||
| <Project Path="tests/KITT.Cms.Web.Api.Test/KITT.Cms.Web.Api.Test.csproj" /> | ||
| <Project Path="tests/KITT.Core.Test/KITT.Core.Test.csproj" /> | ||
| <Project Path="tests/KITT.Web.Testing/KITT.Web.Testing.csproj" /> | ||
| </Folder> | ||
| </Solution> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "appHost": { | ||
| "path": "src/KITT.AppHost/KITT.AppHost.csproj" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| using Azure.Data.Tables; | ||
| using KITT.Cms.Settings.Models; | ||
|
|
||
| namespace KITT.Cms.Settings; | ||
|
|
||
| public class ConnectedChannelsRepository : IConnectedChannelsRepository | ||
| { | ||
| private readonly TableClient _tableClient; | ||
|
|
||
| internal const string ConnectedChannelsTableName = "SettingsChannels"; | ||
|
|
||
| public ConnectedChannelsRepository(TableServiceClient tableServiceClient) | ||
| { | ||
| ArgumentNullException.ThrowIfNull(tableServiceClient); | ||
| _tableClient = CreateTableIfNotExist(tableServiceClient) ?? throw new ArgumentNullException("tableClient"); | ||
| } | ||
|
|
||
| private static TableClient? CreateTableIfNotExist(TableServiceClient tableServiceClient) | ||
| { | ||
| var tableClient = tableServiceClient.GetTableClient(ConnectedChannelsTableName); | ||
| tableClient.CreateIfNotExists(); | ||
|
|
||
| return tableClient; | ||
| } | ||
|
|
||
| public async Task<ConnectedChannel[]> GetConnectedChannelsAsync(string userId) | ||
| { | ||
| var channelsQuery = _tableClient.QueryAsync<ConnectedChannel>(c => c.PartitionKey == userId); | ||
| var channels = new List<ConnectedChannel>(); | ||
|
|
||
| await foreach (var channel in channelsQuery) | ||
| { | ||
| channels.Add(channel); | ||
| } | ||
|
|
||
| return channels.OrderBy(c => c.Name).ToArray(); | ||
| } | ||
|
|
||
| public Task<ConnectedChannel?> GetConnectedChannelAsync(Guid channelId, string userId) | ||
| { | ||
| var channels = _tableClient.Query<ConnectedChannel>(c => c.PartitionKey == userId && c.RowKey == channelId.ToString()); | ||
| return Task.FromResult(channels.SingleOrDefault()); | ||
| } | ||
|
|
||
| public async Task SaveAsync(ConnectedChannel channel) | ||
| { | ||
| await _tableClient.UpsertEntityAsync(channel, TableUpdateMode.Replace); | ||
| } | ||
|
|
||
| public async Task DeleteAsync(Guid channelId, string userId) | ||
| { | ||
| await _tableClient.DeleteEntityAsync(userId, channelId.ToString()); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| using KITT.Cms.Settings.Models; | ||
|
|
||
| namespace KITT.Cms.Settings; | ||
|
|
||
| public interface IConnectedChannelsRepository | ||
| { | ||
| Task<ConnectedChannel[]> GetConnectedChannelsAsync(string userId); | ||
|
|
||
| Task<ConnectedChannel?> GetConnectedChannelAsync(Guid channelId, string userId); | ||
|
|
||
| Task SaveAsync(ConnectedChannel channel); | ||
|
|
||
| Task DeleteAsync(Guid channelId, string userId); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <TargetFramework>net10.0</TargetFramework> | ||
| <ImplicitUsings>enable</ImplicitUsings> | ||
| <Nullable>enable</Nullable> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="Azure.Data.Tables" Version="12.11.0" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| namespace KITT.Cms.Settings.Models; | ||
|
|
||
| public enum ChannelType | ||
| { | ||
| Twitch, | ||
| YouTube | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| using Azure; | ||
| using Azure.Data.Tables; | ||
|
|
||
| namespace KITT.Cms.Settings.Models; | ||
|
|
||
| public class ConnectedChannel : ITableEntity | ||
| { | ||
| public required string PartitionKey { get; set; } = string.Empty; | ||
|
|
||
| public required string RowKey { get; set; } = string.Empty; | ||
|
|
||
| public DateTimeOffset? Timestamp { get; set; } | ||
|
|
||
| public ETag ETag { get; set; } | ||
|
|
||
| public required string Name { get; set; } = string.Empty; | ||
|
|
||
| public required string Url { get; set; } = string.Empty; | ||
|
|
||
| public required ChannelType Type { get; set; } | ||
| } |
79 changes: 79 additions & 0 deletions
79
src/KITT.Cms.Web.Api/Endpoints/Services/ChannelsEndpointsServices.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| using KITT.Cms.Settings; | ||
| using KITT.Cms.Settings.Models; | ||
| using KITT.Cms.Web.Models.Settings; | ||
|
|
||
| namespace KITT.Cms.Web.Api.Endpoints.Services; | ||
|
|
||
| public class ChannelsEndpointsServices(IConnectedChannelsRepository connectedChannelsRepository) | ||
| { | ||
| public async Task<ChannelModel[]> GetChannelsAsync(string userId) | ||
| { | ||
| var channels = await connectedChannelsRepository.GetConnectedChannelsAsync(userId); | ||
| return channels.Select(c => new ChannelModel | ||
| { | ||
| Id = Guid.Parse(c.RowKey), | ||
| Name = c.Name, | ||
| Url = c.Url, | ||
| Type = c.Type | ||
| }).ToArray(); | ||
| } | ||
|
|
||
| public async Task<ChannelModel?> GetChannelAsync(Guid channelId, string userId) | ||
| { | ||
| var channel = await connectedChannelsRepository.GetConnectedChannelAsync(channelId, userId); | ||
| if (channel is null) | ||
| { | ||
| return null; | ||
| } | ||
|
|
||
| return new ChannelModel | ||
| { | ||
| Id = Guid.Parse(channel.RowKey), | ||
| Name = channel.Name, | ||
| Url = channel.Url, | ||
| Type = channel.Type | ||
| }; | ||
| } | ||
|
|
||
| public async Task<ChannelModel> CreateChannelAsync(ChannelModel model, string userId) | ||
| { | ||
| model.Id = Guid.NewGuid(); | ||
|
|
||
| var channelEntity = MapToConnectedChannel(model, userId); | ||
| await connectedChannelsRepository.SaveAsync(channelEntity); | ||
|
|
||
| return model; | ||
| } | ||
|
|
||
| public async Task DeleteChannelAsync(Guid channelId, string userId) | ||
| { | ||
| await connectedChannelsRepository.DeleteAsync(channelId, userId); | ||
| } | ||
|
|
||
| public async Task UpdateChannelAsync(Guid channelId, ChannelModel model, string userId) | ||
| { | ||
| var connectedChannel = await connectedChannelsRepository.GetConnectedChannelAsync(channelId, userId); | ||
| if (connectedChannel is null) | ||
| { | ||
| throw new ArgumentOutOfRangeException(nameof(channelId)); | ||
| } | ||
|
|
||
| connectedChannel.Name = model.Name; | ||
| connectedChannel.Url = model.Url; | ||
| connectedChannel.Type = model.Type; | ||
|
|
||
| await connectedChannelsRepository.SaveAsync(connectedChannel); | ||
| } | ||
|
|
||
| private static ConnectedChannel MapToConnectedChannel(ChannelModel model, string userId) | ||
| { | ||
| return new() | ||
| { | ||
| RowKey = model.Id.ToString(), | ||
| PartitionKey = userId, | ||
| Name = model.Name, | ||
| Url = model.Url, | ||
| Type = model.Type | ||
| }; | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.