diff --git a/devdocs/deploy.txt b/devdocs/deploy.txt index 1522b89d..4bdec66c 100644 --- a/devdocs/deploy.txt +++ b/devdocs/deploy.txt @@ -23,8 +23,8 @@ SERVER - BUMP AyaNova.csproj version number - BUILD RELEASE Run buildrelease.bat in server project folder -https://www.ayanova.com/Downloads/v8/ayanova8.alpha.124-win-x64.7z -https://www.ayanova.com/Downloads/v8/migrate124.7z **ARCHIVE IT, otherwise it could be false positived +https://www.ayanova.com/Downloads/v8/ayanova8.alpha.125-win-x64.7z +https://www.ayanova.com/Downloads/v8/migrate125.7z **ARCHIVE IT, otherwise it could be false positived - COPY TO DEVOPS SERVER NOTE: if need to replace "files" subfolder on server the rights need to be set to 775 diff --git a/server/AyaNova/Controllers/UnitController.cs b/server/AyaNova/Controllers/UnitController.cs index 489c7e8b..5911686c 100644 --- a/server/AyaNova/Controllers/UnitController.cs +++ b/server/AyaNova/Controllers/UnitController.cs @@ -321,11 +321,11 @@ namespace AyaNova.Api.Controllers /// - /// Get Unit Contract name/id if active and not expired + /// Get Unit info required for service workorder on selection /// /// UnitId - /// Contract name and Id - [HttpGet("active-contract/{id}")] + /// Contract name and Id, meter reading status + [HttpGet("work-order-info/{id}")] public async Task GetUnitActiveContract([FromRoute] long id) { if (!serverState.IsOpen) @@ -335,19 +335,20 @@ namespace AyaNova.Api.Controllers if (!ModelState.IsValid) return BadRequest(new ApiErrorResponse(ModelState)); - var ret = new NameIdItem { Name = string.Empty, Id = 0 }; - var UnitContractInfo = await ct.Unit.AsNoTracking().Where(x => x.Id == id).Select(x => new { x.ContractId, x.ContractExpires }).FirstOrDefaultAsync(); - if (UnitContractInfo == null || UnitContractInfo.ContractExpires < DateTime.UtcNow)//none or expired - return Ok(ApiOkResponse.Response(ret)); + //Get contract info + var retContract = new NameIdItem { Name = string.Empty, Id = 0 }; + var UnitInfo = await ct.Unit.AsNoTracking().Where(x => x.Id == id).Select(x => new { x.ContractId, x.ContractExpires, x.Metered }).FirstOrDefaultAsync(); + if (UnitInfo != null && UnitInfo.ContractExpires >= DateTime.UtcNow)//has valid contract + { + var c = await ct.Contract.AsNoTracking().FirstOrDefaultAsync(x => x.Id == UnitInfo.ContractId); + if (c != null && c.Active != false) + { + retContract.Name = c.Name; + retContract.Id = c.Id; + } + } - var c = await ct.Contract.AsNoTracking().FirstOrDefaultAsync(x => x.Id == UnitContractInfo.ContractId); - if (c == null || c.Active == false) - return Ok(ApiOkResponse.Response(ret)); - - ret.Name = c.Name; - ret.Id = c.Id; - - return Ok(ApiOkResponse.Response(ret)); + return Ok(ApiOkResponse.Response(new{contract=retContract,IsMetered=UnitInfo.Metered})); } diff --git a/server/AyaNova/util/AyaNovaVersion.cs b/server/AyaNova/util/AyaNovaVersion.cs index 53be5b56..3c3210ee 100644 --- a/server/AyaNova/util/AyaNovaVersion.cs +++ b/server/AyaNova/util/AyaNovaVersion.cs @@ -5,7 +5,7 @@ namespace AyaNova.Util /// internal static class AyaNovaVersion { - public const string VersionString = "8.0.0-alpha.124"; + public const string VersionString = "8.0.0-alpha.125"; public const string FullNameAndVersion = "AyaNova server " + VersionString; }//eoc }//eons \ No newline at end of file