From 7c0421bb1cf156d8889989f913f63465412051ca Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 16 Dec 2020 21:17:32 +0000 Subject: [PATCH] --- server/AyaNova/biz/AyaType.cs | 5 +- .../AyaNova/biz/BizObjectExistsInDatabase.cs | 4 ++ server/AyaNova/biz/BizObjectFactory.cs | 6 ++ server/AyaNova/biz/BizRoles.cs | 26 +++++++- server/AyaNova/models/Reminder.cs | 63 +++++++++++++++++++ server/AyaNova/models/Review.cs | 62 ++++++++++++++++++ 6 files changed, 163 insertions(+), 3 deletions(-) create mode 100644 server/AyaNova/models/Reminder.cs create mode 100644 server/AyaNova/models/Review.cs diff --git a/server/AyaNova/biz/AyaType.cs b/server/AyaNova/biz/AyaType.cs index b96d07a4..f7d2e8de 100644 --- a/server/AyaNova/biz/AyaType.cs +++ b/server/AyaNova/biz/AyaType.cs @@ -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 diff --git a/server/AyaNova/biz/BizObjectExistsInDatabase.cs b/server/AyaNova/biz/BizObjectExistsInDatabase.cs index 08b3f975..44325e7f 100644 --- a/server/AyaNova/biz/BizObjectExistsInDatabase.cs +++ b/server/AyaNova/biz/BizObjectExistsInDatabase.cs @@ -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"); } diff --git a/server/AyaNova/biz/BizObjectFactory.cs b/server/AyaNova/biz/BizObjectFactory.cs index 1ec26d11..e260e322 100644 --- a/server/AyaNova/biz/BizObjectFactory.cs +++ b/server/AyaNova/biz/BizObjectFactory.cs @@ -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"); } diff --git a/server/AyaNova/biz/BizRoles.cs b/server/AyaNova/biz/BizRoles.cs index 3c7a46e6..8089305f 100644 --- a/server/AyaNova/biz/BizRoles.cs +++ b/server/AyaNova/biz/BizRoles.cs @@ -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 diff --git a/server/AyaNova/models/Reminder.cs b/server/AyaNova/models/Reminder.cs new file mode 100644 index 00000000..1105dba4 --- /dev/null +++ b/server/AyaNova/models/Reminder.cs @@ -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 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(); + 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, + +*/ \ No newline at end of file diff --git a/server/AyaNova/models/Review.cs b/server/AyaNova/models/Review.cs new file mode 100644 index 00000000..8be10f03 --- /dev/null +++ b/server/AyaNova/models/Review.cs @@ -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 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(); + 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, + +*/ \ No newline at end of file