New source control repo for Biskilog POS - secure hub to store & manage source code. Streamlines dev process, tracks changes, & improves collaboration. Ensures reliable software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

146 lines
5.4 KiB

using Biskilog_Accounting.Server.Services;
using Biskilog_Accounting.Shared.CustomModels;
using Biskilog_Accounting.Shared.Interfaces;
using Biskilog_Accounting.Shared.POSModels;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace Biskilog_Accounting.Server.SyncControllers
{
[Route("api/[controller]")]
[ApiController]
public class SyncProductsController : ControllerBase
{
private readonly IProduct m_productService;
public SyncProductsController(IProduct a_productService)
{
m_productService = a_productService;
}
// GET: api/<SyncProductsController>
[Authorize]
[HttpGet, Route("lastsyncdate/{a_tableName}")]
public DateTime GetLastSyncDate(string a_tableName)
{
return m_productService.GetLastSyncDate(a_tableName);
}
// Post: api/<SyncProductsController>
[Authorize]
[HttpPost, Route("setsyncdate")]
public void SetLastSyncDate(SyncTimestamp a_timestamp)
{
m_productService.SetLastSyncDate(a_timestamp.TableName, a_timestamp.Timestamp);
}
// POST api/<SyncProductsController>
/// <summary>
/// Endpoint to publish a collection of TblProduct rows to the cloud
/// </summary>
/// <param name="a_item"></param>
[Authorize]
[HttpPost, Route("publish/tblProducts")]
public async Task SyncProductsAsync(List<Tblproduct> a_item)
{
await m_productService.SyncProducts(a_item);
}
// POST api/<SyncProductsController>
/// <summary>
/// Endpoint to publish a collection of TblInventory rows to the cloud
/// </summary>
/// <param name="a_item"></param>
[Authorize]
[HttpPost, Route("publish/tblInventory")]
public async Task SyncInventoryAsync(List<Tblinventory> a_item)
{
await m_productService.SyncInventory(a_item);
}
// POST api/<SyncProductsController>
/// <summary>
/// Endpoint to publish a collection of Restock rows to the cloud
/// </summary>
/// <param name="a_item"></param>
[Authorize]
[HttpPost, Route("publish/tblRestock")]
public async Task SyncRestockAsync(List<Restocklevel> a_item)
{
await m_productService.SyncRestockAsync(a_item);
}
// POST api/<SyncProductsController>
/// <summary>
/// Endpoint to publish a collection of TblInventoryEntries rows to the cloud
/// </summary>
/// <param name="a_item"></param>
[Authorize]
[HttpPost, Route("publish/tblInventoryentry")]
public async Task SyncInventoryEntriesAsync(List<Tblinventoryentry> a_item)
{
await m_productService.SyncInventoryEntries(a_item);
}
// POST api/<SyncProductsController>
/// <summary>
/// Endpoint to publish a collection of PriceChanges rows to the cloud
/// </summary>
/// <param name="a_item"></param>
[Authorize]
[HttpPost, Route("publish/tlpricechanges")]
public async Task SyncPriceChangesAsync(List<Tblpricechange> a_item)
{
await m_productService.SyncPriceChanges(a_item);
}
// POST api/<SyncProductsController>
/// <summary>
/// Endpoint to publish a collection of ProductAltUnit rows to the cloud
/// </summary>
/// <param name="a_item"></param>
[Authorize]
[HttpPost, Route("publish/tblProductAltUnit")]
public async Task SyncProductAltUnitAsync(List<Productaltunit> a_item)
{
await m_productService.SyncProductAltUnit(a_item);
}
// POST api/<SyncProductsController>
/// <summary>
/// Endpoint to publish a collection of TbStock rows to the cloud
/// </summary>
/// <param name="a_item"></param>
[Authorize]
[HttpPost, Route("publish/tblStock")]
public async Task SyncStockAsync(List<Tbstock> a_item)
{
await m_productService.SyncStockAsync(a_item);
}
// POST api/<SyncProductsController>
/// <summary>
/// Endpoint to publish a collection of TblBrands rows to the cloud
/// </summary>
/// <param name="a_item"></param>
[Authorize]
[HttpPost, Route("publish/tblbrands")]
public async Task SyncBrandsAsync(List<Tblbrand> a_item)
{
await m_productService.SyncBrandsAsync(a_item);
}
// POST api/<SyncProductsController>
/// <summary>
/// Endpoint to publish a collection of TblCategory rows to the cloud
/// </summary>
/// <param name="a_item"></param>
[Authorize]
[HttpPost, Route("publish/tblCategories")]
public async Task SyncCategoriesAsync(List<Tblcategory> a_item)
{
await m_productService.SyncCategoriesAsync(a_item);
}
// POST api/<SyncProductsController>
/// <summary>
/// Endpoint to publish a collection of UnitOfMeasure rows to the cloud
/// </summary>
/// <param name="a_item"></param>
[Authorize]
[HttpPost, Route("publish/tblunitofmeasure")]
public async Task SyncUnitMeasureAsync(List<Unitofmeasure> a_item)
{
await m_productService.SyncUnitOfMeasureAsync(a_item);
}
}
}