Skip to content

Commit

Permalink
feat: implement subscription endpoints in graphql
Browse files Browse the repository at this point in the history
  • Loading branch information
dorisjenny27 committed Aug 31, 2024
1 parent bbadf08 commit 0d2e3ea
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions src/Hng.Graphql/Mutations.Subscriptions.cs
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);
}
}
}
}

0 comments on commit 0d2e3ea

Please sign in to comment.