29 lines
775 B
C#
29 lines
775 B
C#
using System;
|
|
using Flawless.Communication.Response;
|
|
using Flawless.Communication.Shared;
|
|
|
|
namespace Flawless.Client.Models;
|
|
|
|
public record RepositoryHomePageModel(
|
|
string OwnerName,
|
|
string Name,
|
|
string Description,
|
|
bool IsArchived,
|
|
bool IsOwner,
|
|
bool IsLocalAvailable,
|
|
string LatestCommitId)
|
|
{
|
|
public string FullName { get; } = $"{OwnerName}/{Name}";
|
|
|
|
public static RepositoryHomePageModel FromResponse(RepositoryInfoResponse r)
|
|
{
|
|
return new RepositoryHomePageModel(
|
|
r.OwnerUsername,
|
|
r.RepositoryName,
|
|
r.Description ?? String.Empty,
|
|
r.IsArchived,
|
|
r.Role == RepositoryRole.Owner,
|
|
true,
|
|
r.LatestCommitId.ToString().Substring(0, 6));
|
|
}
|
|
} |