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; using System.Runtime.InteropServices; namespace Biskilog_Accounting.Server.SyncControllers { [Route("api/[controller]")] [ApiController] public class SyncCompanyInfoController : ControllerBase { private readonly ISalesInterface m_salesService; private readonly ICustomer m_customer; private readonly IUser m_users; private readonly ICompanyInfo m_companyInfo; public SyncCompanyInfoController(ISalesInterface a_salesService, ICustomer customer, IUser users,ICompanyInfo a_companyInfo) { m_salesService = a_salesService; m_customer = customer; m_users = users; m_companyInfo = a_companyInfo; } // GET: api/ [Authorize] [HttpGet, Route("lastsyncdate/{a_tableName}")] public DateTime GetLastSyncDate(string a_tableName) { return m_salesService.GetLastSyncDate(a_tableName); } // Post: api/ [Authorize] [HttpPost, Route("setsyncdate")] public void SetLastSyncDate(SyncTimestamp a_timestamp) { m_salesService.SetLastSyncDate(a_timestamp.TableName, a_timestamp.Timestamp); } // POST api/ /// /// Endpoint to publish a collection of SystemUserRoles rows to the cloud /// /// [Authorize] [HttpPost, Route("publish/SystemRoles")] public async Task SyncSyatemRolesAsync(List a_item) { await m_companyInfo.SyncSystemRoles(a_item); } // POST api/ /// /// Endpoint to publish a collection of TblDriver rows to the cloud /// /// [Authorize] [HttpPost, Route("publish/tblDriver")] public async Task SyncDriversAsync(List a_item) { await m_companyInfo.SyncDriverDetails(a_item); } // POST api/ /// /// Endpoint to publish a collection of CompanyDetails rows to the cloud /// /// [Authorize] [HttpPost, Route("publish/tblcompanydetails")] public async Task SyncCompanyAsync(List a_item) { await m_companyInfo.SyncCompanyDetails(a_item); } // POST api/ /// /// Endpoint to publish a collection of TblUsers rows to the cloud /// /// [Authorize] [HttpPost, Route("publish/tblusers")] public async Task SyncUsersAsync(List a_item) { await m_users.SyncUserAsync(a_item); } // POST api/ /// /// Endpoint to publish a collection of Trucks rows to the cloud /// /// [Authorize] [HttpPost, Route("publish/tbltrucks")] public async Task SyncTrucksAsync(List a_item) { await m_companyInfo.SyncTrucks(a_item); } // POST api/ /// /// Endpoint to publish a collection of TblBranch rows to the cloud /// /// [Authorize] [HttpPost, Route("publish/tblbranch")] public async Task SyncBranchAsync(List a_item) { await m_companyInfo.SyncBranches(a_item); } // POST api/ /// /// Endpoint to publish a collection of TblCustomers rows to the cloud /// /// [Authorize] [HttpPost, Route("publish/tblcustomers")] public async Task SyncCustomersAsync(List a_item) { await m_customer.SyncCustomers(a_item); } // POST api/ /// /// Endpoint to publish a collection of TblTruck Inventory rows to the cloud /// /// [Authorize] [HttpPost, Route("publish/tbltruckinventory")] public async Task SyncTruckInventoryAsync(List a_item) { await m_companyInfo.SyncTruckInventory(a_item); } // POST api/ /// /// Endpoint to publish a collection of TblTruckAssignment rows to the cloud /// /// [Authorize] [HttpPost, Route("publish/tblTruckAssignment")] public async Task SyncTruckAssignmentSync(List a_item) { await m_companyInfo.SyncTruckAssignments(a_item); } // POST api/ /// /// Endpoint to publish a collection of TblDriverMapping rows to the cloud /// /// [Authorize] [HttpPost, Route("publish/tbldrivermappings")] public async Task SyncTruckDriverMappingSync(List a_item) { await m_companyInfo.SyncTruckMappings(a_item); } } }