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.Api.ControllerHelpers;
|
||||
using AyaNova.Biz;
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace AyaNova.Api.Controllers
|
||||
{
|
||||
@@ -33,7 +35,7 @@ namespace AyaNova.Api.Controllers
|
||||
serverState = apiServerState;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Create NotifySubscription
|
||||
/// </summary>
|
||||
/// <param name="newObject"></param>
|
||||
@@ -122,7 +124,7 @@ namespace AyaNova.Api.Controllers
|
||||
else
|
||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||
}
|
||||
return Ok(ApiOkResponse.Response(new { Concurrency = o.Concurrency }));
|
||||
return Ok(ApiOkResponse.Response(new { Concurrency = o.Concurrency }));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -145,6 +147,34 @@ namespace AyaNova.Api.Controllers
|
||||
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();
|
||||
cm.fld = "id";
|
||||
dlistView.Add(cm);
|
||||
//DEPRECATED: due to not working properly, can't easily set to only show current logged in user's subscriptions so it was showing all
|
||||
//which might be useful for a management type of situation but for a single user it's shit
|
||||
|
||||
cm = new JObject();
|
||||
cm.fld = "ayatype";
|
||||
dlistView.Add(cm);
|
||||
// using System.Collections.Generic;
|
||||
// using Newtonsoft.Json.Linq;
|
||||
// using AyaNova.Biz;
|
||||
// namespace AyaNova.DataList
|
||||
// {
|
||||
// internal class NotifySubscriptionDataList : AyaDataList
|
||||
// {
|
||||
|
||||
cm = new JObject();
|
||||
cm.fld = "eventtype";
|
||||
dlistView.Add(cm);
|
||||
// public NotifySubscriptionDataList()
|
||||
// {
|
||||
// DefaultListObjectType = AyaType.NotifySubscription;
|
||||
// SQLFrom = "from anotifysubscription";
|
||||
// var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
|
||||
// AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
|
||||
cm = new JObject();
|
||||
cm.fld = "deliverymethod";
|
||||
dlistView.Add(cm);
|
||||
// //Default ListView
|
||||
// dynamic dlistView = new JArray();
|
||||
|
||||
cm = new JObject();
|
||||
cm.fld = "deliveryaddress";
|
||||
dlistView.Add(cm);
|
||||
// dynamic cm = new JObject();
|
||||
// cm.fld = "id";
|
||||
// dlistView.Add(cm);
|
||||
|
||||
cm = new JObject();
|
||||
cm.fld = "tags";
|
||||
dlistView.Add(cm);
|
||||
// cm = new JObject();
|
||||
// cm.fld = "ayatype";
|
||||
// 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);
|
||||
FieldDefinitions = new List<AyaDataListFieldDefinition>();
|
||||
// DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
|
||||
// FieldDefinitions = new List<AyaDataListFieldDefinition>();
|
||||
|
||||
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
{
|
||||
TKey = "ID",
|
||||
FieldKey = "id",
|
||||
UiFieldDataType = (int)UiFieldDataType.Integer,
|
||||
SqlIdColumnName = "anotifysubscription.id",
|
||||
SqlValueColumnName = "anotifysubscription.id",
|
||||
AyaObjectType = (int)AyaType.NotifySubscription,
|
||||
IsRowId = true
|
||||
});
|
||||
// FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
// {
|
||||
// TKey = "ID",
|
||||
// FieldKey = "id",
|
||||
// UiFieldDataType = (int)UiFieldDataType.Integer,
|
||||
// SqlIdColumnName = "anotifysubscription.id",
|
||||
// SqlValueColumnName = "anotifysubscription.id",
|
||||
// AyaObjectType = (int)AyaType.NotifySubscription,
|
||||
// IsRowId = true
|
||||
// });
|
||||
|
||||
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
{
|
||||
TKey = "AyaType",
|
||||
FieldKey = "ayatype",
|
||||
UiFieldDataType = (int)UiFieldDataType.Enum,
|
||||
EnumType = AyaNova.Util.StringUtil.TrimTypeName(typeof(AyaType).ToString())
|
||||
});
|
||||
// FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
// {
|
||||
// TKey = "AyaType",
|
||||
// FieldKey = "ayatype",
|
||||
// UiFieldDataType = (int)UiFieldDataType.Enum,
|
||||
// EnumType = AyaNova.Util.StringUtil.TrimTypeName(typeof(AyaType).ToString())
|
||||
// });
|
||||
|
||||
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
{
|
||||
TKey = "NotifyEventType",
|
||||
FieldKey = "eventtype",
|
||||
UiFieldDataType = (int)UiFieldDataType.Enum,
|
||||
EnumType = AyaNova.Util.StringUtil.TrimTypeName(typeof(NotifyEventType).ToString())
|
||||
});
|
||||
// FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
// {
|
||||
// TKey = "NotifyEventType",
|
||||
// FieldKey = "eventtype",
|
||||
// UiFieldDataType = (int)UiFieldDataType.Enum,
|
||||
// EnumType = AyaNova.Util.StringUtil.TrimTypeName(typeof(NotifyEventType).ToString())
|
||||
// });
|
||||
|
||||
// FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
// {
|
||||
// TKey = "FileAttachment",
|
||||
// FieldKey = "displayfilename",
|
||||
// AyaObjectType = (int)AyaType.FileAttachment,
|
||||
// UiFieldDataType = (int)UiFieldDataType.Text,
|
||||
// SqlIdColumnName = "afileattachment.id",
|
||||
// SqlValueColumnName = "afileattachment.displayfilename",
|
||||
// IsRowId = true
|
||||
// });
|
||||
// // FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
// // {
|
||||
// // TKey = "FileAttachment",
|
||||
// // FieldKey = "displayfilename",
|
||||
// // AyaObjectType = (int)AyaType.FileAttachment,
|
||||
// // UiFieldDataType = (int)UiFieldDataType.Text,
|
||||
// // SqlIdColumnName = "afileattachment.id",
|
||||
// // SqlValueColumnName = "afileattachment.displayfilename",
|
||||
// // IsRowId = true
|
||||
// // });
|
||||
|
||||
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
{
|
||||
TKey = "NotifyDeliveryMethod",
|
||||
FieldKey = "deliverymethod",
|
||||
UiFieldDataType = (int)UiFieldDataType.Enum,
|
||||
EnumType = AyaNova.Util.StringUtil.TrimTypeName(typeof(NotifyDeliveryMethod).ToString())
|
||||
});
|
||||
// FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
// {
|
||||
// TKey = "NotifyDeliveryMethod",
|
||||
// FieldKey = "deliverymethod",
|
||||
// UiFieldDataType = (int)UiFieldDataType.Enum,
|
||||
// EnumType = AyaNova.Util.StringUtil.TrimTypeName(typeof(NotifyDeliveryMethod).ToString())
|
||||
// });
|
||||
|
||||
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
{
|
||||
TKey = "NotifyDeliveryAddress",
|
||||
FieldKey = "deliveryaddress",
|
||||
UiFieldDataType = (int)UiFieldDataType.Text
|
||||
});
|
||||
// FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
// {
|
||||
// TKey = "NotifyDeliveryAddress",
|
||||
// FieldKey = "deliveryaddress",
|
||||
// UiFieldDataType = (int)UiFieldDataType.Text
|
||||
// });
|
||||
|
||||
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
{
|
||||
TKey = "InTags",
|
||||
FieldKey = "tags",
|
||||
UiFieldDataType = (int)UiFieldDataType.Tags
|
||||
});
|
||||
// FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
// {
|
||||
// TKey = "InTags",
|
||||
// FieldKey = "tags",
|
||||
// UiFieldDataType = (int)UiFieldDataType.Tags
|
||||
// });
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}//eoc
|
||||
}//eons
|
||||
// }
|
||||
// }//eoc
|
||||
// }//eons
|
||||
Reference in New Issue
Block a user