Strypper / mauisland

MAUIsland 🏝️ is the number 1 controls gallery for .NET MAUI
MIT License
198 stars 14 forks source link

πŸš€ Get Issues By Labels Then Save Them To LocalDB #184

Closed Strypper closed 8 months ago

Strypper commented 8 months ago

Description

IControlsService

The IControlsService interface now includes a new method:

Task<ControlIssueModel> GetControlIssues(string controlGroup, IEnumerable<string> labels);

The supported control groups are:


    public const string BuiltInControls = nameof(BuiltInControls); βœ…
    public const string SyncfusionControls = nameof(SyncfusionControls); β›”
    public const string DevExpressControls = nameof(DevExpressControls); β›”
    public const string CommunityToolkit = nameof(CommunityToolkit); β›”
    public const string GitHubCommunity = nameof(GitHubCommunity); β›”
    public const string MaterialComponent = nameof(MaterialComponent); β›”

Implement the logic of this method in ControlsService.cs with these below goals

  1. Retrieve Control Issues by Labels: Implement the logic in ControlsService.cs to fetch control issues by labels. Currently, only BuiltInControls is supported. Example usage:
string controlLabel = "control/activity-Indicator";
string platformLabel = "platform/windows";
List<string> labelsList = new(){ controlLabel, platformLabel };
IControlsService.GetControlIssues.GetControlIssues(nameof(BuiltInControls),  labelsList);

The implementation will attach

string owner = "dotnet";
string repository = "maui";
IGitHubService.GetGitHubIssuesByLabels(owner, repository, labelsList);

⚠️ Support for other control groups will be added in the future.

  1. Save Issues to Local Database:

Utilize the provided GitHubIssueLocalDbModel to save issues to the local database. The model needs a control name property to indicate the control to which the issue belongs.

Ensure to cache issues retrieved from IGitHubService for 1 hour. When GetControlIssues is invoked, check the local database first. If the cache expires, use IGitHubService to fetch issues and save them to the database.

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

    public GitHubIssueLocalDbModel()
    {

    }
    #endregion

    #region [ Properties ]

    // control name

    [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
}

⚠️ The control name property is missing in the provided model.

By incorporating these updates, IControlsService will offer enhanced functionality to retrieve and manage control-related issues.

Public API Changes

IControlsService.GetControlIssues(nameof(BuiltInControls), labelsList);

Intended Use-Case

Get related issues related to control