File tree Expand file tree Collapse file tree 7 files changed +87
-2
lines changed
src/BytLabs.Api/BytLabs.Api.Graphql Expand file tree Collapse file tree 7 files changed +87
-2
lines changed Original file line number Diff line number Diff line change 11<Project>
22 <PropertyGroup>
3- <Version>1.2.0 </Version>
3+ <Version>1.2.1 </Version>
44 </PropertyGroup>
55</Project>
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ Welcome to BytLabs Backend Packages documentation. This collection of .NET libra
99## Quick Navigation
1010
1111- [Getting Started](docs/getting-started.md)
12- - [API Documentation](api/index .md)
12+ - [API Documentation](api/BytLabs.Api .md)
1313- [Introduction](docs/introduction.md)
1414
1515## Key Features
Original file line number Diff line number Diff line change @@ -34,6 +34,21 @@ public static IRequestExecutorBuilder AddCommandType<TCommand>(this IRequestExec
3434 return requestExecutorBuilder;
3535 }
3636
37+ /// <summary>
38+ /// Adds a DTO (Data Transfer Object) type to the GraphQL schema.
39+ /// </summary>
40+ /// <typeparam name="T">The DTO type to add.</typeparam>
41+ /// <param name="requestExecutorBuilder">The GraphQL request executor builder.</param>
42+ /// <returns>The configured request executor builder with added DTO type.</returns>
43+ /// <remarks>
44+ /// This method registers a DTO type using the <see cref="DtoType{T}"/> wrapper to expose it in the GraphQL schema.
45+ /// </remarks>
46+ public static IRequestExecutorBuilder AddDtoType<T>(this IRequestExecutorBuilder requestExecutorBuilder)
47+ {
48+ return requestExecutorBuilder
49+ .AddType<DtoType<T>>();
50+ }
51+
3752 /// <summary>
3853 /// Adds custom error types to the GraphQL schema.
3954 /// </summary>
Original file line number Diff line number Diff line change 22
33namespace BytLabs.Api.Graphql.Types
44{
5+ /// <summary>
6+ /// Base GraphQL type for aggregate root entities.
7+ /// </summary>
8+ /// <typeparam name="TAggregate">The aggregate root type</typeparam>
9+ /// <typeparam name="TId">The type of the aggregate's identifier</typeparam>
510 public class AggregateType<TAggregate, TId> : ObjectType<TAggregate> where TAggregate : IAggregateRoot<TId>
611 {
12+ /// <summary>
13+ /// Configures the GraphQL type descriptor for the aggregate.
14+ /// </summary>
15+ /// <param name="descriptor">The descriptor to configure</param>
716 protected override void Configure(IObjectTypeDescriptor<TAggregate> descriptor)
817 {
918 descriptor.Ignore(a => a.DomainEvents);
Original file line number Diff line number Diff line change 1+ using HotChocolate.Data.Filters;
2+
3+ namespace BytLabs.Api.Graphql
4+ {
5+ /// <summary>
6+ /// Base GraphQL filter input type for DTOs.
7+ /// </summary>
8+ /// <typeparam name="T">The DTO type to create filters for</typeparam>
9+ public class DtoFilterInputType<T> : FilterInputType<T>
10+ {
11+ /// <summary>
12+ /// Configures the filter input type descriptor.
13+ /// </summary>
14+ /// <param name="descriptor">The descriptor to configure</param>
15+ protected override void Configure(IFilterInputTypeDescriptor<T> descriptor)
16+ {
17+ base.Configure(descriptor);
18+ descriptor.Name(typeof(T).Name.Replace("Dto", "") + "FilterInput");
19+ }
20+ }
21+ }
Original file line number Diff line number Diff line change 1+ using HotChocolate.Data.Sorting;
2+
3+ namespace BytLabs.Api.Graphql
4+ {
5+ /// <summary>
6+ /// Base GraphQL sort input type for DTOs.
7+ /// </summary>
8+ /// <typeparam name="T">The DTO type to create sorting for</typeparam>
9+ public class DtoSortInputType<T> : SortInputType<T>
10+ {
11+ /// <summary>
12+ /// Configures the sort input type descriptor.
13+ /// </summary>
14+ /// <param name="descriptor">The descriptor to configure</param>
15+ protected override void Configure(ISortInputTypeDescriptor<T> descriptor)
16+ {
17+ base.Configure(descriptor);
18+ descriptor.Name(typeof(T).Name.Replace("Dto", "") + "SortInput");
19+ }
20+ }
21+ }
Original file line number Diff line number Diff line change 1+ namespace BytLabs.Api.Graphql
2+ {
3+ /// <summary>
4+ /// Base GraphQL type for DTOs.
5+ /// </summary>
6+ /// <typeparam name="T">The DTO type to create a GraphQL type for</typeparam>
7+ public class DtoType<T> : ObjectType<T>
8+ {
9+ /// <summary>
10+ /// Configures the GraphQL type descriptor for the DTO.
11+ /// </summary>
12+ /// <param name="descriptor">The descriptor to configure</param>
13+ protected override void Configure(IObjectTypeDescriptor<T> descriptor)
14+ {
15+ descriptor.Name(typeof(T).Name.Replace("Dto", ""));
16+ descriptor.BindFieldsImplicitly();
17+ }
18+ }
19+ }
You can’t perform that action at this time.
0 commit comments