v1.2.11.3 deployed

This commit is contained in:
2024-04-24 17:16:49 +01:00
parent 05f166f3d1
commit e40876aeb2
38 changed files with 1222 additions and 168 deletions
@@ -0,0 +1,39 @@
using Microsoft.AspNetCore.Mvc;
namespace Saxonite.Web.Api.Controllers
{
//=======================================================================
[ApiController]
//[Route("[controller]")]
public class SecurityController : SwapiControllerBase
{
//-------------------------------------------------------------------
// Construction.
public SecurityController()
{
}
//-------------------------------------------------------------------
// Start session.
public class RequestData_StartSession
{
public String userCode { get; set; } = "";
}
public class ResponseData_StartSession : ApiResponse_Data
{
}
[HttpPost]
[Route("[controller]/StartSession")]
public ResponseData_StartSession StartSession_Get(RequestData_StartSession requestData)
{
ResponseData_StartSession responseData = new ResponseData_StartSession();
responseData.SetMessage("Security",$"User: {requestData.userCode}.");
return responseData;
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -0,0 +1,140 @@
using Microsoft.AspNetCore.Mvc;
using Sacs.Web.Components;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
namespace Saxonite.Web.Api.Controllers
{
//=======================================================================
public class SwapiControllerBase : ControllerBase
{
//-------------------------------------------------------------------
// Definitions.
//-------------------------------------------------------------------
// Response data.
// Null values are ignored by JSON serialisation.
// - See Saxonite.Net.Core.Web.Base.App.SaxStartup.ConfigureServices()
// - Ref. config.services.AddMvc(...).AddJsonOptions(options => { options.JsonSerializerOptions.IgnoreNullValues = true; });
//-------------------------------------------------------------------
// Base response data - for simple responses.
public class ApiResponse_Base
{
// Response status.
public bool? Success { get; set; } = null;
public bool? Error { get; set; } = null;
public bool? SessionExpired { get; protected set; } = null;
public ApiResponse_Base SetSessionExpired(String title, String text)
{
SessionExpired = true;
return SetMessage(title, text);
}
// Message - displays alert popup.
public class MessageData
{
public MessageData(String title, String text)
{
this.Title = title;
this.Text = text;
}
public String Title { get; }
public String Text { get; }
}
public MessageData? Message { get; private set; }
public ApiResponse_Base SetMessage(String title, String text)
{
if (!StringUtil.IsBlank(text))
Message = new MessageData(title, text);
return this;
}
}
//-------------------------------------------------------------------
public class ApiResponse_Data : ApiResponse_Base
{
//---------------------------------------------------------------
// Construction.
protected ApiResponse_Data()
{
}
//---------------------------------------------------------------
/// <summary>Item data - Common properties for data items.</summary>
public class ItemData_Base
{
// Common item properties.
public String? Id { get; set; }
public String? Notes { get; set; }
public String? StatusCode { get; set; }
public String? StatusDesc { get; set; }
// Flags for common status values.
// Return true or null so that property is not serialised when false.
public bool? Awaiting { get { return StatusCode.EqualsCI(SacsSystem.GetStatusCode(SaStatus.Awaiting)) ? true : (bool?)null; } }
public bool? Active { get { return StatusCode.EqualsCI(SacsSystem.GetStatusCode(SaStatus.Active)) ? true : (bool?)null; } }
public bool? Inactive { get { return StatusCode.EqualsCI(SacsSystem.GetStatusCode(SaStatus.Inactive)) ? true : (bool?)null; } }
public bool? Deleted { get { return StatusCode.EqualsCI(SacsSystem.GetStatusCode(SaStatus.Deleted)) ? true : (bool?)null; } }
/// <summary>Created on date - YYYYMMDD</summary>
public String? CreatedOn { get; set; }
/// <summary>Created on date - formatted per locale</summary>
public String? CreatedOnFmt { get; set; }
/// <summary>Updated on date - YYYYMMDD</summary>
public String? UpdatedOn { get; set; }
/// <summary>Updated on date - formatted per locale</summary>
public String? UpdatedOnFmt { get; set; }
}
/// <summary>Contact Method properties.</summary>
public class ContactMethodData
{
public String? Method { get; set; }
public String? MethodCaption { get; set; }
public String? Value { get; set; }
}
/// <summary>Address properties.</summary>
public class AddressData : ItemData_Base
{
public String? Line1 { get; set; }
public String? Line2 { get; set; }
public String? Line3 { get; set; }
public String? Town { get; set; }
public String? RegionIdProvince { get; set; }
public String? RegionNameProvince { get; set; }
public String? RegionIdCountry { get; set; }
public String? RegionNameCountry { get; set; }
public String? PostalCode { get; set; }
}
/// <summary>
/// Item data with label and value.
/// </summary>
public class ItemLabelValue
{
public String? Label { get; set; }
public String? Value { get; set; }
}
/// <summary>
/// Item data with just Id and name.
/// <para>- Id is String to allow for obfuscated values.</para>
/// </summary>
public class ItemIdName
{
public String? Id { get; set; }
public String? Name { get; set; }
}
/// <summary>Item code and desc values.</summary>
public class ItemCodeDesc
{
public String? Code { get; set; }
public String? Desc { get; set; }
}
}
//-------------------------------------------------------------------
// Construction.
protected SwapiControllerBase()
{
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -0,0 +1,39 @@
using Microsoft.AspNetCore.Mvc;
using Saxonite.Net.Standard.Base.App;
using static Sarand.Net.Standard.Base.Helpers.SacsHttpClientHelper;
namespace Saxonite.Web.Api.Controllers
{
//=======================================================================
[ApiController]
public class SystemController : SwapiControllerBase
{
//-------------------------------------------------------------------
// Construction.
public SystemController()
{
}
//-------------------------------------------------------------------
// Start session.
public class RequestData_Version
{
}
public class ResponseData_Version : ApiResponse_Data
{
public String? Version { get; set; }
}
[HttpPost]
[Route("[controller]/Version")]
public ResponseData_Version GetVersion_Post(RequestData_Version requestData)
{
ResponseData_Version responseData = new ResponseData_Version();
responseData.Version = Sax.Version.GetFullVersion();
return responseData;
}
//-------------------------------------------------------------------
}
//=======================================================================
}