Skip to content

Commit

Permalink
docs: Add missing docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
data-miner00 committed Feb 11, 2024
1 parent 65276ab commit db5b99b
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Linker.Core/ApiModels/CreateWorkspaceMembershipRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,23 @@
using Linker.Core.Models;
using System;

/// <summary>
/// The workspace membership request.
/// </summary>
public sealed class CreateWorkspaceMembershipRequest
{
/// <summary>
/// Gets or sets the workspace ID.
/// </summary>
required public Guid WorkspaceId { get; set; }

/// <summary>
/// Gets or sets the user ID.
/// </summary>
required public Guid UserId { get; set; }

/// <summary>
/// Gets or sets the workspace role for the user.
/// </summary>
required public WorkspaceRole WorkspaceRole { get; set; }
}
12 changes: 12 additions & 0 deletions src/Linker.Core/ApiModels/UpdateWorkspaceRequest.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
namespace Linker.Core.ApiModels;

/// <summary>
/// The request to update workspace info.
/// </summary>
public sealed class UpdateWorkspaceRequest
{
/// <summary>
/// The unique handle of the workspace.
/// </summary>
required public string Handle { get; set; }

/// <summary>
/// Gets or sets the name of the workspace.
/// </summary>
required public string Name { get; set; }

/// <summary>
/// Gets or sets the description of the workspace.
/// </summary>
required public string Description { get; set; }
}
18 changes: 18 additions & 0 deletions src/Linker.Core/Models/WorkspaceMembership.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,33 @@

using System;

/// <summary>
/// The membership record for a workspace.
/// </summary>
public class WorkspaceMembership
{
/// <summary>
/// Gets or sets the workspace ID.
/// </summary>
required public string WorkspaceId { get; set; }

/// <summary>
/// Gets or sets the user ID.
/// </summary>
required public string UserId { get; set; }

/// <summary>
/// Gets or sets the workspace role of the user.
/// </summary>
required public WorkspaceRole WorkspaceRole { get; set; }

/// <summary>
/// Gets or sets the date of joining.
/// </summary>
required public DateTime CreatedAt { get; set; }

/// <summary>
/// Gets or sets the date of modification.
/// </summary>
required public DateTime ModifiedAt { get; set; }
}
15 changes: 15 additions & 0 deletions src/Linker.WebApi/Mappers/WorkspaceMapperProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,24 @@
using Linker.Core.ApiModels;
using Linker.Core.Models;

/// <summary>
/// The mapper profile for Workspace related models.
/// </summary>
public sealed class WorkspaceMapperProfile : Profile
{
/// <summary>
/// Initializes a new instance of the <see cref="WorkspaceMapperProfile"/> class.
/// </summary>
public WorkspaceMapperProfile()
{
this.ConfigureMapFromPostRequestToWorkspace();
this.ConfigureMapFromPutRequestToWorkspace();
this.ConfigureMapFromMembershipPostRequestToMembership();
}

/// <summary>
/// Configures the mapping for <see cref="CreateWorkspaceRequest"/> to <see cref="Workspace"/>.
/// </summary>
public void ConfigureMapFromPostRequestToWorkspace()
{
this.CreateMap<CreateWorkspaceRequest, Workspace>(MemberList.Source)
Expand All @@ -21,11 +30,17 @@ public void ConfigureMapFromPostRequestToWorkspace()
.ForMember(dest => dest.ModifiedAt, opt => opt.MapFrom(src => DateTime.Now));
}

/// <summary>
/// Configures the mapping for <see cref="UpdateWorkspaceRequest"/> to <see cref="Workspace"/>.
/// </summary>
public void ConfigureMapFromPutRequestToWorkspace()
{
this.CreateMap<UpdateWorkspaceRequest, Workspace>(MemberList.Source);
}

/// <summary>
/// Configures the mapping for <see cref="CreateWorkspaceMembershipRequest"/> to <see cref="WorkspaceMembership"/>.
/// </summary>
public void ConfigureMapFromMembershipPostRequestToMembership()
{
this.CreateMap<CreateWorkspaceMembershipRequest, WorkspaceMembership>(MemberList.Source)
Expand Down

0 comments on commit db5b99b

Please sign in to comment.