This commit is contained in:
2020-12-16 21:17:32 +00:00
parent 961b97966a
commit 7c0421bb1c
6 changed files with 163 additions and 3 deletions

View File

@@ -108,6 +108,7 @@ namespace AyaNova.Biz
Backup = 49,
Notification = 50,
NotifySubscription = 51,
[CoreBizObject]
Reminder = 52,
UnitMeterReading = 53,
CustomerServiceRequest = 54,
@@ -118,7 +119,9 @@ namespace AyaNova.Biz
[CoreBizObject]
CustomerNote = 59,
[CoreBizObject]
Memo = 60
Memo = 60,
[CoreBizObject]
Review = 61

View File

@@ -104,6 +104,10 @@ namespace AyaNova.Biz
return await ct.WorkOrderTemplateItem.AnyAsync(z => z.Id == id);
case AyaType.Report:
return await ct.Report.AnyAsync(z => z.Id == id);
case AyaType.Reminder:
return await ct.Reminder.AnyAsync(z => z.Id == id);
case AyaType.Review:
return await ct.Review.AnyAsync(z => z.Id == id);
default:
throw new System.NotSupportedException($"AyaNova.Biz.BizObjectExistsInDatabase::ExistsAsync type {objectType.ToString()} is not supported");
}

View File

@@ -88,6 +88,12 @@ namespace AyaNova.Biz
case AyaType.WorkOrderTemplate:
return new WorkOrderTemplateBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
case AyaType.Reminder:
return new ReminderBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
case AyaType.Review:
return new ReviewBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
default:
throw new System.NotSupportedException($"AyaNova.BLL.BizObjectFactory::GetBizObject type {ayaType.ToString()} is not supported");
}

View File

@@ -39,6 +39,8 @@ namespace AyaNova.Biz
//but then I'm wondering if some items under workorder might have seperate roles...
//maybe it's workorder by default unless something needs an override
//BizRules will handle finer grained rights, this is just the big picture rights or default if no finer required
////////////////////////////////////////////////////////////
//CUSTOMER
// (any change copy to customer notes, head office)
@@ -110,7 +112,7 @@ namespace AyaNova.Biz
roles.Add(AyaType.PurchaseOrder, new BizRoleSet()
{
Change = AuthorizationRoles.InventoryFull | AuthorizationRoles.BizAdminFull | AuthorizationRoles.AccountingFull,
ReadFullRecord = AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryLimited | AuthorizationRoles.BizAdminLimited | AuthorizationRoles.DispatchLimited,
ReadFullRecord = AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryLimited | AuthorizationRoles.BizAdminLimited | AuthorizationRoles.DispatchLimited,
Select = AuthorizationRoles.All
});
@@ -594,7 +596,7 @@ namespace AyaNova.Biz
});
////////////////////////////////////////////////////////////
//MEMO
// (everyone but outside users Customer and HO can send and receive memos)
@@ -605,6 +607,26 @@ namespace AyaNova.Biz
Select = AuthorizationRoles.AllInsideUserRoles,
});
////////////////////////////////////////////////////////////
//REMINDER
// (everyone but outside users Customer and HO)
roles.Add(AyaType.Reminder, new BizRoleSet()
{
Change = AuthorizationRoles.AllInsideUserRoles,
ReadFullRecord = AuthorizationRoles.AllInsideUserRoles,
Select = AuthorizationRoles.AllInsideUserRoles,
});
////////////////////////////////////////////////////////////
//REVIEW
// (everyone but outside users and follows object rights)
roles.Add(AyaType.Review, new BizRoleSet()
{
Change = AuthorizationRoles.AllInsideUserRoles,
ReadFullRecord = AuthorizationRoles.AllInsideUserRoles,
Select = AuthorizationRoles.AllInsideUserRoles,
});
////////////////////////////////////////////////////////////////////
#endregion all roles init

View File

@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using AyaNova.Biz;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
namespace AyaNova.Models
{
//NOTE: Any non required field (nullable in DB) sb nullable here, i.e. decimal? not decimal,
//otherwise the server will call it an invalid record if the field isn't sent from client
public class Reminder : ICoreBizObjectModel
{
public long Id { get; set; }
public uint Concurrency { get; set; }
[Required]
public string Name { get; set; }
public bool Active { get; set; }
public string Notes { get; set; }
public string Wiki { get; set; }
public string CustomFields { get; set; }
public List<string> Tags { get; set; }
public DateTime? DateStarted { get; set; }
public DateTime? DateCompleted { get; set; }
public long? ReminderOverseerId { get; set; }
public string AccountNumber { get; set; }
public Reminder()
{
Tags = new List<string>();
DateStarted = DateTime.UtcNow;
}
[NotMapped, JsonIgnore]
public AyaType AyaType { get => AyaType.Reminder; }
}//eoc
}//eons
/*
DATES should be indexed for fast viewing
CREATE TABLE [dbo].[ASCHEDULEMARKER](
[AID] [uniqueidentifier] NOT NULL,
[ACREATED] [datetime] NOT NULL,
[ACREATOR] [uniqueidentifier] NOT NULL,
[AMODIFIER] [uniqueidentifier] NOT NULL,
[ANAME] [nvarchar](255) NULL,
[ANOTES] [ntext] NULL,
[AMODIFIED] [datetime] NULL,
[ASTARTDATE] [datetime] NULL,
[ASTOPDATE] [datetime] NULL,
[ASCHEDULEMARKERSOURCETYPE] [smallint] NULL,
[ASOURCEID] [uniqueidentifier] NOT NULL,
[AARGB] [int] NULL,
[AFOLLOWID] [uniqueidentifier] NULL,
[AFOLLOWTYPE] [smallint] NULL,
[ACOMPLETED] [bit] NOT NULL,
*/

View File

@@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using AyaNova.Biz;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
namespace AyaNova.Models
{
//NOTE: Any non required field (nullable in DB) sb nullable here, i.e. decimal? not decimal,
//otherwise the server will call it an invalid record if the field isn't sent from client
public class Review : ICoreBizObjectModel
{
public long Id { get; set; }
public uint Concurrency { get; set; }
[Required]
public string Name { get; set; }
public bool Active { get; set; }
public string Notes { get; set; }
public string Wiki { get; set; }
public string CustomFields { get; set; }
public List<string> Tags { get; set; }
public DateTime? DateStarted { get; set; }
public DateTime? DateCompleted { get; set; }
public long? ReviewOverseerId { get; set; }
public string AccountNumber { get; set; }
public Review()
{
Tags = new List<string>();
DateStarted = DateTime.UtcNow;
}
[NotMapped, JsonIgnore]
public AyaType AyaType { get => AyaType.Review; }
}//eoc
}//eons
/*
DATES should be indexed for fast viewing
CREATE TABLE [dbo].[ASCHEDULEMARKER](
[AID] [uniqueidentifier] NOT NULL,
[ACREATED] [datetime] NOT NULL,
[ACREATOR] [uniqueidentifier] NOT NULL,
[AMODIFIER] [uniqueidentifier] NOT NULL,
[ANAME] [nvarchar](255) NULL,
[ANOTES] [ntext] NULL,
[AMODIFIED] [datetime] NULL,
[ASTARTDATE] [datetime] NULL,
[ASTOPDATE] [datetime] NULL,
[ASCHEDULEMARKERSOURCETYPE] [smallint] NULL,
[ASOURCEID] [uniqueidentifier] NOT NULL,
[AARGB] [int] NULL,
[AFOLLOWID] [uniqueidentifier] NULL,
[AFOLLOWTYPE] [smallint] NULL,
[ACOMPLETED] [bit] NOT NULL,
*/