forked from hngprojects/hng_boilerplate_csharp_web
-
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.
feat: implement subscription endpoints in graphql
- Loading branch information
1 parent
bbadf08
commit 0d2e3ea
Showing
1 changed file
with
23 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,28 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Hng.Application.Features.Subscriptions.Commands; | ||
using Hng.Application.Features.Subscriptions.Dtos.Requests; | ||
using Hng.Application.Features.Subscriptions.Dtos.Responses; | ||
using HotChocolate.Authorization; | ||
using MediatR; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
|
||
namespace Hng.Graphql | ||
{ | ||
public class Mutations | ||
public partial class Mutations | ||
{ | ||
[Authorize] | ||
public async Task<SubscribeFreePlanResponse> SubscribeFreePlan(SubscribeFreePlan command, [FromServices] IMediator mediator) | ||
{ | ||
|
||
|
||
return await mediator.Send(command); | ||
} | ||
|
||
[Authorize] | ||
public async Task<SubscriptionDto> ActivateSubscription(Guid subscriptionId, [FromServices] IMediator mediator) | ||
{ | ||
var command = new ActivateSubscriptionCommand(subscriptionId); | ||
return await mediator.Send(command); | ||
} | ||
} | ||
} | ||
} |