Stuff and things
This commit is contained in:
38
PartSource.Api/Controllers/WebhooksController.cs
Normal file
38
PartSource.Api/Controllers/WebhooksController.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
||||
using PartSource.Data.Dtos;
|
||||
using PartSource.Data.Models;
|
||||
using PartSource.Services;
|
||||
using Ratermania.Shopify.Resources;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PartSource.Api.Controllers
|
||||
{
|
||||
/// <remarks>
|
||||
/// This endpoint handles Shopify webhooks
|
||||
/// </remarks>
|
||||
[Route("v2/[controller]")]
|
||||
[ApiController]
|
||||
[ApiExplorerSettings(GroupName = "v2")]
|
||||
public class WebhooksController : BaseApiController
|
||||
{
|
||||
private readonly ShopifyChangelogService _shopifyChangelogService;
|
||||
|
||||
public WebhooksController(ShopifyChangelogService shopifyChangelogService)
|
||||
{
|
||||
_shopifyChangelogService = shopifyChangelogService;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("products/update")]
|
||||
public async Task<ActionResult> OnProductUpdate([FromBody]Product product)
|
||||
{
|
||||
await _shopifyChangelogService.AddEntry(product);
|
||||
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user