Skip to content

Commit

Permalink
Cleanup collaborator serialization helpers and properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Arlodotexe committed Nov 30, 2024
1 parent 6ed24aa commit fbf3eca
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,6 @@ internal static partial class UpdateEventSerializationHelpers
nameof(ProjectFeatureRemoveEvent) when jObject["Feature"] is { } featureRemoveToken && featureRemoveToken.Value<string>() is { } value =>
new ProjectFeatureRemoveEvent(id, value),

nameof(ProjectCollaboratorAddEvent) when jObject["Collaborator"] is { } collaboratorAddToken && collaboratorAddToken.ToObject<Collaborator>(serializer) is { } value =>
new ProjectCollaboratorAddEvent(id, value),

nameof(ProjectCollaboratorRemoveEvent) when jObject["Collaborator"] is { } collaboratorRemoveToken && collaboratorRemoveToken.ToObject<Collaborator>(serializer) is { } value =>
new ProjectCollaboratorRemoveEvent(id, value),

nameof(ProjectLinkAddEvent) when jObject["Link"] is { } linkAddToken && linkAddToken.ToObject<Link>(serializer) is { } value =>
new ProjectLinkAddEvent(id, value),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,6 @@ private static void WriteProject(WinAppCommunityUpdateEvent @event, JObject jObj
case ProjectDependencyRemoveEvent projectDependencyRemoveEvent:
jObject.Add("Dependency", JValue.CreateString(projectDependencyRemoveEvent.Dependency.ToString()));
break;
case ProjectCollaboratorAddEvent projectCollaboratorAddEvent:
jObject.Add("Collaborator", JObject.FromObject(projectCollaboratorAddEvent.Collaborator));
break;
case ProjectCollaboratorRemoveEvent projectCollaboratorRemoveEvent:
jObject.Add("Collaborator", JObject.FromObject(projectCollaboratorRemoveEvent.Collaborator));
break;
case ProjectLinkAddEvent projectLinkAddEvent:
jObject.Add("Link", JObject.FromObject(projectLinkAddEvent.Link));
break;
Expand All @@ -139,7 +133,7 @@ private static void WriteProject(WinAppCommunityUpdateEvent @event, JObject jObj
: new JValue(projectForgetMeUpdateEvent.ForgetMe.Value));
break;
case ProjectPrivacyUpdateEvent projectPrivacyUpdateEvent:
jObject.Add("IsPrivate", new JValue(projectPrivacyUpdateEvent.IsPrivate));
jObject.Add("IsUnlisted", new JValue(projectPrivacyUpdateEvent.IsUnlisted));
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Models/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public record Project : IName
/// <summary>
/// An extended description of this project.
/// </summary>
public string ExtendedDescription { get; set; }
public required string ExtendedDescription { get; set; }

/// <summary>
/// A list of <see cref="DagCid"/>s that point to images demonstrating this project.
Expand Down
2 changes: 1 addition & 1 deletion src/Models/Publisher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public record Publisher : IName
/// <summary>
/// An extended description of the publisher.
/// </summary>
public string ExtendedDescription { get; set; }
public required string ExtendedDescription { get; set; }

/// <summary>
/// A hex-encoded accent color for this publisher.
Expand Down
4 changes: 0 additions & 4 deletions src/Models/UpdateEvents/ProjectUpdateEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ public record ProjectDependencyAddEvent(string Id, Cid Dependency) : ProjectUpda

public record ProjectDependencyRemoveEvent(string Id, Cid Dependency) : ProjectUpdateEvent(Id, nameof(ProjectDependencyRemoveEvent));

public record ProjectCollaboratorAddEvent(string Id, Collaborator Collaborator) : ProjectUpdateEvent(Id, nameof(ProjectCollaboratorAddEvent));

public record ProjectCollaboratorRemoveEvent(string Id, Collaborator Collaborator) : ProjectUpdateEvent(Id, nameof(ProjectCollaboratorRemoveEvent));

public record ProjectLinkAddEvent(string Id, Link Link) : ProjectUpdateEvent(Id, nameof(ProjectLinkAddEvent));

public record ProjectLinkRemoveEvent(string Id, Link Link) : ProjectUpdateEvent(Id, nameof(ProjectLinkRemoveEvent));
Expand Down

0 comments on commit fbf3eca

Please sign in to comment.