Stuff and things

This commit is contained in:
2021-06-29 19:00:13 -04:00
parent 0ff42f148a
commit 962ad3383f
22 changed files with 320 additions and 226 deletions

View 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();
}
}
}