Skip to content

Commit 331e20b

Browse files
refactor: document all modules
1 parent abb5867 commit 331e20b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1366
-15
lines changed

src/1-Libraries/Application/Dtos/CreateDemoThingDto.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,31 @@
55

66
namespace CanBeYours.Application.Dtos;
77

8+
/// <summary>
9+
/// Data Transfer Object for creating a new DemoThing entity.
10+
/// This class demonstrates how to create DTOs with validation attributes and resource-based localization.
11+
/// The DemoThing functionality shown here is just an example to help you learn how to implement
12+
/// your own unique features into the current codebase.
13+
/// </summary>
814
public class CreateDemoThingDto
915
{
16+
/// <summary>
17+
/// The name of the demo thing. This field is required and will be displayed using localized resources.
18+
/// </summary>
1019
[Display(Name = nameof(SharedResource.DemoThing_Name), ResourceType = typeof(SharedResource))]
1120
[Required(ErrorMessageResourceType = typeof(SharedResource), ErrorMessageResourceName = nameof(SharedResource.DemoThing_Name))]
1221
public string Name { get; set; }
1322

23+
/// <summary>
24+
/// The description of the demo thing. This field is required and will be displayed using localized resources.
25+
/// </summary>
1426
[Display(Name = nameof(SharedResource.DemoThing_Description), ResourceType = typeof(SharedResource))]
1527
[Required(ErrorMessageResourceType = typeof(SharedResource), ErrorMessageResourceName = nameof(SharedResource.DemoThing_Description))]
1628
public string Description { get; set; }
1729

30+
/// <summary>
31+
/// The type of the demo thing. This field is required and determines the category of the demo thing.
32+
/// </summary>
1833
[Display(Name = nameof(SharedResource.DemoThing_Type), ResourceType = typeof(SharedResource))]
1934
[Required(ErrorMessageResourceName = nameof(CoreResource.Required), ErrorMessageResourceType = typeof(CoreResource))]
2035
public DemoThingType Type { get; set; }

src/1-Libraries/Application/Dtos/GetDemoThingDto.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,38 @@
33

44
namespace CanBeYours.Application.Dtos;
55

6+
/// <summary>
7+
/// Data Transfer Object for retrieving DemoThing entity data.
8+
/// This class demonstrates how to create response DTOs that extend base DTOs and include
9+
/// additional properties for display purposes.
10+
/// The DemoThing functionality shown here is just an example to help you learn how to implement
11+
/// your own unique features into the current codebase.
12+
/// </summary>
613
public class GetDemoThingDto : GetEntityDto
714
{
15+
/// <summary>
16+
/// The name of the demo thing for display purposes.
17+
/// </summary>
818
public string Name { get; set; }
19+
20+
/// <summary>
21+
/// The description of the demo thing for display purposes.
22+
/// </summary>
923
public string Description { get; set; }
24+
25+
/// <summary>
26+
/// The type/category of the demo thing.
27+
/// </summary>
1028
public DemoThingType Type { get; set; }
29+
30+
/// <summary>
31+
/// The email address of the user who owns this demo thing.
32+
/// This is populated by the service layer for display purposes.
33+
/// </summary>
1134
public string UserEmail { get; set; }
35+
36+
/// <summary>
37+
/// The unique identifier of the user who owns this demo thing.
38+
/// </summary>
1239
public string UserId { get; set; }
1340
}

src/1-Libraries/Application/Dtos/SearchDemoThingsInputDto.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,26 @@
33

44
namespace CanBeYours.Application.Dtos;
55

6+
/// <summary>
7+
/// Data Transfer Object for search input parameters when searching DemoThing entities.
8+
/// This class demonstrates how to create search DTOs that extend base search DTOs and include
9+
/// custom filtering options with sensible defaults.
10+
/// The DemoThing functionality shown here is just an example to help you learn how to implement
11+
/// your own unique features into the current codebase.
12+
/// </summary>
613
public class SearchDemoThingsInputDto : SearchInputDto
714
{
15+
/// <summary>
16+
/// Initializes a new instance with a default page size of 5 records per page.
17+
/// This demonstrates how to set sensible defaults for search parameters.
18+
/// </summary>
819
public SearchDemoThingsInputDto()
920
{
1021
RecordsPerPage = 5;
1122
}
1223

24+
/// <summary>
25+
/// Optional filter by demo thing type. When null, all types are included in the search.
26+
/// </summary>
1327
public DemoThingType? Type { get; set; }
1428
}

src/1-Libraries/Application/Dtos/UpdateDemoThingDto.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,31 @@
55

66
namespace CanBeYours.Application.Dtos;
77

8+
/// <summary>
9+
/// Data Transfer Object for updating an existing DemoThing entity.
10+
/// This class demonstrates how to create update DTOs with validation attributes and resource-based localization.
11+
/// The DemoThing functionality shown here is just an example to help you learn how to implement
12+
/// your own unique features into the current codebase.
13+
/// </summary>
814
public class UpdateDemoThingDto
915
{
16+
/// <summary>
17+
/// The new name for the demo thing. This field is required and will be displayed using localized resources.
18+
/// </summary>
1019
[Display(Name = nameof(SharedResource.DemoThing_Name), ResourceType = typeof(SharedResource))]
1120
[Required(ErrorMessageResourceType = typeof(SharedResource), ErrorMessageResourceName = nameof(SharedResource.DemoThing_Name))]
1221
public string Name { get; set; }
1322

23+
/// <summary>
24+
/// The new description for the demo thing. This field is required and will be displayed using localized resources.
25+
/// </summary>
1426
[Display(Name = nameof(SharedResource.DemoThing_Description), ResourceType = typeof(SharedResource))]
1527
[Required(ErrorMessageResourceType = typeof(SharedResource), ErrorMessageResourceName = nameof(SharedResource.DemoThing_Description))]
1628
public string Description { get; set; }
1729

30+
/// <summary>
31+
/// The new type for the demo thing. This field is required and determines the category of the demo thing.
32+
/// </summary>
1833
[Display(Name = nameof(SharedResource.DemoThing_Type), ResourceType = typeof(SharedResource))]
1934
[Required(ErrorMessageResourceName = nameof(CoreResource.Required), ErrorMessageResourceType = typeof(CoreResource))]
2035
public DemoThingType Type { get; set; }

src/1-Libraries/Application/Exceptions/DemoThingApplicationExceptions.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,27 @@
88

99
namespace CanBeYours.Application.Exceptions;
1010

11+
/// <summary>
12+
/// Static factory class for creating application-specific exceptions related to DemoThing operations.
13+
/// This class demonstrates how to create custom exceptions with localized error messages and
14+
/// proper error handling patterns.
15+
/// The DemoThing functionality shown here is just an example to help you learn how to implement
16+
/// your own unique features into the current codebase.
17+
/// </summary>
1118
internal static class DemoThingApplicationExceptions
1219
{
20+
/// <summary>
21+
/// Creates an application exception when a demo thing is not found by the specified search key.
22+
/// This method demonstrates how to create localized exceptions with placeholder values.
23+
/// </summary>
24+
/// <param name="searchedKey">The key that was used to search for the demo thing (e.g., ID, name)</param>
25+
/// <returns>An application exception with localized error message</returns>
26+
/// <example>
27+
/// <code>
28+
/// if (demoThing == null)
29+
/// throw DemoThingApplicationExceptions.DemoThingNotFound(id);
30+
/// </code>
31+
/// </example>
1332
public static ApplicationException DemoThingNotFound(string searchedKey)
1433
{
1534
return new ApplicationException(

src/1-Libraries/Application/Helpers/Permissions.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ namespace CanBeYours.Application.Helpers;
99
/// <summary>
1010
/// This class contains all permissions used in the application.
1111
/// They will be automatically registered in the database.
12+
/// This class demonstrates how to implement a permission system with reflection-based
13+
/// permission discovery and automatic database registration.
14+
/// The DemoThing functionality shown here is just an example to help you learn how to implement
15+
/// your own unique features into the current codebase.
1216
/// </summary>
1317
public static class Permissions
1418
{
@@ -25,7 +29,16 @@ public static class Demo
2529

2630
/// <summary>
2731
/// Retrieves all permissions dynamically using reflection.
32+
/// This method demonstrates how to automatically discover and register permissions
33+
/// from nested static classes, making the permission system maintainable and extensible.
2834
/// </summary>
35+
/// <returns>A collection of permission settings that can be registered in the database</returns>
36+
/// <example>
37+
/// <code>
38+
/// var permissions = Permissions.GetPermissions();
39+
/// // This will return permissions for Demo.DEMO_THINGS automatically
40+
/// </code>
41+
/// </example>
2942
public static IEnumerable<PermissionsSettings> GetPermissions()
3043
{
3144
var permissionsList = new List<PermissionsSettings>();

src/1-Libraries/Application/Services/DemoThings/DemoThingService.cs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,63 @@
99

1010
namespace CanBeYours.Application.Services.DemoThings;
1111

12+
/// <summary>
13+
/// Application service for managing DemoThing entities.
14+
/// This class demonstrates how to implement application services that coordinate between
15+
/// different use cases and provide a clean API for the presentation layer.
16+
/// The DemoThing functionality shown here is just an example to help you learn how to implement
17+
/// your own unique features into the current codebase.
18+
/// </summary>
1219
internal class DemoThingService : ApplicationService, IDemoThingService
1320
{
21+
/// <summary>
22+
/// Initializes a new instance of the DemoThingService with the required dependencies.
23+
/// </summary>
24+
/// <param name="requestDispatcher">The request dispatcher for sending commands and queries</param>
1425
public DemoThingService(IRequestDispatcher requestDispatcher)
1526
: base(requestDispatcher) { }
1627

28+
/// <summary>
29+
/// Retrieves a demo thing by its unique identifier.
30+
/// This method demonstrates how to delegate to use cases using the request dispatcher.
31+
/// </summary>
32+
/// <param name="id">The unique identifier of the demo thing</param>
33+
/// <returns>A result containing the demo thing data or an error</returns>
1734
public async Task<Result<GetDemoThingDto>> GetDemoThing(string id)
1835
{
1936
return await _requestDispatcher.SendQuery(new GetDemoThingRequest(id));
2037
}
2138

39+
/// <summary>
40+
/// Creates a new demo thing with the specified data.
41+
/// This method demonstrates how to delegate to use cases using the request dispatcher.
42+
/// </summary>
43+
/// <param name="input">The data for creating the new demo thing</param>
44+
/// <returns>A result containing the command execution result or an error</returns>
2245
public async Task<Result<CommandResult>> CreateDemoThing(CreateDemoThingDto input)
2346
{
2447
return await _requestDispatcher.SendCommand(new CreateDemoThingRequest(input.Name, input.Description, input.Type));
2548
}
2649

50+
/// <summary>
51+
/// Updates an existing demo thing with new data.
52+
/// This method demonstrates how to delegate to use cases using the request dispatcher.
53+
/// </summary>
54+
/// <param name="id">The unique identifier of the demo thing to update</param>
55+
/// <param name="input">The new data for the demo thing</param>
56+
/// <returns>A result containing the command execution result or an error</returns>
2757
public async Task<Result<CommandResult>> UpdateDemoThing(string id, UpdateDemoThingDto input)
2858
{
2959
return await _requestDispatcher.SendCommand(new UpdateDemoThingRequest(id, input.Name, input.Description, input.Type));
3060
}
3161

62+
/// <summary>
63+
/// Searches for demo things based on specified criteria.
64+
/// This method demonstrates how to delegate to use cases using the request dispatcher
65+
/// and map complex input parameters.
66+
/// </summary>
67+
/// <param name="input">The search criteria and pagination parameters</param>
68+
/// <returns>A result containing the search results with pagination information</returns>
3269
public async Task<Result<SearchOutputDto<GetDemoThingDto>>> SearchDemoThings(SearchDemoThingsInputDto input)
3370
{
3471
return await _requestDispatcher.SendQuery(

src/1-Libraries/Application/Services/DemoThings/IDemoThingService.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,41 @@
44

55
namespace CanBeYours.Application.Services.DemoThings;
66

7+
/// <summary>
8+
/// Service interface for managing DemoThing entities.
9+
/// This interface demonstrates how to define service contracts with proper return types
10+
/// and async operations following CQRS patterns.
11+
/// The DemoThing functionality shown here is just an example to help you learn how to implement
12+
/// your own unique features into the current codebase.
13+
/// </summary>
714
public interface IDemoThingService
815
{
16+
/// <summary>
17+
/// Retrieves a demo thing by its unique identifier.
18+
/// </summary>
19+
/// <param name="id">The unique identifier of the demo thing</param>
20+
/// <returns>A result containing the demo thing data or an error</returns>
921
Task<Result<GetDemoThingDto>> GetDemoThing(string id);
22+
23+
/// <summary>
24+
/// Creates a new demo thing with the specified data.
25+
/// </summary>
26+
/// <param name="input">The data for creating the new demo thing</param>
27+
/// <returns>A result containing the command execution result or an error</returns>
1028
Task<Result<CommandResult>> CreateDemoThing(CreateDemoThingDto input);
29+
30+
/// <summary>
31+
/// Updates an existing demo thing with new data.
32+
/// </summary>
33+
/// <param name="id">The unique identifier of the demo thing to update</param>
34+
/// <param name="input">The new data for the demo thing</param>
35+
/// <returns>A result containing the command execution result or an error</returns>
1136
Task<Result<CommandResult>> UpdateDemoThing(string id, UpdateDemoThingDto input);
37+
38+
/// <summary>
39+
/// Searches for demo things based on specified criteria.
40+
/// </summary>
41+
/// <param name="input">The search criteria and pagination parameters</param>
42+
/// <returns>A result containing the search results with pagination information</returns>
1243
Task<Result<SearchOutputDto<GetDemoThingDto>>> SearchDemoThings(SearchDemoThingsInputDto input);
1344
}

src/1-Libraries/Application/Startup.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,19 @@
44

55
namespace CanBeYours.Application;
66

7+
/// <summary>
8+
/// Startup configuration class for the Application module.
9+
/// This class demonstrates how to configure dependency injection for application services.
10+
/// The DemoThing functionality shown here is just an example to help you learn how to implement
11+
/// your own unique features into the current codebase.
12+
/// </summary>
713
public static class Startup
814
{
15+
/// <summary>
16+
/// Registers all application services and handlers with the dependency injection container.
17+
/// This method is called during application startup to configure the Application module.
18+
/// </summary>
19+
/// <param name="services">The service collection to register services with</param>
920
public static void AddApplicationModule(this IServiceCollection services)
1021
{
1122
services.RegisterHandlers(typeof(Startup));

src/1-Libraries/Application/UseCases/DemoThings/CreateDemoThing/CreateDemoThingRequest.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,45 @@
66

77
namespace CanBeYours.Application.UseCases.DemoThings.CreateDemoThing;
88

9+
/// <summary>
10+
/// Command request for creating a new DemoThing entity.
11+
/// This class demonstrates how to implement command requests with validation attributes,
12+
/// immutable properties, and proper resource-based localization.
13+
/// The DemoThing functionality shown here is just an example to help you learn how to implement
14+
/// your own unique features into the current codebase.
15+
/// </summary>
916
internal class CreateDemoThingRequest : BaseCommand
1017
{
18+
/// <summary>
19+
/// Initializes a new instance of the CreateDemoThingRequest with the required data.
20+
/// </summary>
21+
/// <param name="name">The name of the demo thing</param>
22+
/// <param name="description">The description of the demo thing</param>
23+
/// <param name="type">The type/category of the demo thing</param>
1124
public CreateDemoThingRequest(string name, string description, DemoThingType type)
1225
{
1326
Name = name;
1427
Description = description;
1528
Type = type;
1629
}
1730

31+
/// <summary>
32+
/// The name of the demo thing. This field is required and will be displayed using localized resources.
33+
/// </summary>
1834
[Display(Name = nameof(SharedResource.DemoThing_Name), ResourceType = typeof(SharedResource))]
1935
[Required(ErrorMessageResourceName = nameof(CoreResource.Required), ErrorMessageResourceType = typeof(CoreResource))]
2036
public string Name { get; }
2137

38+
/// <summary>
39+
/// The description of the demo thing. This field is required and will be displayed using localized resources.
40+
/// </summary>
2241
[Display(Name = nameof(SharedResource.DemoThing_Description), ResourceType = typeof(SharedResource))]
2342
[Required(ErrorMessageResourceName = nameof(CoreResource.Required), ErrorMessageResourceType = typeof(CoreResource))]
2443
public string Description { get; }
2544

45+
/// <summary>
46+
/// The type of the demo thing. This field is required and determines the category of the demo thing.
47+
/// </summary>
2648
[Display(Name = nameof(SharedResource.DemoThing_Type), ResourceType = typeof(SharedResource))]
2749
[Required(ErrorMessageResourceName = nameof(CoreResource.Required), ErrorMessageResourceType = typeof(CoreResource))]
2850
public DemoThingType Type { get; }

0 commit comments

Comments
 (0)