Skip to content

Commit 6f00d65

Browse files
authored
Merge pull request #39 from WindowsAppCommunity/38-parentpublisher-and-childpublisher-collections-should-include-roles
Include Role data on Parent and Child Publisher collections
2 parents c1628df + 7580640 commit 6f00d65

18 files changed

+207
-142
lines changed

src/IModifiablePublisher.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
/// <summary>
44
/// Represents a content publisher that can be modified.
55
/// </summary>
6-
public interface IModifiablePublisher : IReadOnlyPublisher<IModifiablePublisherCollection<IReadOnlyPublisher>>, IReadOnlyPublisher, IModifiableEntity, IModifiableAccentColor, IModifiableUserRoleCollection, IModifiableProjectCollection<IReadOnlyProject>
6+
public interface IModifiablePublisher : IReadOnlyPublisher<IModifiablePublisherCollection<IReadOnlyPublisherRole>>, IReadOnlyPublisher, IModifiableEntity, IModifiableAccentColor, IModifiableUserRoleCollection, IModifiableProjectCollection<IReadOnlyProject>
77
{
88
}

src/IReadOnlyPublisher.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ namespace WindowsAppCommunity.Sdk;
55
/// <summary>
66
/// Represents a publisher, a collection of projects and collaborators who publish content to users.
77
/// </summary>
8-
public interface IReadOnlyPublisher : IReadOnlyPublisher<IReadOnlyPublisherCollection>
8+
public interface IReadOnlyPublisher : IReadOnlyPublisher<IReadOnlyPublisherRoleCollection>
99
{
1010
}
1111

1212
/// <summary>
1313
/// Represents a publisher, a collection of projects and collaborators who publish content to users.
1414
/// </summary>
1515
public interface IReadOnlyPublisher<TPublisherCollection> : IReadOnlyEntity, IReadOnlyAccentColor, IReadOnlyUserRoleCollection, IReadOnlyProjectCollection, IHasId
16-
where TPublisherCollection : IReadOnlyPublisherCollection<IReadOnlyPublisher>
16+
where TPublisherCollection : IReadOnlyPublisherCollection<IReadOnlyPublisherRole>
1717
{
1818
/// <summary>
1919
/// The collection of publishers that this publisher belongs to.

src/Models/IProjectRoleCollection.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,3 @@ public interface IProjectRoleCollection
1212
/// </summary>
1313
ProjectRole[] Projects { get; set; }
1414
}
15-
16-
/// <summary>
17-
/// A container for a project and a corresponding role.
18-
/// </summary>
19-
public record ProjectRole
20-
{
21-
/// <summary>
22-
/// The project ID.
23-
/// </summary>
24-
public required Cid ProjectId { get; init; }
25-
26-
/// <summary>
27-
/// The role of the project.
28-
/// </summary>
29-
public required DagCid Role { get; init; }
30-
}

src/Models/IPublisherRoleCollection.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,3 @@ public interface IPublisherRoleCollection
1212
/// </summary>
1313
public PublisherRole[] Publishers { get; set; }
1414
}
15-
16-
/// <summary>
17-
/// A container for a Publisher and a corresponding role.
18-
/// </summary>
19-
public record PublisherRole
20-
{
21-
/// <summary>
22-
/// The publisher ID.
23-
/// </summary>
24-
public required Cid PublisherId { get; init; }
25-
26-
/// <summary>
27-
/// The role of the publisher.
28-
/// </summary>
29-
public required DagCid Role { get; init; }
30-
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
namespace WindowsAppCommunity.Sdk.Models;
2+
3+
/// <summary>
4+
/// Represents a collection of publishers and their roles, where each publisher can have child and parent publishers.
5+
/// This interface is used to manage hierarchical relationships between publishers.
6+
/// </summary>
7+
public interface IPublisherRoleGraphNodeCollection
8+
{
9+
/// <summary>
10+
/// A list of other publishers who are managed under this publisher.
11+
/// </summary>
12+
public PublisherRoleCollection ParentPublishers { get; set; }
13+
14+
/// <summary>
15+
/// A list of other publishers who are managed under this publisher.
16+
/// </summary>
17+
public PublisherRoleCollection ChildPublishers { get; set; }
18+
}

src/Models/IUserRoleCollection.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,3 @@ public interface IUserRoleCollection
1212
/// </summary>
1313
public UserRole[] Users { get; set; }
1414
}
15-
16-
/// <summary>
17-
/// A container for a user and a corresponding role.
18-
/// </summary>
19-
public record UserRole
20-
{
21-
/// <summary>
22-
/// The user ID.
23-
/// </summary>
24-
public required Cid UserId { get; init; }
25-
26-
/// <summary>
27-
/// The role of the user.
28-
/// </summary>
29-
public required DagCid Role { get; init; }
30-
}

src/Models/ProjectRole.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using Ipfs;
2+
3+
namespace WindowsAppCommunity.Sdk.Models;
4+
5+
/// <summary>
6+
/// A container for a project and a corresponding role.
7+
/// </summary>
8+
public record ProjectRole
9+
{
10+
/// <summary>
11+
/// The project ID.
12+
/// </summary>
13+
public required Cid ProjectId { get; init; }
14+
15+
/// <summary>
16+
/// The role of the project.
17+
/// </summary>
18+
public required DagCid Role { get; init; }
19+
}

src/Models/Publisher.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace WindowsAppCommunity.Sdk.Models;
77
/// <summary>
88
/// Represents a content publisher.
99
/// </summary>
10-
public record Publisher : IEntity, ILinkCollection, IProjectCollection, IUserRoleCollection, IConnections, IAccentColor, ISources<Cid>
10+
public record Publisher : IEntity, ILinkCollection, IProjectCollection, IUserRoleCollection, IPublisherRoleGraphNodeCollection, IConnections, IAccentColor, ISources<Cid>
1111
{
1212
/// <summary>
1313
/// The name of the publisher.
@@ -52,12 +52,12 @@ public record Publisher : IEntity, ILinkCollection, IProjectCollection, IUserRol
5252
/// <summary>
5353
/// A list of other publishers who are managed under this publisher.
5454
/// </summary>
55-
public PublisherCollection ParentPublishers { get; set; } = new();
55+
public PublisherRoleCollection ParentPublishers { get; set; } = new();
5656

5757
/// <summary>
5858
/// A list of other publishers who are managed under this publisher.
5959
/// </summary>
60-
public PublisherCollection ChildPublishers { get; set; } = new();
60+
public PublisherRoleCollection ChildPublishers { get; set; } = new();
6161

6262
/// <summary>
6363
/// Holds information about publisher assets that have been published for consumption by an end user, such as a Microsoft Store app, a package on nuget.org, a git repo, etc.

src/Models/PublisherRole.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using Ipfs;
2+
3+
namespace WindowsAppCommunity.Sdk.Models;
4+
5+
/// <summary>
6+
/// A container for a Publisher and a corresponding role.
7+
/// </summary>
8+
public record PublisherRole
9+
{
10+
/// <summary>
11+
/// The publisher ID.
12+
/// </summary>
13+
public required Cid PublisherId { get; init; }
14+
15+
/// <summary>
16+
/// The role of the publisher.
17+
/// </summary>
18+
public required DagCid Role { get; init; }
19+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace WindowsAppCommunity.Sdk.Models;
2+
3+
/// <inheritdoc/>
4+
public record PublisherRoleCollection : IPublisherRoleCollection
5+
{
6+
/// <inheritdoc />
7+
public PublisherRole[] Publishers { get; set; } = [];
8+
}

0 commit comments

Comments
 (0)