This commit is contained in:
@@ -80,6 +80,13 @@ namespace AyaNova.Api.Controllers
|
||||
.Select(x => MakeWOSchedItem(x, p))
|
||||
.ToListAsync());
|
||||
}
|
||||
|
||||
//REMINDERS
|
||||
if (p.Reminders)
|
||||
{
|
||||
r.AddRange(await ct.Reminder.Where(x => ViewStart <= x.StopDate && x.StartDate <= ViewEnd).Select(x => MakeReminderSchedItem(x, p)).ToListAsync());
|
||||
}
|
||||
|
||||
return Ok(ApiOkResponse.Response(r));
|
||||
}
|
||||
|
||||
@@ -114,6 +121,19 @@ namespace AyaNova.Api.Controllers
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AyaType.Reminder:
|
||||
{
|
||||
ReminderBiz biz = ReminderBiz.GetBiz(ct, HttpContext);
|
||||
var o = await biz.PutNewScheduleTimeAsync(ad);
|
||||
if (o == false)
|
||||
{
|
||||
if (biz.Errors.Exists(z => z.Code == ApiErrorCode.CONCURRENCY_CONFLICT))
|
||||
return StatusCode(409, new ApiErrorResponse(biz.Errors));
|
||||
else
|
||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return BadRequest(new ApiErrorResponse(ApiErrorCode.VALIDATION_INVALID_VALUE, "Type", "Type not supported for adjustment"));
|
||||
}
|
||||
@@ -139,13 +159,19 @@ namespace AyaNova.Api.Controllers
|
||||
return s;
|
||||
}
|
||||
|
||||
// private static long? EpochSeconds(DateTime? dt, int tzOffset = 0)
|
||||
// {
|
||||
// if (dt == null) return null;
|
||||
// DateTimeOffset dto = new DateTimeOffset((DateTime)dt);
|
||||
// return dto.ToUnixTimeMilliseconds() + (tzOffset * 60000);
|
||||
// }
|
||||
|
||||
private static PersonalScheduleListItem MakeReminderSchedItem(Reminder v, PersonalScheduleParams p)
|
||||
{
|
||||
var s = new PersonalScheduleListItem();
|
||||
s.Id = v.Id;
|
||||
s.Color = v.Color;
|
||||
s.TextColor = TextColor(v.Color);
|
||||
s.Start = (DateTime)v.StartDate;
|
||||
s.End = (DateTime)v.StopDate;
|
||||
s.Type = AyaType.Reminder;
|
||||
s.Name = v.Name;
|
||||
s.Editable = true;//personal reminders are always editable
|
||||
return s;
|
||||
}
|
||||
private static string ColorFromWOItem(ViewSchedulePersonalWorkOrder v, PersonalScheduleParams p)
|
||||
{
|
||||
switch (p.ColorSource)
|
||||
|
||||
Reference in New Issue
Block a user