-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use Object, Query, Mutation and Subscription type annotations
- Loading branch information
1 parent
c0c883d
commit 3b0a12b
Showing
50 changed files
with
189 additions
and
397 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 59 additions & 43 deletions
102
...Dashboard/src/HttpApi/Resolvers/Directories/Queries/GetFileResolutionDistributionQuery.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,59 @@ | ||
using Giantnodes.Infrastructure; | ||
using Giantnodes.Infrastructure.Faults.Exceptions; | ||
using Giantnodes.Infrastructure.Faults.Types; | ||
using Giantnodes.Infrastructure.Validation.Exceptions; | ||
using Giantnodes.Service.Dashboard.Application.Contracts.Directories.Queries; | ||
using Giantnodes.Service.Dashboard.Domain.Enumerations; | ||
using Giantnodes.Service.Dashboard.HttpApi.Resolvers.Directories.Types; | ||
using MassTransit; | ||
|
||
namespace Giantnodes.Service.Dashboard.HttpApi.Resolvers.Directories.Queries; | ||
|
||
[ExtendObjectType(OperationTypeNames.Query)] | ||
public class GetFileResolutionDistributionQuery | ||
{ | ||
[Error<DomainException>] | ||
[Error<ValidationException>] | ||
[UseSorting] | ||
public async Task<IQueryable<FileResolutionDistribution>> FileResolutionDistribution( | ||
[Service] IRequestClient<GetFileResolutionDistribution.Query> request, | ||
[ID] Guid directoryId, | ||
CancellationToken cancellation = default) | ||
{ | ||
var query = new GetFileResolutionDistribution.Query | ||
{ | ||
DirectoryId = directoryId | ||
}; | ||
|
||
Response response = await request.GetResponse<GetFileResolutionDistribution.Result, DomainFault, ValidationFault>(query, cancellation); | ||
return response switch | ||
{ | ||
(_, GetFileResolutionDistribution.Result result) => result.Distribution | ||
.Select(x => new FileResolutionDistribution | ||
{ | ||
Resolution = Enumeration.TryParse<VideoResolution>(x.Key ?? 0), | ||
Count = x.Value | ||
}) | ||
.AsQueryable(), | ||
(_, DomainFault fault) => throw new DomainException(fault), | ||
(_, ValidationFault fault) => throw new ValidationException(fault), | ||
_ => throw new InvalidOperationException() | ||
}; | ||
} | ||
} | ||
// using Giantnodes.Infrastructure; | ||
// using Giantnodes.Infrastructure.Faults.Exceptions; | ||
// using Giantnodes.Infrastructure.Faults.Types; | ||
// using Giantnodes.Infrastructure.Validation.Exceptions; | ||
// using Giantnodes.Service.Dashboard.Application.Contracts.Directories.Queries; | ||
// using Giantnodes.Service.Dashboard.Domain.Enumerations; | ||
// using MassTransit; | ||
// | ||
// namespace Giantnodes.Service.Dashboard.HttpApi.Resolvers.Directories.Queries; | ||
// | ||
// public readonly record struct FileResolutionDistribution(VideoResolution? Resolution, int Count); | ||
// | ||
// [QueryType] | ||
// public class GetFileResolutionDistributionQuery | ||
// { | ||
// [Error<DomainException>] | ||
// [Error<ValidationException>] | ||
// [UseSorting] | ||
// public async Task<IQueryable<FileResolutionDistribution>> FileResolutionDistribution( | ||
// [Service] IRequestClient<GetFileResolutionDistribution.Query> request, | ||
// [ID] Guid directoryId, | ||
// CancellationToken cancellation = default) | ||
// { | ||
// var query = new GetFileResolutionDistribution.Query | ||
// { | ||
// DirectoryId = directoryId | ||
// }; | ||
// | ||
// Response response = await request.GetResponse<GetFileResolutionDistribution.Result, DomainFault, ValidationFault>(query, cancellation); | ||
// return response switch | ||
// { | ||
// (_, GetFileResolutionDistribution.Result result) => | ||
// result | ||
// .Distribution | ||
// .Select(x => new FileResolutionDistribution | ||
// { | ||
// Resolution = Enumeration.TryParse<VideoResolution>(x.Key ?? 0), | ||
// Count = x.Value | ||
// }) | ||
// .AsQueryable(), | ||
// (_, DomainFault fault) => throw new DomainException(fault), | ||
// (_, ValidationFault fault) => throw new ValidationException(fault), | ||
// _ => throw new InvalidOperationException() | ||
// }; | ||
// } | ||
// } | ||
// | ||
// // [ObjectType<FileResolutionDistribution>] | ||
// // public static partial class FileResolutionDistributionType | ||
// // { | ||
// // static partial void Configure(IObjectTypeDescriptor<FileResolutionDistribution> descriptor) | ||
// // { | ||
// // descriptor | ||
// // .Field(p => p.Resolution); | ||
// // | ||
// // descriptor | ||
// // .Field(p => p.Count); | ||
// // } | ||
// // } |
22 changes: 0 additions & 22 deletions
22
src/Service.Dashboard/src/HttpApi/Resolvers/Directories/Types/FileQualityDistribution.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.