Skip to content
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

184 get issues by labels then save them to localdb #192

Merged
merged 9 commits into from
Mar 24, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion maui-island.sln
Original file line number Diff line number Diff line change
@@ -23,7 +23,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MAUIsland.GitHubFeatures.In
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MAUIsland", "src\Presentations\Windows\MAUIsland.csproj", "{72B83E80-9D22-4A44-AB91-253A616A9D9C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MAUIsland.Core", "src\Core\MAUIsland.Core\MAUIsland.Core.csproj", "{A9F55C31-8BED-4021-8F1B-1F5C7D4B2265}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MAUIsland.Core", "src\Core\MAUIsland.Core\MAUIsland.Core.csproj", "{A9F55C31-8BED-4021-8F1B-1F5C7D4B2265}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "LocalDbFeatures", "LocalDbFeatures", "{44F9EA87-2C75-4685-B49F-8ECF3CE577CA}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GitHub", "GitHub", "{966A4C62-0966-4106-A407-A65F27A07986}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MAUIsland.Features.LocalDbFeatures.GitHub", "src\Features\LocalDbFeatures\GitHub\MAUIsland.Features.LocalDbFeatures.GitHub\MAUIsland.Features.LocalDbFeatures.GitHub.csproj", "{9C9F69E9-00F8-459F-98CB-100F1A8B8FE4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MAUIsland.Features.LocalDbFeatures", "src\Features\LocalDbFeatures\MAUIsland.Features.LocalDbFeatures\MAUIsland.Features.LocalDbFeatures.csproj", "{97DE63B5-31C0-4C62-843D-43FB6D23EBB1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -48,6 +56,14 @@ Global
{A9F55C31-8BED-4021-8F1B-1F5C7D4B2265}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A9F55C31-8BED-4021-8F1B-1F5C7D4B2265}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A9F55C31-8BED-4021-8F1B-1F5C7D4B2265}.Release|Any CPU.Build.0 = Release|Any CPU
{9C9F69E9-00F8-459F-98CB-100F1A8B8FE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9C9F69E9-00F8-459F-98CB-100F1A8B8FE4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9C9F69E9-00F8-459F-98CB-100F1A8B8FE4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9C9F69E9-00F8-459F-98CB-100F1A8B8FE4}.Release|Any CPU.Build.0 = Release|Any CPU
{97DE63B5-31C0-4C62-843D-43FB6D23EBB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{97DE63B5-31C0-4C62-843D-43FB6D23EBB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{97DE63B5-31C0-4C62-843D-43FB6D23EBB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{97DE63B5-31C0-4C62-843D-43FB6D23EBB1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -61,6 +77,10 @@ Global
{6F539157-0DE3-407A-8769-EB997EB7AE59} = {23A84AFF-0047-4364-9351-E4521D52A26B}
{72B83E80-9D22-4A44-AB91-253A616A9D9C} = {2FD579F3-6496-437C-956B-E6F62B2D2A5A}
{A9F55C31-8BED-4021-8F1B-1F5C7D4B2265} = {36CB9EBB-A677-4AF0-A0A9-BDEBDE60F123}
{44F9EA87-2C75-4685-B49F-8ECF3CE577CA} = {73E66A66-7BCD-44FE-949C-BD42C274B840}
{966A4C62-0966-4106-A407-A65F27A07986} = {44F9EA87-2C75-4685-B49F-8ECF3CE577CA}
{9C9F69E9-00F8-459F-98CB-100F1A8B8FE4} = {966A4C62-0966-4106-A407-A65F27A07986}
{97DE63B5-31C0-4C62-843D-43FB6D23EBB1} = {44F9EA87-2C75-4685-B49F-8ECF3CE577CA}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {61F7FB11-1E47-470C-91E2-47F8143E1572}
1 change: 1 addition & 0 deletions src/Core/MAUIsland.Core/MAUIsland.Core.csproj
Original file line number Diff line number Diff line change
@@ -38,6 +38,7 @@

<ItemGroup>
<ProjectReference Include="..\..\Features\GitHubFeatures\MAUIsland.GitHubFeatures\MAUIsland.GitHubFeatures.csproj" />
<ProjectReference Include="..\..\Features\LocalDbFeatures\GitHub\MAUIsland.Features.LocalDbFeatures.GitHub\MAUIsland.Features.LocalDbFeatures.GitHub.csproj" />
</ItemGroup>

<ItemGroup>
21 changes: 20 additions & 1 deletion src/Core/MAUIsland.Core/ServiceExtension.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using CommunityToolkit.Maui;
using CommunityToolkit.Maui.Core;
using Material.Components.Maui.Extensions;
using MAUIsland.Features.LocalDbFeatures;
using MAUIsland.Features.LocalDbFeatures.GitHub;
using MAUIsland.GitHubFeatures;
using SkiaSharp.Views.Maui.Controls.Hosting;
using Xe.AcrylicView;
@@ -10,13 +13,29 @@ public static class ServicesExtension
{
public static MauiAppBuilder InitCore(this MauiAppBuilder builder)
{

builder.UseAcrylicView();
builder.UseSkiaSharp(true);
builder.UseMaterialComponents();
builder.UseMauiCommunityToolkit();
builder.UseMauiCommunityToolkitCore();
builder.UseMauiCommunityToolkitMediaElement();

builder.Services.RegisterLogicProvider();


builder.Services.RegisterGitHubFeatures();



#region [ LocalDb ]

var DbName = "mauisland.db";
var localDbPath = Path.Combine(FileSystem.AppDataDirectory, DbName);
builder.Services.RegisterLocalDbFeatures(localDbPath);
builder.Services.RegisterLocalDbFeaturesGitHub();
#endregion


return builder;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -4,8 +4,7 @@ namespace MAUIsland.GitHubFeatures;

public static class ServiceExtension
{

public static void RegisterLogicProvider(this IServiceCollection services)
public static void RegisterGitHubFeatures(this IServiceCollection services)
{
services.AddTransient<IGitHubService, OctokitGitHubClient>();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace MAUIsland.Features.LocalDbFeatures.GitHub;

public class GitHubIssueLocalDbService : SQLitePCLRawService<GitHubIssueLocalDbModel>, IGitHubIssueLocalDbService
{
#region [ CTor ]

public GitHubIssueLocalDbService(DatabaseSettings settings) : base(settings)
{

}

#endregion
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace MAUIsland.Features.LocalDbFeatures.GitHub;

public interface IGitHubIssueLocalDbService : ILocalDbService<GitHubIssueLocalDbModel>
{

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\MAUIsland.Features.LocalDbFeatures\MAUIsland.Features.LocalDbFeatures.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System.ComponentModel.DataAnnotations.Schema;

namespace MAUIsland.Features.LocalDbFeatures.GitHub;

[Table("IssueModel")]
public class GitHubIssueLocalDbModel : BaseLocalEntity
{
#region [ CTor ]

public GitHubIssueLocalDbModel()
{

}
#endregion

#region [ Properties ]
[Column("control_name")]
public long ControlName { get; set; }

[Column("issue_id")]
public long IssueId { get; set; }

[Column("title")]
public string Title { get; set; }

[Column("issue_link_url")]
public string IssueLinkUrl { get; set; }

[Column("mile_stone")]
public string MileStone { get; set; }

[Column("owner_name")]
public string OwnerName { get; set; }

[Column("created_date")]
public DateTime CreatedDate { get; set; }

[Column("last_updated")]
public DateTime LastUpdated { get; set; }
#endregion
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Microsoft.Extensions.DependencyInjection;

namespace MAUIsland.Features.LocalDbFeatures.GitHub;

public static class ServiceExtension
{

public static void RegisterLocalDbFeaturesGitHub(this IServiceCollection services)
{
services.AddTransient<IGitHubIssueLocalDbService, GitHubIssueLocalDbService>();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace MAUIsland.Features.LocalDbFeatures;

public class BaseLocalEntity
{
[PrimaryKey]
[AutoIncrement]
[Column("id")]
public int Id { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace MAUIsland.Features.LocalDbFeatures;

public class DatabaseSettings
{
public string DatabasePath { get; set; } = string.Empty;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
global using SQLite;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace MAUIsland.Features.LocalDbFeatures;

public interface ILocalDbService<T> where T : class
{
Task<List<T>> GetAllAsync();
Task<T?> GetByIdAsync(int id);
Task AddAsync(T entity);
Task AddRangeAsync(IEnumerable<T> entities);
Task UpdateAsync(T entity);
Task DeleteAsync(T entity);
}
Loading