This commit is contained in:
@@ -43,21 +43,6 @@ namespace AyaNova.Api.Controllers
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get active Scheduleable user list
|
||||
/// </summary>
|
||||
/// <returns>List of all scheduleable users</returns>
|
||||
[HttpGet("scheduleable-user-list")]
|
||||
public async Task<IActionResult> GetScheduleableUserList()
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
if (!Authorized.HasReadFullRole(HttpContext.Items, AyaType.WorkOrder))//WorkOrder right applies to all svc-schedule ops
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
var o = await ct.User.AsNoTracking().Where(x => x.Active == true && x.UserType == UserType.ServiceContractor || x.UserType == UserType.Service).OrderBy(x => x.Name).Select(x => new { x.Name, x.Id }).ToListAsync();
|
||||
|
||||
return Ok(ApiOkResponse.Response(o));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -115,7 +100,8 @@ namespace AyaNova.Api.Controllers
|
||||
Users.Add(new NameIdItem { Name = u.Name, Id = u.Id });
|
||||
}
|
||||
}
|
||||
List<long> userIdList = Users.Select(x => x.Id).ToList();
|
||||
List<long?> userIdList = Users.Select(x => x.Id as long?).ToList();
|
||||
userIdList.Add(null);
|
||||
//WORKORDERS
|
||||
{
|
||||
//Note: query for *overlapping* ranges, not *contained* entirely in view range
|
||||
@@ -123,7 +109,8 @@ namespace AyaNova.Api.Controllers
|
||||
.Select(x => MakeServiceWOSchedItem(x, p))
|
||||
.ToListAsync());
|
||||
}
|
||||
return Ok(ApiOkResponse.Response(new { items = r, users = Users }));
|
||||
var HasUnAssigned = r.Any(x => x.UserId == 0);
|
||||
return Ok(ApiOkResponse.Response(new { items = r, users = Users, hasUnassigned = HasUnAssigned }));
|
||||
}
|
||||
|
||||
public class ServiceScheduleParams
|
||||
@@ -286,7 +273,7 @@ namespace AyaNova.Api.Controllers
|
||||
s.Type = AyaType.WorkOrderItemScheduledUser;
|
||||
s.Name = NameFromWOItem(v);
|
||||
s.Editable = v.WorkOrderStatusCompleted != true && v.WorkOrderStatusLocked != true;//could be null as well which we'll consider open as it's no status set
|
||||
s.UserId = v.SchedUserId;
|
||||
s.UserId = v.SchedUserId ?? 0;//0 signifies to client schedule that it's an unassigned woitem
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -446,5 +433,22 @@ namespace AyaNova.Api.Controllers
|
||||
//------------
|
||||
|
||||
|
||||
// deprecated as not used but by tag instead
|
||||
// /// <summary>
|
||||
// /// Get active Scheduleable user list
|
||||
// /// </summary>
|
||||
// /// <returns>List of all scheduleable users</returns>
|
||||
// [HttpGet("scheduleable-user-list")]
|
||||
// public async Task<IActionResult> GetScheduleableUserList()
|
||||
// {
|
||||
// if (!serverState.IsOpen)
|
||||
// return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
// if (!Authorized.HasReadFullRole(HttpContext.Items, AyaType.WorkOrder))//WorkOrder right applies to all svc-schedule ops
|
||||
// return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
// var o = await ct.User.AsNoTracking().Where(x => x.Active == true && x.UserType == UserType.ServiceContractor || x.UserType == UserType.Service).OrderBy(x => x.Name).Select(x => new { x.Name, x.Id }).ToListAsync();
|
||||
|
||||
// return Ok(ApiOkResponse.Response(o));
|
||||
// }
|
||||
|
||||
}//eoc
|
||||
}//eons
|
||||
Reference in New Issue
Block a user