This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
# FORM-HOME-NOTIFICATIONS
|
# NOTIFICATIONS
|
||||||
|
|
||||||
|
This form shows "in app" notifications received in the last 90 days.
|
||||||
|
Notifications are kept for 90 days then automatically deleted.
|
||||||
|
|
||||||
This is a placeholder page for sections that are not written yet
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ using Microsoft.Extensions.Logging;
|
|||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
using AyaNova.Biz;
|
using AyaNova.Biz;
|
||||||
|
using System.Linq;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace AyaNova.Api.Controllers
|
namespace AyaNova.Api.Controllers
|
||||||
{
|
{
|
||||||
@@ -33,7 +35,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
serverState = apiServerState;
|
serverState = apiServerState;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create NotifySubscription
|
/// Create NotifySubscription
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="newObject"></param>
|
/// <param name="newObject"></param>
|
||||||
@@ -122,7 +124,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
else
|
else
|
||||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||||
}
|
}
|
||||||
return Ok(ApiOkResponse.Response(new { Concurrency = o.Concurrency }));
|
return Ok(ApiOkResponse.Response(new { Concurrency = o.Concurrency }));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -145,6 +147,34 @@ namespace AyaNova.Api.Controllers
|
|||||||
return NoContent();
|
return NoContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get Subscription list
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>User's notification subscription list </returns>
|
||||||
|
[HttpGet("list")]
|
||||||
|
public async Task<IActionResult> GetQueue()
|
||||||
|
{
|
||||||
|
if (serverState.IsClosed)
|
||||||
|
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
|
|
||||||
|
//NOTE: in future if getting list for another user should just duplicate this method but add the parameter for user id
|
||||||
|
//and checking of rights
|
||||||
|
long UserId = UserIdFromContext.Id(HttpContext.Items);
|
||||||
|
|
||||||
|
var ret = await ct.NotifySubscription.Where(z => z.UserId == UserId).Select(z => new
|
||||||
|
{
|
||||||
|
z.Id,
|
||||||
|
z.UserId,
|
||||||
|
z.EventType,
|
||||||
|
z.AyaType,
|
||||||
|
z.DeliveryMethod,
|
||||||
|
z.DeliveryAddress,
|
||||||
|
z.Tags
|
||||||
|
}).ToListAsync();
|
||||||
|
return Ok(ApiOkResponse.Response(ret));
|
||||||
|
}
|
||||||
|
|
||||||
//------------
|
//------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,114 +1,120 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
using AyaNova.Biz;
|
|
||||||
namespace AyaNova.DataList
|
|
||||||
{
|
|
||||||
internal class NotifySubscriptionDataList : AyaDataList
|
|
||||||
{
|
|
||||||
|
|
||||||
public NotifySubscriptionDataList()
|
|
||||||
{
|
|
||||||
DefaultListObjectType = AyaType.NotifySubscription;
|
|
||||||
SQLFrom = "from anotifysubscription";
|
|
||||||
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
|
||||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
|
||||||
|
|
||||||
//Default ListView
|
|
||||||
dynamic dlistView = new JArray();
|
|
||||||
|
|
||||||
dynamic cm = new JObject();
|
//DEPRECATED: due to not working properly, can't easily set to only show current logged in user's subscriptions so it was showing all
|
||||||
cm.fld = "id";
|
//which might be useful for a management type of situation but for a single user it's shit
|
||||||
dlistView.Add(cm);
|
|
||||||
|
|
||||||
cm = new JObject();
|
// using System.Collections.Generic;
|
||||||
cm.fld = "ayatype";
|
// using Newtonsoft.Json.Linq;
|
||||||
dlistView.Add(cm);
|
// using AyaNova.Biz;
|
||||||
|
// namespace AyaNova.DataList
|
||||||
|
// {
|
||||||
|
// internal class NotifySubscriptionDataList : AyaDataList
|
||||||
|
// {
|
||||||
|
|
||||||
cm = new JObject();
|
// public NotifySubscriptionDataList()
|
||||||
cm.fld = "eventtype";
|
// {
|
||||||
dlistView.Add(cm);
|
// DefaultListObjectType = AyaType.NotifySubscription;
|
||||||
|
// SQLFrom = "from anotifysubscription";
|
||||||
|
// var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||||
|
// AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||||
|
|
||||||
cm = new JObject();
|
// //Default ListView
|
||||||
cm.fld = "deliverymethod";
|
// dynamic dlistView = new JArray();
|
||||||
dlistView.Add(cm);
|
|
||||||
|
|
||||||
cm = new JObject();
|
// dynamic cm = new JObject();
|
||||||
cm.fld = "deliveryaddress";
|
// cm.fld = "id";
|
||||||
dlistView.Add(cm);
|
// dlistView.Add(cm);
|
||||||
|
|
||||||
cm = new JObject();
|
// cm = new JObject();
|
||||||
cm.fld = "tags";
|
// cm.fld = "ayatype";
|
||||||
dlistView.Add(cm);
|
// dlistView.Add(cm);
|
||||||
|
|
||||||
|
// cm = new JObject();
|
||||||
|
// cm.fld = "eventtype";
|
||||||
|
// dlistView.Add(cm);
|
||||||
|
|
||||||
|
// cm = new JObject();
|
||||||
|
// cm.fld = "deliverymethod";
|
||||||
|
// dlistView.Add(cm);
|
||||||
|
|
||||||
|
// cm = new JObject();
|
||||||
|
// cm.fld = "deliveryaddress";
|
||||||
|
// dlistView.Add(cm);
|
||||||
|
|
||||||
|
// cm = new JObject();
|
||||||
|
// cm.fld = "tags";
|
||||||
|
// dlistView.Add(cm);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
||||||
FieldDefinitions = new List<AyaDataListFieldDefinition>();
|
// FieldDefinitions = new List<AyaDataListFieldDefinition>();
|
||||||
|
|
||||||
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
// FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||||
{
|
// {
|
||||||
TKey = "ID",
|
// TKey = "ID",
|
||||||
FieldKey = "id",
|
// FieldKey = "id",
|
||||||
UiFieldDataType = (int)UiFieldDataType.Integer,
|
// UiFieldDataType = (int)UiFieldDataType.Integer,
|
||||||
SqlIdColumnName = "anotifysubscription.id",
|
// SqlIdColumnName = "anotifysubscription.id",
|
||||||
SqlValueColumnName = "anotifysubscription.id",
|
// SqlValueColumnName = "anotifysubscription.id",
|
||||||
AyaObjectType = (int)AyaType.NotifySubscription,
|
// AyaObjectType = (int)AyaType.NotifySubscription,
|
||||||
IsRowId = true
|
// IsRowId = true
|
||||||
});
|
// });
|
||||||
|
|
||||||
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
// FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||||
{
|
// {
|
||||||
TKey = "AyaType",
|
// TKey = "AyaType",
|
||||||
FieldKey = "ayatype",
|
// FieldKey = "ayatype",
|
||||||
UiFieldDataType = (int)UiFieldDataType.Enum,
|
// UiFieldDataType = (int)UiFieldDataType.Enum,
|
||||||
EnumType = AyaNova.Util.StringUtil.TrimTypeName(typeof(AyaType).ToString())
|
// EnumType = AyaNova.Util.StringUtil.TrimTypeName(typeof(AyaType).ToString())
|
||||||
});
|
// });
|
||||||
|
|
||||||
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
// FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||||
{
|
// {
|
||||||
TKey = "NotifyEventType",
|
// TKey = "NotifyEventType",
|
||||||
FieldKey = "eventtype",
|
// FieldKey = "eventtype",
|
||||||
UiFieldDataType = (int)UiFieldDataType.Enum,
|
// UiFieldDataType = (int)UiFieldDataType.Enum,
|
||||||
EnumType = AyaNova.Util.StringUtil.TrimTypeName(typeof(NotifyEventType).ToString())
|
// EnumType = AyaNova.Util.StringUtil.TrimTypeName(typeof(NotifyEventType).ToString())
|
||||||
});
|
// });
|
||||||
|
|
||||||
// FieldDefinitions.Add(new AyaDataListFieldDefinition
|
// // FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||||
// {
|
// // {
|
||||||
// TKey = "FileAttachment",
|
// // TKey = "FileAttachment",
|
||||||
// FieldKey = "displayfilename",
|
// // FieldKey = "displayfilename",
|
||||||
// AyaObjectType = (int)AyaType.FileAttachment,
|
// // AyaObjectType = (int)AyaType.FileAttachment,
|
||||||
// UiFieldDataType = (int)UiFieldDataType.Text,
|
// // UiFieldDataType = (int)UiFieldDataType.Text,
|
||||||
// SqlIdColumnName = "afileattachment.id",
|
// // SqlIdColumnName = "afileattachment.id",
|
||||||
// SqlValueColumnName = "afileattachment.displayfilename",
|
// // SqlValueColumnName = "afileattachment.displayfilename",
|
||||||
// IsRowId = true
|
// // IsRowId = true
|
||||||
// });
|
// // });
|
||||||
|
|
||||||
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
// FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||||
{
|
// {
|
||||||
TKey = "NotifyDeliveryMethod",
|
// TKey = "NotifyDeliveryMethod",
|
||||||
FieldKey = "deliverymethod",
|
// FieldKey = "deliverymethod",
|
||||||
UiFieldDataType = (int)UiFieldDataType.Enum,
|
// UiFieldDataType = (int)UiFieldDataType.Enum,
|
||||||
EnumType = AyaNova.Util.StringUtil.TrimTypeName(typeof(NotifyDeliveryMethod).ToString())
|
// EnumType = AyaNova.Util.StringUtil.TrimTypeName(typeof(NotifyDeliveryMethod).ToString())
|
||||||
});
|
// });
|
||||||
|
|
||||||
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
// FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||||
{
|
// {
|
||||||
TKey = "NotifyDeliveryAddress",
|
// TKey = "NotifyDeliveryAddress",
|
||||||
FieldKey = "deliveryaddress",
|
// FieldKey = "deliveryaddress",
|
||||||
UiFieldDataType = (int)UiFieldDataType.Text
|
// UiFieldDataType = (int)UiFieldDataType.Text
|
||||||
});
|
// });
|
||||||
|
|
||||||
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
// FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||||
{
|
// {
|
||||||
TKey = "InTags",
|
// TKey = "InTags",
|
||||||
FieldKey = "tags",
|
// FieldKey = "tags",
|
||||||
UiFieldDataType = (int)UiFieldDataType.Tags
|
// UiFieldDataType = (int)UiFieldDataType.Tags
|
||||||
});
|
// });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
// }
|
||||||
}//eoc
|
// }//eoc
|
||||||
}//eons
|
// }//eons
|
||||||
Reference in New Issue
Block a user