Skip to content

Commit

Permalink
add more xml docs for swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
Barsonax committed May 9, 2024
1 parent 879d68e commit 7d29b69
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CleanAspCore/Features/Departments/Endpoints/AddDepartments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ public sealed class CreateDepartmentRequest
/// <summary>
/// The name of the to be created department.
/// </summary>
/// <example>Engineering</example>
public required string Name { get; init; }

/// <summary>
/// The city in which this to be created department is in.
/// </summary>
/// <example>Amsterdam</example>
public required string City { get; init; }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace CleanAspCore.Features.Departments.Endpoints;

/// <summary>
///
/// The get department response.
/// </summary>
public sealed class GetDepartmentResponse
{
Expand All @@ -18,11 +18,13 @@ public sealed class GetDepartmentResponse
/// <summary>
/// The name of this department.
/// </summary>
/// <example>Engineering</example>
public required string Name { get; init; }

/// <summary>
/// The city which this department is in.
/// </summary>
/// <example>Amsterdam</example>
public required string City { get; init; }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace CleanAspCore.Features.Employees.Endpoints;

/// <summary>
///
/// The get employee response.
/// </summary>
public sealed class GetEmployeeResponse
{
Expand Down
29 changes: 29 additions & 0 deletions CleanAspCore/Features/Employees/Endpoints/UpdateEmployeeById.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,42 @@

namespace CleanAspCore.Features.Employees.Endpoints;

/// <summary>
/// A request to update a employee.
/// </summary>
public sealed class UpdateEmployeeRequest
{
/// <summary>
/// The firstname of this employee.
/// </summary>
/// <example>Mary</example>
public string? FirstName { get; init; }

/// <summary>
/// The lastname of this employee.
/// </summary>
/// <example>Poppins</example>
public string? LastName { get; init; }

/// <summary>
/// The email of this employee.
/// </summary>
public string? Email { get; init; }

/// <summary>
/// The gender of this employee.
/// </summary>
/// <example>Female</example>
public string? Gender { get; init; }

/// <summary>
/// The department id of which this employee is in.
/// </summary>
public Guid? DepartmentId { get; init; }

/// <summary>
/// The job id of this employee.
/// </summary>
public Guid? JobId { get; init; }
}

Expand Down
7 changes: 7 additions & 0 deletions CleanAspCore/Features/Jobs/Endpoints/AddJobs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@

namespace CleanAspCore.Features.Jobs.Endpoints;

/// <summary>
/// A request to create a new job.
/// </summary>
public sealed class CreateJobRequest
{
/// <summary>
/// The name of this job.
/// </summary>
/// <example>Software Engineer</example>
public required string Name { get; init; }
}

Expand Down
17 changes: 14 additions & 3 deletions CleanAspCore/Features/Jobs/Endpoints/GetJobById.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,26 @@

namespace CleanAspCore.Features.Jobs.Endpoints;

public sealed class JobDto
/// <summary>
/// The get job response.
/// </summary>
public sealed class GetJobResponse
{
/// <summary>
/// The id of this job.
/// </summary>
public required Guid Id { get; init; }

/// <summary>
/// The name of this job.
/// </summary>
/// <example>Software Engineer</example>
public required string Name { get; init; }
}

internal static class GetJobById
{
internal static async Task<JsonHttpResult<JobDto>> Handle(Guid id, HrContext context, CancellationToken cancellationToken)
internal static async Task<JsonHttpResult<GetJobResponse>> Handle(Guid id, HrContext context, CancellationToken cancellationToken)
{
var results = await context.Jobs
.Where(x => x.Id == id)
Expand All @@ -22,7 +33,7 @@ internal static async Task<JsonHttpResult<JobDto>> Handle(Guid id, HrContext con
return TypedResults.Json(results);
}

private static JobDto ToDto(this Job department) => new()
private static GetJobResponse ToDto(this Job department) => new()
{
Id = department.Id,
Name = department.Name
Expand Down

0 comments on commit 7d29b69

Please sign in to comment.