diff --git a/server/AyaNova/Controllers/ScheduleController.cs b/server/AyaNova/Controllers/ScheduleController.cs
index 7c7c6d1c..be0136d6 100644
--- a/server/AyaNova/Controllers/ScheduleController.cs
+++ b/server/AyaNova/Controllers/ScheduleController.cs
@@ -132,6 +132,57 @@ namespace AyaNova.Api.Controllers
}
+ //###############################################################
+ //USER - svc-schedule-user
+ //###############################################################
+
+ ///
+ /// Get User schedule for parameters specified
+ /// time zone UTC offset in minutes is required to be passed in
+ /// timestamps returned are in Unix Epoch milliseconds converted for local time display
+ ///
+ /// User schedule parameters
+ /// From route path
+ ///
+ [HttpPost("user")]
+ public async Task PostUserSchedule([FromBody] PersonalScheduleParams p, ApiVersion apiVersion)
+ {
+ if (!serverState.IsOpen)
+ return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
+ if (!ModelState.IsValid)
+ return BadRequest(new ApiErrorResponse(ModelState));
+
+ List r = new List();
+
+
+
+ //Note: query will return records that fall within viewed range even if they start or end outside of it
+ //However in month view (only, rest are as is) we can see up to 6 days before or after the month so in the interest of filling those voids:
+ //Adjust query dates to encompass actual potential view range
+ DateTime ViewStart = p.Start;
+ DateTime ViewEnd = p.End;
+ //this covers the largest possible window that could display due to nearly a week of the last or next month showing
+ if (p.View == ScheduleView.Month)
+ {
+ ViewStart = p.Start.AddDays(-6);
+ ViewEnd = p.End.AddDays(6);
+ }
+
+ long? actualUserId = p.UserId == 0 ? null : p.UserId;
+
+ //WORKORDERS
+ {
+ //Note: query for *overlapping* ranges, not *contained* entirely in view range
+ r.AddRange(await ct.ViewScheduleWorkOrder.Where(x => x.SchedUserId == actualUserId && ViewStart <= x.StopDate && x.StartDate <= ViewEnd)
+ .Select(x => MakePersonalWOSchedItem(x, p))
+ .ToListAsync());
+ }
+
+
+ return Ok(ApiOkResponse.Response(r));
+ }
+
+
//###############################################################
//PERSONAL
//###############################################################
@@ -200,7 +251,7 @@ namespace AyaNova.Api.Controllers
/// From route path
/// Error or OK response
[HttpPost("adjust")]
- public async Task PostPersonalSchedule([FromBody] ScheduleItemAdjustParams ad, ApiVersion apiVersion)
+ public async Task AdjustSchedule([FromBody] ScheduleItemAdjustParams ad, ApiVersion apiVersion)
{
if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
@@ -214,6 +265,10 @@ namespace AyaNova.Api.Controllers
WorkOrderBiz biz = WorkOrderBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasModifyRole(HttpContext.Items, AyaType.WorkOrderItemScheduledUser) || biz.UserIsRestrictedType)
return StatusCode(403, new ApiNotAuthorizedResponse());
+ //svc-schedule-user uses 0 to mean unassigned user but here it's null
+ //and it can't be a required parameter and provide null for some reason so zero is the token indicator
+ if (ad.UserId == 0)
+ ad.UserId = null;
var o = await biz.ScheduledUserPutNewScheduleTimeAsync(ad);
if (o == false)
{
@@ -396,6 +451,8 @@ namespace AyaNova.Api.Controllers
public bool Reminders { get; set; }
[Required]
public bool Dark { get; set; }//indicate if Client is set to dark mode or not, used for colorless types to display as black or white
+ [Required]
+ public long UserId { get; set; }//required due to dual use from home-schedule and svc-schedule-user if it's a 0 zero then it's actually meant to be null not assigned userid
}
public class PersonalScheduleListItem
diff --git a/server/AyaNova/DataList/WorkOrderItemScheduledUserDataList.cs b/server/AyaNova/DataList/WorkOrderItemScheduledUserDataList.cs
index 9cb6cc34..abd2ef41 100644
--- a/server/AyaNova/DataList/WorkOrderItemScheduledUserDataList.cs
+++ b/server/AyaNova/DataList/WorkOrderItemScheduledUserDataList.cs
@@ -546,7 +546,9 @@ namespace AyaNova.DataList
long lId = 0;
if (!long.TryParse(crit[0], out lId)) return ret;
- if (lId == 0) return ret;
+
+ //special exemption if id is zero then it's the unassigned user being requested
+ //if (lId == 0) return ret;
//Have valid type, have an id, so filter away
switch (forType)
@@ -554,8 +556,16 @@ namespace AyaNova.DataList
case AyaType.User:
{
DataListFilterOption FilterOption = new DataListFilterOption() { Column = "metauser" };
- FilterOption.Items.Add(new DataListColumnFilter() { value = crit[0], op = DataListFilterComparisonOperator.Equality });
- ret.Add(FilterOption);
+ if (lId == 0)
+ {
+ FilterOption.Items.Add(new DataListColumnFilter() { value = "*NULL*", op = DataListFilterComparisonOperator.Equality });
+ ret.Add(FilterOption);
+ }
+ else
+ {
+ FilterOption.Items.Add(new DataListColumnFilter() { value = crit[0], op = DataListFilterComparisonOperator.Equality });
+ ret.Add(FilterOption);
+ }
}
break;