diff --git a/Core/Resgrid.Config/ChatConfig.cs b/Core/Resgrid.Config/ChatConfig.cs
index d01e5b08..1df0898a 100644
--- a/Core/Resgrid.Config/ChatConfig.cs
+++ b/Core/Resgrid.Config/ChatConfig.cs
@@ -4,5 +4,10 @@ public static class ChatConfig
{
public static string DepartmentChatPrefix = "D1_";
public static string DepartmentGroupChatPrefix = "DG1_";
+ public static string NovuBackendUrl = "";
+ public static string NovuSocketUrl = "";
+ public static string NovuEnvironmentId = "";
+ public static string NovuApplicationId = "";
+ public static string NovuSecretKey = "";
}
}
diff --git a/Core/Resgrid.Localization/Areas/User/Contacts/Contacts.cs b/Core/Resgrid.Localization/Areas/User/Contacts/Contacts.cs
new file mode 100644
index 00000000..fef7c833
--- /dev/null
+++ b/Core/Resgrid.Localization/Areas/User/Contacts/Contacts.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Resgrid.Localization.Areas.User.Contacts
+{
+ public class Contacts
+ {
+ }
+}
diff --git a/Core/Resgrid.Localization/Areas/User/Contacts/Contacts.en.resx b/Core/Resgrid.Localization/Areas/User/Contacts/Contacts.en.resx
new file mode 100644
index 00000000..28fb5d11
--- /dev/null
+++ b/Core/Resgrid.Localization/Areas/User/Contacts/Contacts.en.resx
@@ -0,0 +1,417 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ Add Category
+
+
+ Add Contact
+
+
+ Address
+
+
+ Physical Street Address
+
+
+ Bluesky
+
+
+ Bluesky Url
+
+
+ Categories
+
+
+ Categories
+
+
+ Category Discription
+
+
+ Category Name
+
+
+ Cell Phone
+
+
+ Cell or Mobile Phone Number
+
+
+ City
+
+
+ Physical City
+
+
+ Location or Company
+
+
+ Company\Location Name
+
+
+ Organization or Location Name
+
+
+ Contacts
+
+
+ Contacts In Category
+
+
+ Contact Type
+
+
+ Country
+
+
+ If your changing your password you need enter your current password (not the new one) here
+
+
+ Other Data
+
+
+ Are you sure you want to delete the contact with the following name?
+
+
+ Description
+
+
+ Display On Map
+
+
+ Edit Category
+
+
+ Email address of the Contact iteself or the Contact Person (or shared mailbox) of the Company
+
+
+ Email Address
+
+
+ Email Address of the Person or Company
+
+
+ Entrance GPS Location
+
+
+ Latitude Gps of the Location Entrance
+
+
+ Latitude (Decimal Notation: i.e. 39.1517)
+
+
+ Longitude Gps of the Location Entrance
+
+
+ Longitude (Decimal Notation: i.e. -119.4571)
+
+
+ Exit GPS Location
+
+
+ Latitude Gps of the Location Exit
+
+
+ Latitude (Decimal Notation: i.e. 39.1517)
+
+
+ Longitude Gps of the Location Exit
+
+
+ Longitude (Decimal Notation: i.e. -119.4571)
+
+
+ Facebook
+
+
+ Facebook name or url
+
+
+ Fax Number
+
+
+ Fax Phone Number
+
+
+ First Name
+
+
+ First name of the contact
+
+
+ Home Phone
+
+
+ Home Phone Number
+
+
+ Instagram
+
+
+ Instagram name
+
+
+ Last Name
+
+
+ Last name of the contact
+
+
+ Last Updated
+
+
+ LinkedIn
+
+
+ LinkedIn name or url
+
+
+ GPS Location
+
+
+ Latitude Gps Location
+
+
+ Latitude (Decimal Notation: i.e. 39.1517)
+
+
+ Longitude Gps Location
+
+
+ Longitude (Decimal Notation: i.e. -119.4571)
+
+
+ Location Info
+
+
+ Address
+
+
+ Mailing Street Address
+
+
+ City
+
+
+ Mailing City
+
+
+ Country
+
+
+ Postal Code
+
+
+ Mailing Zip\Postal Code
+
+
+ State
+
+
+ Map Icon
+
+
+ Mastodon
+
+
+ Mastodon Username and Server
+
+
+ Middle Name
+
+
+ Middle name of the contact
+
+
+ New Contact
+
+
+ You do not have any Contacts added in the system.
+
+
+ You do not have any Contacts associated with this Category.
+
+
+ Office Phone
+
+
+ Office Phone Number
+
+
+ Contact Info
+
+
+ Other Info
+
+
+ Other Name
+
+
+ Other name of alias
+
+
+ Physical Address
+
+
+ Postal Code
+
+
+ Physical Zip\Postal Code
+
+
+ You are trying to delete a Contact Category. Are you sure you want to delete the category with the name
+
+
+ Same as Physical?
+
+
+ State
+
+
+ Physical State\Province
+
+
+ Threads
+
+
+ Threads handle
+
+
+ Twitter
+
+
+ @TwtiterHandle
+
+
+ View Category
+
+
+ View
+
+
+ View Contact
+
+
+ Website URL
+
+
+ Contact website Url
+
+
\ No newline at end of file
diff --git a/Core/Resgrid.Localization/Areas/User/Department/Department.en.resx b/Core/Resgrid.Localization/Areas/User/Department/Department.en.resx
index 0fbb03f1..eab0399e 100644
--- a/Core/Resgrid.Localization/Areas/User/Department/Department.en.resx
+++ b/Core/Resgrid.Localization/Areas/User/Department/Department.en.resx
@@ -429,4 +429,52 @@
In Minutes, how long locations are valid for to be shown in the map. I.e. a value of 60 would mean a marker for a unit would show on the maps for up to 60 minutes, afterwards would not be shown. Setting 0 disables TTL and a location, no matter how old, will be shown on the map.
+
+ Add Contact
+
+
+ Contact Type
+
+
+ Here you can control high level information about every Module in the Resgrid system. New high level module options will be added here. These settings are in the early stages and may not yet propagate to all parts of the Resgrid system. So for example if you Disable the Training module it may appear in a screen deep in another feature. We will be working on in the future to ensure it's consistent.
+
+
+ Disable Calendar
+
+
+ Disable Inventory
+
+
+ Disable Logs
+
+
+ Disable Maintenance
+
+
+ Disable Notes
+
+
+ Disable Reports
+
+
+ Disable Training
+
+
+ Disable Mapping
+
+
+ Disable Messaging
+
+
+ Disable Shifts
+
+
+ Department Modules
+
+
+ Disable Documents
+
+
+ Department Module Settings Have Been Saved
+
\ No newline at end of file
diff --git a/Core/Resgrid.Localization/Common.en.resx b/Core/Resgrid.Localization/Common.en.resx
index 58525661..a9a39e84 100644
--- a/Core/Resgrid.Localization/Common.en.resx
+++ b/Core/Resgrid.Localization/Common.en.resx
@@ -204,6 +204,9 @@
Connect
+
+ Contacts
+
Contact Us
diff --git a/Core/Resgrid.Localization/Common.es.resx b/Core/Resgrid.Localization/Common.es.resx
index 7dda65cd..72706099 100644
--- a/Core/Resgrid.Localization/Common.es.resx
+++ b/Core/Resgrid.Localization/Common.es.resx
@@ -201,6 +201,9 @@
Conectar
+
+ Contactos
+
Contáctenos
diff --git a/Core/Resgrid.Model/AuditLogTypes.cs b/Core/Resgrid.Model/AuditLogTypes.cs
index 4c37d14c..7dfd69f4 100644
--- a/Core/Resgrid.Model/AuditLogTypes.cs
+++ b/Core/Resgrid.Model/AuditLogTypes.cs
@@ -54,5 +54,11 @@ public enum AuditLogTypes
NoteAdded,
NoteEdited,
NoteRemoved,
+ ContactAdded,
+ ContactEdited,
+ ContactRemoved,
+ ContactCategoryAdded,
+ ContactCategoryEdited,
+ ContactCategoryRemoved
}
}
diff --git a/Core/Resgrid.Model/CallContact.cs b/Core/Resgrid.Model/CallContact.cs
new file mode 100644
index 00000000..d538b6af
--- /dev/null
+++ b/Core/Resgrid.Model/CallContact.cs
@@ -0,0 +1,52 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Newtonsoft.Json;
+using ProtoBuf;
+using Resgrid.Framework;
+
+namespace Resgrid.Model
+{
+ [ProtoContract]
+ public class CallContact : IEntity
+ {
+ [Required]
+ [ProtoMember(1)]
+ public string CallContactId { get; set; }
+
+ [Required]
+ [ProtoMember(2)]
+ public int DepartmentId { get; set; }
+
+ [Required]
+ [ProtoMember(3)]
+ public int CallId { get; set; }
+
+ [ProtoMember(4)]
+ public string ContactId { get; set; }
+
+ [ProtoMember(5)]
+ public int CallContactType { get; set; } // 0 = Primary
+
+ [NotMapped]
+ [JsonIgnore]
+ public object IdValue
+ {
+ get { return CallContactId; }
+ set { CallContactId = (string)value; }
+ }
+
+ [NotMapped]
+ public string TableName => "CallContacts";
+
+ [NotMapped]
+ public string IdName => "CallContactId";
+
+ [NotMapped]
+ public int IdType => 1;
+
+ [NotMapped]
+ public IEnumerable IgnoredProperties => new string[] { "IdValue", "IdType", "TableName", "IdName" };
+ }
+}
diff --git a/Core/Resgrid.Model/Contact.cs b/Core/Resgrid.Model/Contact.cs
index 66c50c9d..1704c57b 100644
--- a/Core/Resgrid.Model/Contact.cs
+++ b/Core/Resgrid.Model/Contact.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
@@ -8,17 +9,121 @@ namespace Resgrid.Model
{
public class Contact : IEntity
{
- [Required]
public string ContactId { get; set; }
- [Required]
- public string ContactTypeId { get; set; }
+ public int DepartmentId { get; set; }
- [Required]
- [MaxLength(500)]
- public string Name { get; set; }
+ public int ContactType { get; set; } // 0 = Person, 1 = Company
+ public string OtherName { get; set; }
+ public string ContactCategoryId { get; set; }
+
+ public virtual ContactCategory Category { get; set; }
+
+ public string FirstName { get; set; }
+
+ public string MiddleName { get; set; }
+
+ public string LastName { get; set; }
+
+ public string CompanyName { get; set; }
+
+ public string Email { get; set; }
+
+ public int? PhysicalAddressId { get; set; }
+
+ public int? MailingAddressId { get; set; }
+
+ public string Website { get; set; }
+
+ public string Twitter { get; set; }
+
+ public string Facebook { get; set; }
+
+ public string LinkedIn { get; set; }
+
+ public string Instagram { get; set; }
+
+ public string Threads { get; set; }
+
+ public string Bluesky { get; set; }
+
+ public string Mastodon { get; set; }
+
+ public string LocationGpsCoordinates { get; set; }
+
+ public string EntranceGpsCoordinates { get; set; }
+
+ public string ExitGpsCoordinates { get; set; }
+
+ public string LocationGeofence { get; set; }
+
+ public string CountryIssuedIdNumber { get; set; }
+
+ public string CountryIdName { get; set; }
+
+ public string StateIdNumber { get; set; }
+
+ public string StateIdName { get; set; }
+
+ public string StateIdCountryName { get; set; }
+
+ public string Description { get; set; }
+
+ public string OtherInfo { get; set; }
+
+ public string HomePhoneNumber { get; set; }
+
+ public string CellPhoneNumber { get; set; }
+
+ public string FaxPhoneNumber { get; set; }
+
+ public string OfficePhoneNumber { get; set; }
+
+ public byte[] Image { get; set; }
+
+ public bool IsDeleted { get; set; }
+
+ public DateTime AddedOn { get; set; }
+
+ public string AddedByUserId { get; set; }
+
+ public DateTime? EditedOn { get; set; }
+
+ public string EditedByUserId { get; set; }
+
+ public string GetName()
+ {
+ if (ContactType == 0)
+ {
+ return $"{FirstName} {LastName}";
+ }
+ else
+ {
+ return CompanyName;
+ }
+ }
+
+ public string GetTypeName()
+ {
+ if (ContactType == 0)
+ {
+ return "Person";
+ }
+ else
+ {
+ return "Location\\Company";
+ }
+ }
+
+ public string GetCategoryName()
+ {
+ if (Category != null)
+ return Category.Name;
+
+ return "None";
+ }
[NotMapped]
public string TableName => "Contacts";
@@ -38,6 +143,6 @@ public object IdValue
}
[NotMapped]
- public IEnumerable IgnoredProperties => new string[] { "IdValue", "IdType", "TableName", "IdName" };
+ public IEnumerable IgnoredProperties => new string[] { "IdValue", "IdType", "TableName", "IdName", "Category" };
}
}
diff --git a/Core/Resgrid.Model/ContactAssociation.cs b/Core/Resgrid.Model/ContactAssociation.cs
new file mode 100644
index 00000000..0b79cbc9
--- /dev/null
+++ b/Core/Resgrid.Model/ContactAssociation.cs
@@ -0,0 +1,52 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Newtonsoft.Json;
+using ProtoBuf;
+
+namespace Resgrid.Model
+{
+ public class ContactAssociation : IEntity
+ {
+ [Required]
+ public string ContactAssociationId { get; set; }
+
+ [Required]
+ public int DepartmentId { get; set; }
+
+ [Required]
+ public string SourceContactId { get; set; }
+
+ [Required]
+ public string TargetContactId { get; set; }
+
+ public int Type { get; set; } // 0 Related
+
+ public string Note { get; set; }
+
+ public DateTime AddedOn { get; set; }
+
+ public string AddedByUserId { get; set; }
+
+ [NotMapped]
+ public string TableName => "ContactAssociations";
+
+ [NotMapped]
+ public string IdName => "ContactAssociationId";
+
+ [NotMapped]
+ public int IdType => 1;
+
+ [NotMapped]
+ [JsonIgnore]
+ public object IdValue
+ {
+ get { return ContactAssociationId; }
+ set { ContactAssociationId = (string)value; }
+ }
+
+ [NotMapped]
+ public IEnumerable IgnoredProperties => new string[] { "IdValue", "IdType", "TableName", "IdName" };
+ }
+}
diff --git a/Core/Resgrid.Model/ContactCategory.cs b/Core/Resgrid.Model/ContactCategory.cs
new file mode 100644
index 00000000..c4ca8bb3
--- /dev/null
+++ b/Core/Resgrid.Model/ContactCategory.cs
@@ -0,0 +1,64 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Newtonsoft.Json;
+using ProtoBuf;
+
+namespace Resgrid.Model
+{
+ public class ContactCategory : IEntity
+ {
+ public string ContactCategoryId { get; set; }
+
+ [Required]
+ public int DepartmentId { get; set; }
+
+ [Required]
+ public string Name { get; set; }
+
+ public string Description { get; set; }
+
+ public string Color { get; set; }
+
+ public bool DisplayOnMap { get; set; }
+
+ public int MapIcon { get; set; }
+
+ public DateTime AddedOn { get; set; }
+
+ public string AddedByUserId { get; set; }
+
+ public DateTime? EditedOn { get; set; }
+
+ public string EditedByUserId { get; set; }
+
+ [NotMapped]
+ public IEnumerable Contacts { get; set; }
+
+ [NotMapped]
+ public string TableName => "ContactCategories";
+
+ [NotMapped]
+ public string IdName => "ContactCategoryId";
+
+ [NotMapped]
+ public int IdType => 1;
+
+ [NotMapped]
+ [JsonIgnore]
+ public object IdValue
+ {
+ get { return ContactCategoryId; }
+ set { ContactCategoryId = (string)value; }
+ }
+
+ [NotMapped]
+ public IEnumerable IgnoredProperties => new string[] { "IdValue", "IdType", "TableName", "IdName", "Contacts" };
+
+ public ContactCategory()
+ {
+ Contacts = new List();
+ }
+ }
+}
diff --git a/Core/Resgrid.Model/ContactNote.cs b/Core/Resgrid.Model/ContactNote.cs
new file mode 100644
index 00000000..8c9c5a98
--- /dev/null
+++ b/Core/Resgrid.Model/ContactNote.cs
@@ -0,0 +1,62 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Newtonsoft.Json;
+using ProtoBuf;
+
+namespace Resgrid.Model
+{
+ public class ContactNote : IEntity
+ {
+ [Required]
+ public string ContactNoteId { get; set; }
+
+ [Required]
+ public int DepartmentId { get; set; }
+
+ [Required]
+ public string ContactId { get; set; }
+
+ public string ContactNoteTypeId { get; set; }
+
+ [Required]
+ public string Note { get; set; }
+
+ public bool ShouldAlert { get; set; }
+
+ public int Visibility { get; set; } // 0 Internal, 1 Visible to Client
+
+ public DateTime? ExpiresOn { get; set; }
+
+ public bool IsDeleted { get; set; }
+
+ public DateTime AddedOn { get; set; }
+
+ public string AddedByUserId { get; set; }
+
+ public DateTime? EditedOn { get; set; }
+
+ public string EditedByUserId { get; set; }
+
+ [NotMapped]
+ public string TableName => "ContactNotes";
+
+ [NotMapped]
+ public string IdName => "ContactNoteId";
+
+ [NotMapped]
+ public int IdType => 1;
+
+ [NotMapped]
+ [JsonIgnore]
+ public object IdValue
+ {
+ get { return ContactNoteId; }
+ set { ContactNoteId = (string)value; }
+ }
+
+ [NotMapped]
+ public IEnumerable IgnoredProperties => new string[] { "IdValue", "IdType", "TableName", "IdName" };
+ }
+}
diff --git a/Core/Resgrid.Model/ContactNoteType.cs b/Core/Resgrid.Model/ContactNoteType.cs
new file mode 100644
index 00000000..2bd74ca8
--- /dev/null
+++ b/Core/Resgrid.Model/ContactNoteType.cs
@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Newtonsoft.Json;
+using ProtoBuf;
+
+namespace Resgrid.Model
+{
+ public class ContactNoteType : IEntity
+ {
+ [Required]
+ public string ContactNoteTypeId { get; set; }
+
+ [Required]
+ public int DepartmentId { get; set; }
+
+ [Required]
+ public string Name { get; set; }
+
+ public string Color { get; set; }
+
+ public bool DefaultShouldAlert { get; set; }
+
+ public int DefaultVisibility { get; set; } // 0 Internal, 1 Visible to Client
+
+ public DateTime AddedOn { get; set; }
+
+ public string AddedByUserId { get; set; }
+
+ public DateTime? EditedOn { get; set; }
+
+ public string EditedByUserId { get; set; }
+
+ [NotMapped]
+ public string TableName => "ContactNoteTypes";
+
+ [NotMapped]
+ public string IdName => "ContactNoteTypeId";
+
+ [NotMapped]
+ public int IdType => 1;
+
+ [NotMapped]
+ [JsonIgnore]
+ public object IdValue
+ {
+ get { return ContactNoteTypeId; }
+ set { ContactNoteTypeId = (string)value; }
+ }
+
+ [NotMapped]
+ public IEnumerable IgnoredProperties => new string[] { "IdValue", "IdType", "TableName", "IdName" };
+ }
+}
diff --git a/Core/Resgrid.Model/DepartmentModuleSettings.cs b/Core/Resgrid.Model/DepartmentModuleSettings.cs
new file mode 100644
index 00000000..77f86940
--- /dev/null
+++ b/Core/Resgrid.Model/DepartmentModuleSettings.cs
@@ -0,0 +1,65 @@
+using ProtoBuf;
+
+namespace Resgrid.Model
+{
+ [ProtoContract]
+ public class DepartmentModuleSettings
+ {
+ // Calls, Personnel and Units are always enabled
+
+ [ProtoMember(1)]
+ public bool MessagingDisabled { get; set; }
+ [ProtoMember(2)]
+ public string MessagingNameOverride { get; set; }
+
+ [ProtoMember(3)]
+ public bool MappingDisabled { get; set; }
+ [ProtoMember(41)]
+ public string MappingNameOverride { get; set; }
+
+ [ProtoMember(5)]
+ public bool ShiftsDisabled { get; set; }
+ [ProtoMember(6)]
+ public string ShiftsNameOverride { get; set; }
+
+ [ProtoMember(7)]
+ public bool LogsDisabled { get; set; }
+ [ProtoMember(8)]
+ public string LogsNameOverride { get; set; }
+
+ [ProtoMember(9)]
+ public bool ReportsDisabled { get; set; }
+ [ProtoMember(10)]
+ public string ReportsNameOverride { get; set; }
+
+ [ProtoMember(11)]
+ public bool DocumentsDisabled { get; set; }
+ [ProtoMember(12)]
+ public string DocumentsNameOverride { get; set; }
+
+ [ProtoMember(13)]
+ public bool CalendarDisabled { get; set; }
+ [ProtoMember(14)]
+ public string CalendarNameOverride { get; set; }
+
+ [ProtoMember(15)]
+ public bool NotesDisabled { get; set; }
+ [ProtoMember(16)]
+ public string NotesNameOverride { get; set; }
+
+ [ProtoMember(17)]
+ public bool TrainingDisabled { get; set; }
+ [ProtoMember(18)]
+ public string TrainingNameOverride { get; set; }
+
+ [ProtoMember(19)]
+ public bool InventoryDisabled { get; set; }
+ [ProtoMember(20)]
+ public string InventoryNameOverride { get; set; }
+
+ [ProtoMember(21)]
+ public bool MaintenanceDisabled { get; set; }
+ [ProtoMember(22)]
+ public string MaintenanceNameOverride { get; set; }
+ }
+}
diff --git a/Core/Resgrid.Model/DepartmentSettingTypes.cs b/Core/Resgrid.Model/DepartmentSettingTypes.cs
index d093a8f5..df285243 100644
--- a/Core/Resgrid.Model/DepartmentSettingTypes.cs
+++ b/Core/Resgrid.Model/DepartmentSettingTypes.cs
@@ -32,6 +32,7 @@ public enum DepartmentSettingTypes
MappingPersonnelLocationTTL = 28,
MappingUnitLocationTTL = 29,
MappingPersonnelAllowStatusWithNoLocationToOverwrite = 30,
- MappingUnitAllowStatusWithNoLocationToOverwrite = 31
+ MappingUnitAllowStatusWithNoLocationToOverwrite = 31,
+ ModuleSettings = 32
}
}
diff --git a/Core/Resgrid.Model/MapIconTypes.cs b/Core/Resgrid.Model/MapIconTypes.cs
index a371a3eb..9d9fa385 100644
--- a/Core/Resgrid.Model/MapIconTypes.cs
+++ b/Core/Resgrid.Model/MapIconTypes.cs
@@ -45,8 +45,37 @@ public enum MapIconTypes
Truck, //truck.png
Van, //van.png
Velocimeter, //velocimeter.png
- Watercraft //watercraft.png
+ Watercraft, //watercraft.png
// End Unit Icons
+
+ // Begin Contact Icons
+ Always,
+ AboveGround,
+ Administration,
+ AadministrativeBoundary,
+ Apartment,
+ ColdStorage,
+ CommunityCentre,
+ Condominium,
+ Conference,
+ Congress,
+ Court,
+ Embassy,
+ Expert,
+ Job,
+ People,
+ House,
+ Laboratory,
+ Key,
+ OfficeBuilding,
+ Police,
+ Postal,
+ Townhouse,
+ WorkCase,
+ Home,
+ Adult,
+ Family,
+ // End Contact Icons
}
public class MapIcons
diff --git a/Core/Resgrid.Model/PermissionTypes.cs b/Core/Resgrid.Model/PermissionTypes.cs
index bd362e8d..229b75ad 100644
--- a/Core/Resgrid.Model/PermissionTypes.cs
+++ b/Core/Resgrid.Model/PermissionTypes.cs
@@ -20,7 +20,10 @@ public enum PermissionTypes
DeleteCall,
CloseCall,
AddCallData,
- ViewGroupUnits
+ ViewGroupUnits,
+ ContactEdit,
+ ContactView,
+ ContactDelete
}
}
diff --git a/Core/Resgrid.Model/Providers/Models/INovuProvider.cs b/Core/Resgrid.Model/Providers/Models/INovuProvider.cs
new file mode 100644
index 00000000..5cdcbcc4
--- /dev/null
+++ b/Core/Resgrid.Model/Providers/Models/INovuProvider.cs
@@ -0,0 +1,8 @@
+using System.Threading.Tasks;
+
+namespace Resgrid.Model.Providers;
+
+public interface INovuProvider
+{
+ Task CreateSubscriber(string userId, int departmentId, string email, string firstName, string lastName);
+}
diff --git a/Core/Resgrid.Model/Repositories/ICallContactsRepository.cs b/Core/Resgrid.Model/Repositories/ICallContactsRepository.cs
new file mode 100644
index 00000000..1b95ade9
--- /dev/null
+++ b/Core/Resgrid.Model/Repositories/ICallContactsRepository.cs
@@ -0,0 +1,15 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Resgrid.Model.Repositories
+{
+ ///
+ /// Interface ICallContactsRepository
+ /// Implements the
+ ///
+ ///
+ public interface ICallContactsRepository : IRepository
+ {
+
+ }
+}
diff --git a/Core/Resgrid.Model/Repositories/IContactAssociationsRepository.cs b/Core/Resgrid.Model/Repositories/IContactAssociationsRepository.cs
new file mode 100644
index 00000000..006cd496
--- /dev/null
+++ b/Core/Resgrid.Model/Repositories/IContactAssociationsRepository.cs
@@ -0,0 +1,15 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Resgrid.Model.Repositories
+{
+ ///
+ /// Interface IContactAssociationsRepository
+ /// Implements the
+ ///
+ ///
+ public interface IContactAssociationsRepository : IRepository
+ {
+
+ }
+}
diff --git a/Core/Resgrid.Model/Repositories/IContactCategoryRepository.cs b/Core/Resgrid.Model/Repositories/IContactCategoryRepository.cs
new file mode 100644
index 00000000..5054dd3b
--- /dev/null
+++ b/Core/Resgrid.Model/Repositories/IContactCategoryRepository.cs
@@ -0,0 +1,15 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Resgrid.Model.Repositories
+{
+ ///
+ /// Interface IContactCategoryRepository
+ /// Implements the
+ ///
+ ///
+ public interface IContactCategoryRepository : IRepository
+ {
+
+ }
+}
diff --git a/Core/Resgrid.Model/Repositories/IContactNoteTypesRepository.cs b/Core/Resgrid.Model/Repositories/IContactNoteTypesRepository.cs
new file mode 100644
index 00000000..9ef8a078
--- /dev/null
+++ b/Core/Resgrid.Model/Repositories/IContactNoteTypesRepository.cs
@@ -0,0 +1,15 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Resgrid.Model.Repositories
+{
+ ///
+ /// Interface IContactNoteTypesRepository
+ /// Implements the
+ ///
+ ///
+ public interface IContactNoteTypesRepository : IRepository
+ {
+
+ }
+}
diff --git a/Core/Resgrid.Model/Repositories/IContactNotesRepository.cs b/Core/Resgrid.Model/Repositories/IContactNotesRepository.cs
new file mode 100644
index 00000000..d55c1aa7
--- /dev/null
+++ b/Core/Resgrid.Model/Repositories/IContactNotesRepository.cs
@@ -0,0 +1,15 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Resgrid.Model.Repositories
+{
+ ///
+ /// Interface IContactNotesRepository
+ /// Implements the
+ ///
+ ///
+ public interface IContactNotesRepository : IRepository
+ {
+
+ }
+}
diff --git a/Core/Resgrid.Model/Repositories/IContactsRepository.cs b/Core/Resgrid.Model/Repositories/IContactsRepository.cs
new file mode 100644
index 00000000..02e65cd1
--- /dev/null
+++ b/Core/Resgrid.Model/Repositories/IContactsRepository.cs
@@ -0,0 +1,15 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Resgrid.Model.Repositories
+{
+ ///
+ /// Interface IContactsRepository
+ /// Implements the
+ ///
+ ///
+ public interface IContactsRepository : IRepository
+ {
+ Task> GetContactsByCategoryIdAsync(int departmentId, string categoryId);
+ }
+}
diff --git a/Core/Resgrid.Model/Services/IContactsService.cs b/Core/Resgrid.Model/Services/IContactsService.cs
new file mode 100644
index 00000000..ef685be3
--- /dev/null
+++ b/Core/Resgrid.Model/Services/IContactsService.cs
@@ -0,0 +1,17 @@
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Resgrid.Model.Services
+{
+ public interface IContactsService
+ {
+ Task> GetAllContactsForDepartmentAsync(int departmentId);
+ Task> GetContactCategoriesForDepartmentAsync(int departmentId);
+ Task SaveContactAsync(Contact contact, CancellationToken cancellationToken = default(CancellationToken));
+ Task> GetContactsByCategoryIdAsync(int departmentId, string categoryId);
+ Task SaveContactCategoryAsync(ContactCategory category, CancellationToken cancellationToken = default(CancellationToken));
+ Task GetContactCategoryByIdAsync(string contactCategoryId);
+ Task DeleteContactCategoryAsync(ContactCategory contactCategory, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
diff --git a/Core/Resgrid.Model/Services/IDepartmentSettingsService.cs b/Core/Resgrid.Model/Services/IDepartmentSettingsService.cs
index 8bc09ad7..7a233816 100644
--- a/Core/Resgrid.Model/Services/IDepartmentSettingsService.cs
+++ b/Core/Resgrid.Model/Services/IDepartmentSettingsService.cs
@@ -265,5 +265,9 @@ public interface IDepartmentSettingsService
Task GetMappingPersonnelAllowStatusWithNoLocationToOverwriteAsync(int departmentId);
Task GetMappingUnitAllowStatusWithNoLocationToOverwriteAsync(int departmentId);
+
+ Task GetDepartmentModuleSettingsAsync(int departmentId, bool bypassCache = false);
+
+ Task SetDepartmentModuleSettingsAsync(int departmentId, DepartmentModuleSettings settings, CancellationToken cancellationToken = default(CancellationToken));
}
}
diff --git a/Core/Resgrid.Services/ContactsService.cs b/Core/Resgrid.Services/ContactsService.cs
new file mode 100644
index 00000000..92496d75
--- /dev/null
+++ b/Core/Resgrid.Services/ContactsService.cs
@@ -0,0 +1,92 @@
+using Resgrid.Model;
+using Resgrid.Model.Repositories;
+using Resgrid.Model.Services;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Resgrid.Services
+{
+ public class ContactsService : IContactsService
+ {
+ private readonly IContactsRepository _contactsRepository;
+ private readonly IContactCategoryRepository _contactCategoryRepository;
+ private readonly IContactNotesRepository _contactNotesRepository;
+ private readonly IContactNoteTypesRepository _contactNoteTypesRepository;
+ private readonly IContactAssociationsRepository _contactAssociationsRepository;
+
+ public ContactsService(IContactsRepository contactsRepository, IContactNotesRepository contactNotesRepository,
+ IContactCategoryRepository contactCategoryRepository,
+ IContactNoteTypesRepository contactNoteTypesRepository, IContactAssociationsRepository contactAssociationsRepository)
+ {
+ _contactsRepository = contactsRepository;
+ _contactCategoryRepository = contactCategoryRepository;
+ _contactNotesRepository = contactNotesRepository;
+ _contactNoteTypesRepository = contactNoteTypesRepository;
+ _contactAssociationsRepository = contactAssociationsRepository;
+ }
+
+ public async Task> GetAllContactsForDepartmentAsync(int departmentId)
+ {
+ var contacts = await _contactsRepository.GetAllByDepartmentIdAsync(departmentId);
+ var categories = await _contactCategoryRepository.GetAllByDepartmentIdAsync(departmentId);
+
+ if (contacts == null)
+ return new List();
+
+ foreach (var contact in contacts)
+ {
+ if (categories != null && categories.Any())
+ contact.Category = categories.FirstOrDefault(x => x.ContactCategoryId == contact.ContactCategoryId);
+ }
+
+ return contacts.ToList();
+ }
+
+ public async Task> GetContactCategoriesForDepartmentAsync(int departmentId)
+ {
+ var categories = await _contactCategoryRepository.GetAllByDepartmentIdAsync(departmentId);
+
+ if (categories == null)
+ return new List();
+
+ foreach (var category in categories)
+ {
+ category.Contacts = await GetContactsByCategoryIdAsync(departmentId, category.ContactCategoryId);
+ }
+
+ return categories.ToList();
+ }
+
+ public async Task SaveContactAsync(Contact contact, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ return await _contactsRepository.SaveOrUpdateAsync(contact, cancellationToken);
+ }
+
+ public async Task> GetContactsByCategoryIdAsync(int departmentId, string categoryId)
+ {
+ var contacts = await _contactsRepository.GetContactsByCategoryIdAsync(departmentId, categoryId);
+
+ if (contacts == null)
+ return new List();
+
+ return contacts.ToList();
+ }
+
+ public async Task SaveContactCategoryAsync(ContactCategory category, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ return await _contactCategoryRepository.SaveOrUpdateAsync(category, cancellationToken);
+ }
+
+ public async Task GetContactCategoryByIdAsync(string contactCategoryId)
+ {
+ return await _contactCategoryRepository.GetByIdAsync(contactCategoryId);
+ }
+
+ public async Task DeleteContactCategoryAsync(ContactCategory contactCategory, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ return await _contactCategoryRepository.DeleteAsync(contactCategory, cancellationToken);
+ }
+ }
+}
diff --git a/Core/Resgrid.Services/DepartmentSettingsService.cs b/Core/Resgrid.Services/DepartmentSettingsService.cs
index 42719dd8..f3cc2023 100644
--- a/Core/Resgrid.Services/DepartmentSettingsService.cs
+++ b/Core/Resgrid.Services/DepartmentSettingsService.cs
@@ -664,5 +664,41 @@ async Task getSetting()
return await getSetting();
}
+
+ public async Task GetDepartmentModuleSettingsAsync(int departmentId, bool bypassCache = false)
+ {
+ async Task getSetting()
+ {
+ var actualSetting = await GetSettingByDepartmentIdType(departmentId, DepartmentSettingTypes.ModuleSettings);
+
+ if (actualSetting != null)
+ {
+ var setting = ObjectSerialization.Deserialize(actualSetting.Setting);
+
+ if (setting != null)
+ return setting;
+ else
+ return new DepartmentModuleSettings();
+ }
+
+ return new DepartmentModuleSettings();
+ }
+
+ if (!bypassCache && Config.SystemBehaviorConfig.CacheEnabled)
+ {
+ var cachedValue = await _cacheProvider.RetrieveAsync(string.Format(StaffingSupressInfo, departmentId),
+ getSetting, ThatsNotLongThisIsLongCacheLength);
+
+ return cachedValue;
+ }
+
+ return await getSetting();
+ }
+
+ public async Task SetDepartmentModuleSettingsAsync(int departmentId, DepartmentModuleSettings settings, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ return await SaveOrUpdateSettingAsync(departmentId, ObjectSerialization.Serialize(settings),
+ DepartmentSettingTypes.ModuleSettings, cancellationToken);
+ }
}
}
diff --git a/Core/Resgrid.Services/ServicesModule.cs b/Core/Resgrid.Services/ServicesModule.cs
index ef8f8824..4ee48a62 100644
--- a/Core/Resgrid.Services/ServicesModule.cs
+++ b/Core/Resgrid.Services/ServicesModule.cs
@@ -75,6 +75,7 @@ protected override void Load(ContainerBuilder builder)
//builder.RegisterType().As().SingleInstance();
builder.RegisterType().As().SingleInstance();
builder.RegisterType().As().SingleInstance();
+ builder.RegisterType().As().SingleInstance();
// Stripe Services
diff --git a/Providers/Resgrid.Providers.Claims/ClaimsLogic.cs b/Providers/Resgrid.Providers.Claims/ClaimsLogic.cs
index a88dad88..0654a9b9 100644
--- a/Providers/Resgrid.Providers.Claims/ClaimsLogic.cs
+++ b/Providers/Resgrid.Providers.Claims/ClaimsLogic.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
+using System.Security.Principal;
using Resgrid.Model;
using Resgrid.Model.Identity;
@@ -1079,5 +1080,132 @@ public static void AddCustomStateClaims(ClaimsIdentity identity, bool isAdmin)
identity.AddClaim(new Claim(ResgridClaimTypes.Resources.CustomStates, ResgridClaimTypes.Actions.Delete));
}
}
+
+ public static void AddContactsClaims(ClaimsIdentity identity, bool isAdmin, List permissions, bool isGroupAdmin, List roles)
+ {
+ if (permissions != null && permissions.Any(x => x.PermissionType == (int)PermissionTypes.ContactView))
+ {
+ var permission = permissions.First(x => x.PermissionType == (int)PermissionTypes.ContactView);
+
+ if (permission.Action == (int)PermissionActions.DepartmentAdminsOnly && isAdmin)
+ {
+ identity.AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.View));
+ }
+ else if (permission.Action == (int)PermissionActions.DepartmentAndGroupAdmins && (isAdmin || isGroupAdmin))
+ {
+ identity.AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.View));
+ }
+ else if (permission.Action == (int)PermissionActions.DepartmentAdminsAndSelectRoles && isAdmin)
+ {
+ identity.AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.View));
+ }
+ else if (permission.Action == (int)PermissionActions.DepartmentAdminsAndSelectRoles && !isAdmin)
+ {
+ var roleIds = permission.Data.Split(char.Parse(",")).Select(int.Parse);
+ var role = from r in roles
+ where roleIds.Contains(r.PersonnelRoleId)
+ select r;
+
+ if (role.Any())
+ {
+ identity.AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.View));
+ }
+
+ }
+ else if (permission.Action == (int)PermissionActions.Everyone)
+ {
+ identity.AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.View));
+ }
+ }
+ else
+ {
+ identity.AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.View));
+ }
+
+ if (permissions != null && permissions.Any(x => x.PermissionType == (int)PermissionTypes.ContactEdit))
+ {
+ var permission = permissions.First(x => x.PermissionType == (int)PermissionTypes.ContactEdit);
+
+ if (permission.Action == (int)PermissionActions.DepartmentAdminsOnly && isAdmin)
+ {
+ identity.AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Update));
+ identity.AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Create));
+ }
+ else if (permission.Action == (int)PermissionActions.DepartmentAndGroupAdmins && (isAdmin || isGroupAdmin))
+ {
+ identity.AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Update));
+ identity.AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Create));
+ }
+ else if (permission.Action == (int)PermissionActions.DepartmentAdminsAndSelectRoles && isAdmin)
+ {
+ identity.AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Update));
+ identity.AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Create));
+ }
+ else if (permission.Action == (int)PermissionActions.DepartmentAdminsAndSelectRoles && !isAdmin)
+ {
+ var roleIds = permission.Data.Split(char.Parse(",")).Select(int.Parse);
+ var role = from r in roles
+ where roleIds.Contains(r.PersonnelRoleId)
+ select r;
+
+ if (role.Any())
+ {
+ identity.AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Update));
+ identity.AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Create));
+ }
+
+ }
+ else if (permission.Action == (int)PermissionActions.Everyone)
+ {
+ identity.AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Update));
+ identity.AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Create));
+ }
+
+ }
+ else
+ {
+ identity.AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Update));
+ identity.AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Create));
+ }
+
+ if (permissions != null && permissions.Any(x => x.PermissionType == (int)PermissionTypes.ContactDelete))
+ {
+ var permission = permissions.First(x => x.PermissionType == (int)PermissionTypes.ContactDelete);
+
+ if (permission.Action == (int)PermissionActions.DepartmentAdminsOnly && isAdmin)
+ {
+ identity.AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Delete));
+ }
+ else if (permission.Action == (int)PermissionActions.DepartmentAndGroupAdmins && (isAdmin || isGroupAdmin))
+ {
+ identity.AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Delete));
+ }
+ else if (permission.Action == (int)PermissionActions.DepartmentAdminsAndSelectRoles && isAdmin)
+ {
+ identity.AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Delete));
+ }
+ else if (permission.Action == (int)PermissionActions.DepartmentAdminsAndSelectRoles && !isAdmin)
+ {
+ var roleIds = permission.Data.Split(char.Parse(",")).Select(int.Parse);
+ var role = from r in roles
+ where roleIds.Contains(r.PersonnelRoleId)
+ select r;
+
+ if (role.Any())
+ {
+ identity.AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Delete));
+ }
+
+ }
+ else if (permission.Action == (int)PermissionActions.Everyone)
+ {
+ identity.AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Delete));
+ }
+ }
+ else
+ {
+ identity.AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Delete));
+ }
+ }
}
}
diff --git a/Providers/Resgrid.Providers.Claims/ClaimsPrincipalFactory.cs b/Providers/Resgrid.Providers.Claims/ClaimsPrincipalFactory.cs
index efbb1533..68841177 100644
--- a/Providers/Resgrid.Providers.Claims/ClaimsPrincipalFactory.cs
+++ b/Providers/Resgrid.Providers.Claims/ClaimsPrincipalFactory.cs
@@ -197,6 +197,7 @@ public override async Task CreateAsync(TUser user)
ClaimsLogic.AddFormsClaims(id, departmentAdmin);
ClaimsLogic.AddVoiceClaims(id, departmentAdmin);
ClaimsLogic.AddCustomStateClaims(id, departmentAdmin);
+ ClaimsLogic.AddContactsClaims(id, departmentAdmin, permissions, isGroupAdmin, roles);
}
}
diff --git a/Providers/Resgrid.Providers.Claims/JwtTokenProvider.cs b/Providers/Resgrid.Providers.Claims/JwtTokenProvider.cs
index 9a71ff79..df0ec864 100644
--- a/Providers/Resgrid.Providers.Claims/JwtTokenProvider.cs
+++ b/Providers/Resgrid.Providers.Claims/JwtTokenProvider.cs
@@ -120,6 +120,7 @@ public async Task BuildTokenAsync(string userId, int departmentId)
ClaimsLogic.AddFormsClaims(id, departmentAdmin);
ClaimsLogic.AddVoiceClaims(id, departmentAdmin);
ClaimsLogic.AddCustomStateClaims(id, departmentAdmin);
+ ClaimsLogic.AddContactsClaims(id, departmentAdmin, permissions, isGroupAdmin, roles);
var securityKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(JwtConfig.Key));
var credentials = new SigningCredentials(securityKey, SecurityAlgorithms.HmacSha256Signature);
diff --git a/Providers/Resgrid.Providers.Claims/ResgridClaimTypes.cs b/Providers/Resgrid.Providers.Claims/ResgridClaimTypes.cs
index e68e2e99..af8e5ad2 100644
--- a/Providers/Resgrid.Providers.Claims/ResgridClaimTypes.cs
+++ b/Providers/Resgrid.Providers.Claims/ResgridClaimTypes.cs
@@ -56,6 +56,7 @@ public static class Resources
public const string Forms = "Forms";
public const string Voice = "Voice";
public const string CustomStates = "CustomStates";
+ public const string Contacts = "Contacts";
}
public static string CreateDepartmentClaimTypeString(int departmentId)
diff --git a/Providers/Resgrid.Providers.Claims/ResgridIdentity.cs b/Providers/Resgrid.Providers.Claims/ResgridIdentity.cs
index 354b26a7..de366737 100644
--- a/Providers/Resgrid.Providers.Claims/ResgridIdentity.cs
+++ b/Providers/Resgrid.Providers.Claims/ResgridIdentity.cs
@@ -865,5 +865,132 @@ where roleIds.Contains(r.PersonnelRoleId)
AddClaim(new Claim(ResgridClaimTypes.Resources.Inventory, ResgridClaimTypes.Actions.View));
}
}
+
+ public void AddContactsClaims(bool isAdmin, List permissions, bool isGroupAdmin, List roles)
+ {
+ if (permissions != null && permissions.Any(x => x.PermissionType == (int)PermissionTypes.ContactView))
+ {
+ var permission = permissions.First(x => x.PermissionType == (int)PermissionTypes.ContactView);
+
+ if (permission.Action == (int)PermissionActions.DepartmentAdminsOnly && isAdmin)
+ {
+ AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.View));
+ }
+ else if (permission.Action == (int)PermissionActions.DepartmentAndGroupAdmins && (isAdmin || isGroupAdmin))
+ {
+ AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.View));
+ }
+ else if (permission.Action == (int)PermissionActions.DepartmentAdminsAndSelectRoles && isAdmin)
+ {
+ AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.View));
+ }
+ else if (permission.Action == (int)PermissionActions.DepartmentAdminsAndSelectRoles && !isAdmin)
+ {
+ var roleIds = permission.Data.Split(char.Parse(",")).Select(int.Parse);
+ var role = from r in roles
+ where roleIds.Contains(r.PersonnelRoleId)
+ select r;
+
+ if (role.Any())
+ {
+ AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.View));
+ }
+
+ }
+ else if (permission.Action == (int)PermissionActions.Everyone)
+ {
+ AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.View));
+ }
+ }
+ else
+ {
+ AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.View));
+ }
+
+ if (permissions != null && permissions.Any(x => x.PermissionType == (int)PermissionTypes.ContactEdit))
+ {
+ var permission = permissions.First(x => x.PermissionType == (int)PermissionTypes.ContactEdit);
+
+ if (permission.Action == (int)PermissionActions.DepartmentAdminsOnly && isAdmin)
+ {
+ AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Update));
+ AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Create));
+ }
+ else if (permission.Action == (int)PermissionActions.DepartmentAndGroupAdmins && (isAdmin || isGroupAdmin))
+ {
+ AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Update));
+ AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Create));
+ }
+ else if (permission.Action == (int)PermissionActions.DepartmentAdminsAndSelectRoles && isAdmin)
+ {
+ AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Update));
+ AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Create));
+ }
+ else if (permission.Action == (int)PermissionActions.DepartmentAdminsAndSelectRoles && !isAdmin)
+ {
+ var roleIds = permission.Data.Split(char.Parse(",")).Select(int.Parse);
+ var role = from r in roles
+ where roleIds.Contains(r.PersonnelRoleId)
+ select r;
+
+ if (role.Any())
+ {
+ AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Update));
+ AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Create));
+ }
+
+ }
+ else if (permission.Action == (int)PermissionActions.Everyone)
+ {
+ AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Update));
+ AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Create));
+ }
+
+ }
+ else
+ {
+ AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Update));
+ AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Create));
+ }
+
+ if (permissions != null && permissions.Any(x => x.PermissionType == (int)PermissionTypes.ContactDelete))
+ {
+ var permission = permissions.First(x => x.PermissionType == (int)PermissionTypes.ContactDelete);
+
+ if (permission.Action == (int)PermissionActions.DepartmentAdminsOnly && isAdmin)
+ {
+ AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Delete));
+ }
+ else if (permission.Action == (int)PermissionActions.DepartmentAndGroupAdmins && (isAdmin || isGroupAdmin))
+ {
+ AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Delete));
+ }
+ else if (permission.Action == (int)PermissionActions.DepartmentAdminsAndSelectRoles && isAdmin)
+ {
+ AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Delete));
+ }
+ else if (permission.Action == (int)PermissionActions.DepartmentAdminsAndSelectRoles && !isAdmin)
+ {
+ var roleIds = permission.Data.Split(char.Parse(",")).Select(int.Parse);
+ var role = from r in roles
+ where roleIds.Contains(r.PersonnelRoleId)
+ select r;
+
+ if (role.Any())
+ {
+ AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Delete));
+ }
+
+ }
+ else if (permission.Action == (int)PermissionActions.Everyone)
+ {
+ AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Delete));
+ }
+ }
+ else
+ {
+ AddClaim(new Claim(ResgridClaimTypes.Resources.Contacts, ResgridClaimTypes.Actions.Delete));
+ }
+ }
}
}
diff --git a/Providers/Resgrid.Providers.Claims/ResgridResources.cs b/Providers/Resgrid.Providers.Claims/ResgridResources.cs
index 332defab..73b8e4b4 100644
--- a/Providers/Resgrid.Providers.Claims/ResgridResources.cs
+++ b/Providers/Resgrid.Providers.Claims/ResgridResources.cs
@@ -127,5 +127,10 @@ public static class ResgridResources
public const string CustomStates_Update = "CustomStates_Update";
public const string CustomStates_Create = "CustomStates_Create";
public const string CustomStates_Delete = "CustomStates_Delete";
+
+ public const string Contacts_View = "Contacts_View";
+ public const string Contacts_Update = "Contacts_Update";
+ public const string Contacts_Create = "Contacts_Create";
+ public const string Contacts_Delete = "Contacts_Delete";
}
}
diff --git a/Providers/Resgrid.Providers.Messaging/Class1.cs b/Providers/Resgrid.Providers.Messaging/Class1.cs
deleted file mode 100644
index 9a612a05..00000000
--- a/Providers/Resgrid.Providers.Messaging/Class1.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace Resgrid.Providers.Whatsapp
-{
- public class Class1
- {
-
- }
-}
diff --git a/Providers/Resgrid.Providers.Messaging/MessagingProviderModule.cs b/Providers/Resgrid.Providers.Messaging/MessagingProviderModule.cs
new file mode 100644
index 00000000..6866c4d0
--- /dev/null
+++ b/Providers/Resgrid.Providers.Messaging/MessagingProviderModule.cs
@@ -0,0 +1,13 @@
+using Autofac;
+using Resgrid.Model.Providers;
+
+namespace Resgrid.Providers.Messaging
+{
+ public class MessagingProviderModule : Module
+ {
+ protected override void Load(ContainerBuilder builder)
+ {
+ builder.RegisterType().As().InstancePerLifetimeScope();
+ }
+ }
+}
diff --git a/Providers/Resgrid.Providers.Messaging/NovuProvider.cs b/Providers/Resgrid.Providers.Messaging/NovuProvider.cs
new file mode 100644
index 00000000..8a40ea16
--- /dev/null
+++ b/Providers/Resgrid.Providers.Messaging/NovuProvider.cs
@@ -0,0 +1,50 @@
+using Novu;
+using Novu.Domain.Models.Subscribers;
+using Resgrid.Framework;
+using Resgrid.Model.Providers;
+
+namespace Resgrid.Providers.Messaging
+{
+ public class NovuProvider: INovuProvider
+ {
+ public async Task CreateSubscriber(string userId, int departmentId, string email, string firstName, string lastName)
+ {
+ try
+ {
+ var novuConfiguration = new NovuClientConfiguration
+ {
+ Url = Config.ChatConfig.NovuBackendUrl, //"https://novu-api.my-domain.com/v1",
+ ApiKey = Config.ChatConfig.NovuSecretKey //"12345",
+ };
+
+ var novu = new NovuClient(novuConfiguration);
+
+ var subscriberCreateData = new SubscriberCreateData();
+ subscriberCreateData.SubscriberId = userId;
+ subscriberCreateData.FirstName = firstName;
+ subscriberCreateData.LastName = lastName;
+ subscriberCreateData.Email = email;
+ subscriberCreateData.Data = new List();
+ subscriberCreateData.Data.Add(new AdditionalData
+ {
+ Key = "DepartmentId",
+ Value = departmentId.ToString()
+ });
+
+ var subscriber = await novu.Subscriber.Create(subscriberCreateData);
+
+ if (subscriber != null && subscriber.Data != null)
+ return true;
+
+ return false;
+ }
+ catch (Exception e)
+ {
+ Logging.LogException(e, "Failed to create novu subscriber");
+ return false;
+ }
+ }
+
+
+ }
+}
diff --git a/Providers/Resgrid.Providers.Messaging/Resgrid.Providers.Messaging.csproj b/Providers/Resgrid.Providers.Messaging/Resgrid.Providers.Messaging.csproj
index af6c391b..1c863998 100644
--- a/Providers/Resgrid.Providers.Messaging/Resgrid.Providers.Messaging.csproj
+++ b/Providers/Resgrid.Providers.Messaging/Resgrid.Providers.Messaging.csproj
@@ -7,6 +7,8 @@
+
+
@@ -14,4 +16,9 @@
+
+
+
+
+
diff --git a/Providers/Resgrid.Providers.Migrations/Migrations/M0032_AddingContacts.cs b/Providers/Resgrid.Providers.Migrations/Migrations/M0032_AddingContacts.cs
new file mode 100644
index 00000000..7d04ebf6
--- /dev/null
+++ b/Providers/Resgrid.Providers.Migrations/Migrations/M0032_AddingContacts.cs
@@ -0,0 +1,169 @@
+using FluentMigrator;
+using System;
+
+namespace Resgrid.Providers.Migrations.Migrations
+{
+ [Migration(32)]
+ public class M0032_AddingContacts : Migration
+ {
+ public override void Up()
+ {
+ //.ForeignKey("FK_Conacts_Departments");
+ Delete.Table("Contacts");
+
+ Create.Table("Contacts")
+ .WithColumn("ContactId").AsString(128).NotNullable().PrimaryKey()
+ .WithColumn("DepartmentId").AsInt32().NotNullable()
+ .WithColumn("ContactType").AsInt32()
+ .WithColumn("ContactCategoryId").AsString(128)
+ .WithColumn("FirstName").AsString()
+ .WithColumn("MiddleName").AsString()
+ .WithColumn("LastName").AsString()
+ .WithColumn("OtherName").AsString()
+ .WithColumn("CompanyName").AsString()
+ .WithColumn("Email").AsString()
+ .WithColumn("PhysicalAddressId").AsInt32()
+ .WithColumn("MailingAddressId").AsInt32()
+ .WithColumn("Website").AsString()
+ .WithColumn("Twitter").AsString()
+ .WithColumn("Facebook").AsString()
+ .WithColumn("LinkedIn").AsString()
+ .WithColumn("Instagram").AsString()
+ .WithColumn("Threads").AsString()
+ .WithColumn("Bluesky").AsString()
+ .WithColumn("Mastodon").AsString()
+ .WithColumn("LocationGpsCoordinates").AsString()
+ .WithColumn("EntranceGpsCoordinates").AsString()
+ .WithColumn("ExitGpsCoordinates").AsString()
+ .WithColumn("LocationGeofence").AsString()
+ .WithColumn("CountryIssuedIdNumber").AsString()
+ .WithColumn("CountryIdName").AsString()
+ .WithColumn("StateIdNumber").AsString()
+ .WithColumn("StateIdName").AsString()
+ .WithColumn("StateIdCountryName").AsString()
+ .WithColumn("Description").AsString()
+ .WithColumn("OtherInfo").AsString()
+ .WithColumn("HomePhoneNumber").AsString()
+ .WithColumn("CellPhoneNumber").AsString()
+ .WithColumn("FaxPhoneNumber").AsString()
+ .WithColumn("OfficePhoneNumber").AsString()
+ .WithColumn("Image").AsBinary()
+ .WithColumn("IsDeleted").AsBoolean()
+ .WithColumn("AddedOn").AsDateTime2().NotNullable()
+ .WithColumn("AddedByUserId").AsString(128).NotNullable()
+ .WithColumn("EditedOn").AsDateTime2()
+ .WithColumn("EditedByUserId").AsString(128);
+
+ Create.ForeignKey("FK_Contacts_Department")
+ .FromTable("Contacts").ForeignColumn("DepartmentId")
+ .ToTable("Departments").PrimaryColumn("DepartmentId");
+
+ Create.ForeignKey("FK_Contacts_PhysicalAddress")
+ .FromTable("Contacts").ForeignColumn("PhysicalAddressId")
+ .ToTable("Addresses").PrimaryColumn("AddressId");
+
+ Create.ForeignKey("FK_Contacts_MailingAddress")
+ .FromTable("Contacts").ForeignColumn("MailingAddressId")
+ .ToTable("Addresses").PrimaryColumn("AddressId");
+
+ Create.Table("ContactNoteTypes")
+ .WithColumn("ContactNoteTypeId").AsString(128).NotNullable().PrimaryKey()
+ .WithColumn("DepartmentId").AsInt32().NotNullable()
+ .WithColumn("Name").AsString().NotNullable()
+ .WithColumn("Color").AsString()
+ .WithColumn("DefaultShouldAlert").AsBoolean()
+ .WithColumn("DefaultVisibility").AsInt32()
+ .WithColumn("AddedOn").AsDateTime2().NotNullable()
+ .WithColumn("AddedByUserId").AsString(128).NotNullable()
+ .WithColumn("EditedOn").AsDateTime2()
+ .WithColumn("EditedByUserId").AsString(128);
+
+ Create.ForeignKey("FK_ContactNoteTypes_Department")
+ .FromTable("ContactNoteTypes").ForeignColumn("DepartmentId")
+ .ToTable("Departments").PrimaryColumn("DepartmentId");
+
+ Create.Table("ContactNotes")
+ .WithColumn("ContactNoteId").AsString(128).NotNullable().PrimaryKey()
+ .WithColumn("DepartmentId").AsInt32().NotNullable()
+ .WithColumn("ContactId").AsString(128).NotNullable()
+ .WithColumn("ContactNoteTypeId").AsString(128)
+ .WithColumn("Note").AsString().NotNullable()
+ .WithColumn("Color").AsString()
+ .WithColumn("ShouldAlert").AsBoolean()
+ .WithColumn("Visibility").AsInt32()
+ .WithColumn("ExpiresOn").AsDateTime2()
+ .WithColumn("IsDeleted").AsBoolean().NotNullable()
+ .WithColumn("AddedOn").AsDateTime2().NotNullable()
+ .WithColumn("AddedByUserId").AsString(128).NotNullable()
+ .WithColumn("EditedOn").AsDateTime2()
+ .WithColumn("EditedByUserId").AsString(128);
+
+ Create.ForeignKey("FK_ContactNotes_Department")
+ .FromTable("ContactNotes").ForeignColumn("DepartmentId")
+ .ToTable("Departments").PrimaryColumn("DepartmentId");
+
+ Create.ForeignKey("FK_ContactNotes_Contacts")
+ .FromTable("ContactNotes").ForeignColumn("ContactId")
+ .ToTable("Contacts").PrimaryColumn("ContactId");
+
+ Create.Table("ContactAssociations")
+ .WithColumn("ContactAssociationId").AsString(128).NotNullable().PrimaryKey()
+ .WithColumn("DepartmentId").AsInt32().NotNullable()
+ .WithColumn("SourceContactId").AsString(128).NotNullable()
+ .WithColumn("TargetContactId").AsString(128).NotNullable()
+ .WithColumn("Type").AsInt32()
+ .WithColumn("Note").AsString().Nullable()
+ .WithColumn("AddedOn").AsDateTime2().NotNullable()
+ .WithColumn("AddedByUserId").AsString(128).NotNullable();
+
+ Create.ForeignKey("FK_ContactAssociations_Department")
+ .FromTable("ContactAssociations").ForeignColumn("DepartmentId")
+ .ToTable("Departments").PrimaryColumn("DepartmentId");
+
+ Create.ForeignKey("FK_ContactAssociations_SourceContactId")
+ .FromTable("ContactAssociations").ForeignColumn("SourceContactId")
+ .ToTable("Contacts").PrimaryColumn("ContactId");
+
+ Create.ForeignKey("FK_ContactAssociations_TargetContactId")
+ .FromTable("ContactAssociations").ForeignColumn("TargetContactId")
+ .ToTable("Contacts").PrimaryColumn("ContactId");
+
+ Create.Table("CallContacts")
+ .WithColumn("CallContactId").AsString(128).NotNullable().PrimaryKey()
+ .WithColumn("DepartmentId").AsInt32().NotNullable()
+ .WithColumn("CallId").AsInt32().NotNullable()
+ .WithColumn("ContactId").AsString(128).NotNullable()
+ .WithColumn("CallContactType").AsInt32();
+
+ Create.ForeignKey("FK_CallContacts_Department")
+ .FromTable("CallContacts").ForeignColumn("DepartmentId")
+ .ToTable("Departments").PrimaryColumn("DepartmentId");
+
+ Create.ForeignKey("FK_CallContacts_Contacts")
+ .FromTable("Contacts").ForeignColumn("ContactId")
+ .ToTable("Contacts").PrimaryColumn("ContactId");
+
+ Create.Table("ContactCategories")
+ .WithColumn("ContactCategoryId").AsString(128).NotNullable().PrimaryKey()
+ .WithColumn("DepartmentId").AsInt32().NotNullable()
+ .WithColumn("Name").AsString().NotNullable()
+ .WithColumn("Description").AsString().Nullable()
+ .WithColumn("Color").AsString()
+ .WithColumn("DisplayOnMap").AsBoolean().NotNullable()
+ .WithColumn("MapIcon").AsInt32().Nullable()
+ .WithColumn("AddedOn").AsDateTime2().NotNullable()
+ .WithColumn("AddedByUserId").AsString(128).NotNullable()
+ .WithColumn("EditedOn").AsDateTime2()
+ .WithColumn("EditedByUserId").AsString(128);
+
+ Create.ForeignKey("FK_ContactCategories_Department")
+ .FromTable("ContactCategories").ForeignColumn("DepartmentId")
+ .ToTable("Departments").PrimaryColumn("DepartmentId");
+ }
+
+ public override void Down()
+ {
+
+ }
+ }
+}
diff --git a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0002_AddingContacts.cs b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0002_AddingContacts.cs
index f4a4b204..7aecb453 100644
--- a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0002_AddingContacts.cs
+++ b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0002_AddingContacts.cs
@@ -7,28 +7,28 @@ public class M0002_AddingContacts : Migration
{
public override void Up()
{
- Create.Table("Contacts")
- .WithColumn("ContactId").AsInt32().NotNullable().PrimaryKey().Identity()
- .WithColumn("DepartmentId").AsInt32().NotNullable()
- .WithColumn("ContactTypeId").AsInt32()
- .WithColumn("Name").AsCustom("citext").NotNullable()
- .WithColumn("PhoneNumber").AsCustom("citext")
- .WithColumn("FaxNumber").AsCustom("citext")
- .WithColumn("Email").AsCustom("citext")
- .WithColumn("Twitter").AsCustom("citext")
- .WithColumn("Facebook").AsCustom("citext")
- .WithColumn("Notes").AsCustom("citext")
- .WithColumn("Address").AsCustom("citext")
- .WithColumn("City").AsCustom("citext")
- .WithColumn("State").AsCustom("citext")
- .WithColumn("PostalCode").AsCustom("citext")
- .WithColumn("Country").AsCustom("citext")
- .WithColumn("Location").AsCustom("citext");
+ Create.Table("Contacts".ToLower())
+ .WithColumn("ContactId".ToLower()).AsInt32().NotNullable().PrimaryKey().Identity()
+ .WithColumn("DepartmentId".ToLower()).AsInt32().NotNullable()
+ .WithColumn("ContactTypeId".ToLower()).AsInt32()
+ .WithColumn("Name".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("PhoneNumber".ToLower()).AsCustom("citext")
+ .WithColumn("FaxNumber".ToLower()).AsCustom("citext")
+ .WithColumn("Email".ToLower()).AsCustom("citext")
+ .WithColumn("Twitter".ToLower()).AsCustom("citext")
+ .WithColumn("Facebook".ToLower()).AsCustom("citext")
+ .WithColumn("Notes".ToLower()).AsCustom("citext")
+ .WithColumn("Address".ToLower()).AsCustom("citext")
+ .WithColumn("City".ToLower()).AsCustom("citext")
+ .WithColumn("State".ToLower()).AsCustom("citext")
+ .WithColumn("PostalCode".ToLower()).AsCustom("citext")
+ .WithColumn("Country".ToLower()).AsCustom("citext")
+ .WithColumn("Location".ToLower()).AsCustom("citext");
Create.ForeignKey("FK_Conacts_Departments")
- .FromTable("Contacts").ForeignColumn("DepartmentId")
- .ToTable("Departments").PrimaryColumn("DepartmentId");
+ .FromTable("Contacts".ToLower()).ForeignColumn("DepartmentId".ToLower())
+ .ToTable("Departments".ToLower()).PrimaryColumn("DepartmentId");
}
public override void Down()
diff --git a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0003_AddingUnitActiveRoles.cs b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0003_AddingUnitActiveRoles.cs
index d06469e2..e8d6ef6d 100644
--- a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0003_AddingUnitActiveRoles.cs
+++ b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0003_AddingUnitActiveRoles.cs
@@ -7,22 +7,22 @@ public class M0003_AddingUnitActiveRoles : Migration
{
public override void Up()
{
- Create.Table("UnitActiveRoles")
- .WithColumn("UnitActiveRoleId").AsInt32().NotNullable().PrimaryKey().Identity()
- .WithColumn("DepartmentId").AsInt32().NotNullable()
- .WithColumn("UnitId").AsInt32().NotNullable()
- .WithColumn("Role").AsCustom("citext").NotNullable()
- .WithColumn("UserId").AsCustom("citext").NotNullable()
- .WithColumn("UpdatedOn").AsDateTime().NotNullable()
- .WithColumn("UpdatedBy").AsCustom("citext").NotNullable();
+ Create.Table("UnitActiveRoles".ToLower())
+ .WithColumn("UnitActiveRoleId".ToLower()).AsInt32().NotNullable().PrimaryKey().Identity()
+ .WithColumn("DepartmentId".ToLower()).AsInt32().NotNullable()
+ .WithColumn("UnitId".ToLower()).AsInt32().NotNullable()
+ .WithColumn("Role".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("UserId".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("UpdatedOn".ToLower()).AsDateTime().NotNullable()
+ .WithColumn("UpdatedBy".ToLower()).AsCustom("citext").NotNullable();
Create.ForeignKey("FK_UnitActiveRoles_Departments")
- .FromTable("UnitActiveRoles").ForeignColumn("DepartmentId")
- .ToTable("Departments").PrimaryColumn("DepartmentId");
+ .FromTable("UnitActiveRoles".ToLower()).ForeignColumn("DepartmentId".ToLower())
+ .ToTable("Departments".ToLower()).PrimaryColumn("DepartmentId".ToLower());
Create.ForeignKey("FK_UnitActiveRoles_Units")
- .FromTable("UnitActiveRoles").ForeignColumn("UnitId")
- .ToTable("Units").PrimaryColumn("UnitId");
+ .FromTable("UnitActiveRoles".ToLower()).ForeignColumn("UnitId".ToLower())
+ .ToTable("Units".ToLower()).PrimaryColumn("UnitId".ToLower());
}
public override void Down()
diff --git a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0004_AddingSortToTemplates.cs b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0004_AddingSortToTemplates.cs
index 22dfac41..baf24ea8 100644
--- a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0004_AddingSortToTemplates.cs
+++ b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0004_AddingSortToTemplates.cs
@@ -7,7 +7,7 @@ public class M0004_AddingSortToTemplates : Migration
{
public override void Up()
{
- Alter.Table("CallQuickTemplates").AddColumn("Sort").AsInt32().Nullable();
+ Alter.Table("CallQuickTemplates".ToLower()).AddColumn("Sort".ToLower()).AsInt32().Nullable();
}
public override void Down()
diff --git a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0005_AddingForms.cs b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0005_AddingForms.cs
index 004e0a63..b5fbeb5f 100644
--- a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0005_AddingForms.cs
+++ b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0005_AddingForms.cs
@@ -8,35 +8,35 @@ public class M0005_AddingForms : Migration
{
public override void Up()
{
- Create.Table("Forms")
- .WithColumn("FormId").AsCustom("citext").NotNullable().PrimaryKey()
- .WithColumn("DepartmentId").AsInt32().NotNullable()
- .WithColumn("Type").AsInt32().NotNullable()
- .WithColumn("Name").AsCustom("citext").NotNullable()
- .WithColumn("IsActive").AsBoolean()
- .WithColumn("IsDeleted").AsBoolean()
- .WithColumn("Data").AsCustom("citext")
- .WithColumn("CreatedOn").AsDateTime2()
- .WithColumn("CreatedBy").AsCustom("citext")
- .WithColumn("UpdatedOn").AsDateTime2()
- .WithColumn("UpdatedBy").AsCustom("citext");
+ Create.Table("Forms".ToLower())
+ .WithColumn("FormId".ToLower()).AsCustom("citext").NotNullable().PrimaryKey()
+ .WithColumn("DepartmentId".ToLower()).AsInt32().NotNullable()
+ .WithColumn("Type".ToLower()).AsInt32().NotNullable()
+ .WithColumn("Name".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("IsActive".ToLower()).AsBoolean()
+ .WithColumn("IsDeleted".ToLower()).AsBoolean()
+ .WithColumn("Data".ToLower()).AsCustom("citext")
+ .WithColumn("CreatedOn".ToLower()).AsDateTime2()
+ .WithColumn("CreatedBy".ToLower()).AsCustom("citext")
+ .WithColumn("UpdatedOn".ToLower()).AsDateTime2()
+ .WithColumn("UpdatedBy".ToLower()).AsCustom("citext");
- Create.Table("FormAutomations")
- .WithColumn("FormAutomationId").AsCustom("citext").NotNullable().PrimaryKey()
- .WithColumn("FormId").AsCustom("citext").NotNullable()
- .WithColumn("TriggerField").AsCustom("citext").NotNullable()
- .WithColumn("TriggerValue").AsCustom("citext")
- .WithColumn("OperationType").AsInt32().NotNullable()
- .WithColumn("OperationValue").AsCustom("citext");
+ Create.Table("FormAutomations".ToLower())
+ .WithColumn("FormAutomationId".ToLower()).AsCustom("citext").NotNullable().PrimaryKey()
+ .WithColumn("FormId".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("TriggerField".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("TriggerValue".ToLower()).AsCustom("citext")
+ .WithColumn("OperationType".ToLower()).AsInt32().NotNullable()
+ .WithColumn("OperationValue".ToLower()).AsCustom("citext");
Create.ForeignKey("FK_Forms_Departments")
- .FromTable("Forms").ForeignColumn("DepartmentId")
- .ToTable("Departments").PrimaryColumn("DepartmentId");
+ .FromTable("Forms".ToLower()).ForeignColumn("DepartmentId".ToLower())
+ .ToTable("Departments".ToLower()).PrimaryColumn("DepartmentId".ToLower());
Create.ForeignKey("FK_FormAutomations_Forms")
- .FromTable("FormAutomations").ForeignColumn("FormId")
- .ToTable("Forms").PrimaryColumn("FormId");
+ .FromTable("FormAutomations".ToLower()).ForeignColumn("FormId".ToLower())
+ .ToTable("Forms".ToLower()).PrimaryColumn("FormId".ToLower());
}
public override void Down()
diff --git a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0006_AddingFormDataToCalls.cs b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0006_AddingFormDataToCalls.cs
index 0f10b76e..20f058cd 100644
--- a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0006_AddingFormDataToCalls.cs
+++ b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0006_AddingFormDataToCalls.cs
@@ -8,8 +8,8 @@ public class M0006_AddingFormDataToCalls : Migration
{
public override void Up()
{
- Alter.Table("Calls").AddColumn("CallFormData").AsCustom("citext").Nullable();
- Alter.Table("Calls").AddColumn("ContactId").AsInt32().Nullable();
+ Alter.Table("Calls".ToLower()).AddColumn("CallFormData".ToLower()).AsCustom("citext").Nullable();
+ Alter.Table("Calls".ToLower()).AddColumn("ContactId".ToLower()).AsInt32().Nullable();
}
public override void Down()
diff --git a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0007_AddingDispatchOnToCalls.cs b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0007_AddingDispatchOnToCalls.cs
index ca5a983a..87ce4982 100644
--- a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0007_AddingDispatchOnToCalls.cs
+++ b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0007_AddingDispatchOnToCalls.cs
@@ -8,8 +8,8 @@ public class M0007_AddingDispatchOnToCalls : Migration
{
public override void Up()
{
- Alter.Table("Calls").AddColumn("DispatchOn").AsDateTime2().Nullable();
- Alter.Table("Calls").AddColumn("HasBeenDispatched").AsBoolean().Nullable();
+ Alter.Table("Calls".ToLower()).AddColumn("DispatchOn".ToLower()).AsDateTime2().Nullable();
+ Alter.Table("Calls".ToLower()).AddColumn("HasBeenDispatched".ToLower()).AsBoolean().Nullable();
}
public override void Down()
diff --git a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0008_AddingAddonsInvoices.cs b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0008_AddingAddonsInvoices.cs
index a04289ea..242be1e1 100644
--- a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0008_AddingAddonsInvoices.cs
+++ b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0008_AddingAddonsInvoices.cs
@@ -15,43 +15,43 @@ public override void Up()
// Finish Adding in Invoice limits
- Create.Table("PlanAddons")
- .WithColumn("PlanAddonId").AsCustom("citext").NotNullable().PrimaryKey()
- .WithColumn("PlanId").AsInt32().NotNullable()
- .WithColumn("AddonType").AsInt32().NotNullable()
- .WithColumn("Cost").AsDecimal().NotNullable()
- .WithColumn("ExternalId").AsCustom("citext");
+ Create.Table("PlanAddons".ToLower())
+ .WithColumn("PlanAddonId".ToLower()).AsCustom("citext").NotNullable().PrimaryKey()
+ .WithColumn("PlanId".ToLower()).AsInt32().NotNullable()
+ .WithColumn("AddonType".ToLower()).AsInt32().NotNullable()
+ .WithColumn("Cost".ToLower()).AsDecimal().NotNullable()
+ .WithColumn("ExternalId".ToLower()).AsCustom("citext");
Create.ForeignKey("FK_PlanAddons_Plans")
- .FromTable("PlanAddons").ForeignColumn("PlanId")
- .ToTable("Plans").PrimaryColumn("PlanId");
+ .FromTable("PlanAddons".ToLower()).ForeignColumn("PlanId".ToLower())
+ .ToTable("Plans".ToLower()).PrimaryColumn("PlanId".ToLower());
// Standard Plan PTT Addon
Insert.IntoTable("PlanAddons").Row(new { PlanAddonId = "456ed5d4-57e1-4882-b433-1d3cc239103d", PlanId = 1, AddonType = 1, Cost = 0, ExternalId = "" });
- Create.Table("PaymentAddons")
- .WithColumn("PaymentAddonId").AsCustom("citext").NotNullable().PrimaryKey()
- .WithColumn("DepartmentId").AsInt32().NotNullable()
- .WithColumn("PlanAddonId").AsCustom("citext").NotNullable()
- .WithColumn("PurchaseOn").AsDateTime2().NotNullable()
- .WithColumn("EffectiveOn").AsDateTime2().NotNullable()
- .WithColumn("EndingOn").AsDateTime2().NotNullable()
- .WithColumn("Amount").AsDecimal().NotNullable()
- .WithColumn("Description").AsCustom("citext").NotNullable()
- .WithColumn("TransactionId").AsCustom("citext").NotNullable()
- .WithColumn("SubscriptionId").AsCustom("citext").NotNullable()
- .WithColumn("Data").AsCustom("citext").NotNullable()
- .WithColumn("IsCancelled").AsBoolean().Nullable()
- .WithColumn("CancelledOn").AsDateTime2().Nullable()
- .WithColumn("CancelledData").AsCustom("citext").Nullable();
+ Create.Table("PaymentAddons".ToLower())
+ .WithColumn("PaymentAddonId".ToLower()).AsCustom("citext").NotNullable().PrimaryKey()
+ .WithColumn("DepartmentId".ToLower()).AsInt32().NotNullable()
+ .WithColumn("PlanAddonId".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("PurchaseOn".ToLower()).AsDateTime2().NotNullable()
+ .WithColumn("EffectiveOn".ToLower()).AsDateTime2().NotNullable()
+ .WithColumn("EndingOn".ToLower()).AsDateTime2().NotNullable()
+ .WithColumn("Amount".ToLower()).AsDecimal().NotNullable()
+ .WithColumn("Description".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("TransactionId".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("SubscriptionId".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("Data".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("IsCancelled".ToLower()).AsBoolean().Nullable()
+ .WithColumn("CancelledOn".ToLower()).AsDateTime2().Nullable()
+ .WithColumn("CancelledData".ToLower()).AsCustom("citext").Nullable();
Create.ForeignKey("FK_PaymentAddons_Departments")
- .FromTable("PaymentAddons").ForeignColumn("DepartmentId")
- .ToTable("Departments").PrimaryColumn("DepartmentId");
+ .FromTable("PaymentAddons".ToLower()).ForeignColumn("DepartmentId".ToLower())
+ .ToTable("Departments".ToLower()).PrimaryColumn("DepartmentId".ToLower());
Create.ForeignKey("FK_PaymentAddons_PlanAddons")
- .FromTable("PaymentAddons").ForeignColumn("PlanAddonId")
- .ToTable("PlanAddons").PrimaryColumn("PlanAddonId");
+ .FromTable("PaymentAddons".ToLower()).ForeignColumn("PlanAddonId".ToLower())
+ .ToTable("PlanAddons".ToLower()).PrimaryColumn("PlanAddonId".ToLower());
}
public override void Down()
diff --git a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0009_AddingDepartmentVoice.cs b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0009_AddingDepartmentVoice.cs
index 479cfb99..57536bea 100644
--- a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0009_AddingDepartmentVoice.cs
+++ b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0009_AddingDepartmentVoice.cs
@@ -8,43 +8,43 @@ public class M0009_AddingDepartmentVoice : Migration
{
public override void Up()
{
- Create.Table("DepartmentVoices")
- .WithColumn("DepartmentVoiceId").AsCustom("citext").NotNullable().PrimaryKey()
- .WithColumn("DepartmentId").AsInt32().NotNullable()
- .WithColumn("StartConferenceNumber").AsInt32().NotNullable();
+ Create.Table("DepartmentVoices".ToLower())
+ .WithColumn("DepartmentVoiceId".ToLower()).AsCustom("citext").NotNullable().PrimaryKey()
+ .WithColumn("DepartmentId".ToLower()).AsInt32().NotNullable()
+ .WithColumn("StartConferenceNumber".ToLower()).AsInt32().NotNullable();
Create.ForeignKey("FK_DepartmentVoices_Department")
- .FromTable("DepartmentVoices").ForeignColumn("DepartmentId")
- .ToTable("Departments").PrimaryColumn("DepartmentId");
-
- Create.Table("DepartmentVoiceChannels")
- .WithColumn("DepartmentVoiceChannelId").AsCustom("citext").NotNullable().PrimaryKey()
- .WithColumn("DepartmentVoiceId").AsCustom("citext").NotNullable()
- .WithColumn("DepartmentId").AsInt32().NotNullable()
- .WithColumn("Name").AsCustom("citext")
- .WithColumn("SystemConferenceId").AsCustom("citext")
- .WithColumn("SystemCallflowId").AsCustom("citext")
- .WithColumn("ConferenceNumber").AsInt32()
- .WithColumn("IsDefault").AsBoolean();
+ .FromTable("DepartmentVoices".ToLower()).ForeignColumn("DepartmentId".ToLower())
+ .ToTable("Departments".ToLower()).PrimaryColumn("DepartmentId".ToLower());
+
+ Create.Table("DepartmentVoiceChannels".ToLower())
+ .WithColumn("DepartmentVoiceChannelId".ToLower()).AsCustom("citext").NotNullable().PrimaryKey()
+ .WithColumn("DepartmentVoiceId".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("DepartmentId".ToLower()).AsInt32().NotNullable()
+ .WithColumn("Name".ToLower()).AsCustom("citext")
+ .WithColumn("SystemConferenceId".ToLower()).AsCustom("citext")
+ .WithColumn("SystemCallflowId".ToLower()).AsCustom("citext")
+ .WithColumn("ConferenceNumber".ToLower()).AsInt32()
+ .WithColumn("IsDefault".ToLower()).AsBoolean();
Create.ForeignKey("FK_DepartmentVoiceChannels_Department")
- .FromTable("DepartmentVoiceChannels").ForeignColumn("DepartmentId")
- .ToTable("Departments").PrimaryColumn("DepartmentId");
+ .FromTable("DepartmentVoiceChannels".ToLower()).ForeignColumn("DepartmentId".ToLower())
+ .ToTable("Departments".ToLower()).PrimaryColumn("DepartmentId".ToLower());
Create.ForeignKey("FK_DepartmentVoiceChannels_DepartmentVoices")
- .FromTable("DepartmentVoiceChannels").ForeignColumn("DepartmentVoiceId")
- .ToTable("DepartmentVoices").PrimaryColumn("DepartmentVoiceId");
+ .FromTable("DepartmentVoiceChannels".ToLower()).ForeignColumn("DepartmentVoiceId".ToLower())
+ .ToTable("DepartmentVoices".ToLower()).PrimaryColumn("DepartmentVoiceId".ToLower());
- Create.Table("DepartmentVoiceUsers")
- .WithColumn("DepartmentVoiceUserId").AsCustom("citext").NotNullable().PrimaryKey()
- .WithColumn("DepartmentVoiceId").AsCustom("citext").NotNullable()
- .WithColumn("UserId").AsCustom("citext").NotNullable()
- .WithColumn("SystemUserId").AsCustom("citext")
- .WithColumn("SystemDeviceId").AsCustom("citext");
+ Create.Table("DepartmentVoiceUsers".ToLower())
+ .WithColumn("DepartmentVoiceUserId".ToLower()).AsCustom("citext").NotNullable().PrimaryKey()
+ .WithColumn("DepartmentVoiceId".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("UserId".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("SystemUserId".ToLower()).AsCustom("citext")
+ .WithColumn("SystemDeviceId".ToLower()).AsCustom("citext");
Create.ForeignKey("FK_DepartmentVoiceUsers_DepartmentVoices")
- .FromTable("DepartmentVoiceUsers").ForeignColumn("DepartmentVoiceId")
- .ToTable("DepartmentVoices").PrimaryColumn("DepartmentVoiceId");
+ .FromTable("DepartmentVoiceUsers".ToLower()).ForeignColumn("DepartmentVoiceId".ToLower())
+ .ToTable("DepartmentVoices".ToLower()).PrimaryColumn("DepartmentVoiceId".ToLower());
}
diff --git a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0010_AddingSystemAudits.cs b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0010_AddingSystemAudits.cs
index 37ffb3ac..dc273466 100644
--- a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0010_AddingSystemAudits.cs
+++ b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0010_AddingSystemAudits.cs
@@ -8,18 +8,18 @@ public class M0010_AddingSystemAudits : Migration
{
public override void Up()
{
- Create.Table("SystemAudits")
- .WithColumn("SystemAuditId").AsCustom("citext").NotNullable().PrimaryKey()
- .WithColumn("DepartmentId").AsInt32().Nullable()
- .WithColumn("Type").AsInt32().NotNullable()
- .WithColumn("System").AsInt32().NotNullable()
- .WithColumn("UserId").AsCustom("citext").Nullable()
- .WithColumn("Username").AsCustom("citext").Nullable()
- .WithColumn("IpAddress").AsCustom("citext")
- .WithColumn("Data").AsCustom("citext")
- .WithColumn("Successful").AsBoolean().NotNullable()
- .WithColumn("ServerName").AsCustom("citext")
- .WithColumn("LoggedOn").AsDateTime2().NotNullable();
+ Create.Table("SystemAudits".ToLower())
+ .WithColumn("SystemAuditId".ToLower()).AsCustom("citext").NotNullable().PrimaryKey()
+ .WithColumn("DepartmentId".ToLower()).AsInt32().Nullable()
+ .WithColumn("Type".ToLower()).AsInt32().NotNullable()
+ .WithColumn("System".ToLower()).AsInt32().NotNullable()
+ .WithColumn("UserId".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("Username".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("IpAddress".ToLower()).AsCustom("citext")
+ .WithColumn("Data".ToLower()).AsCustom("citext")
+ .WithColumn("Successful".ToLower()).AsBoolean().NotNullable()
+ .WithColumn("ServerName".ToLower()).AsCustom("citext")
+ .WithColumn("LoggedOn".ToLower()).AsDateTime2().NotNullable();
}
public override void Down()
diff --git a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0011_AddingAutofills.cs b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0011_AddingAutofills.cs
index efcd87e5..e42c8e78 100644
--- a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0011_AddingAutofills.cs
+++ b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0011_AddingAutofills.cs
@@ -8,15 +8,15 @@ public class M0011_AddingAutofills : Migration
{
public override void Up()
{
- Create.Table("Autofills")
- .WithColumn("AutofillId").AsCustom("citext").NotNullable().PrimaryKey()
- .WithColumn("DepartmentId").AsInt32().Nullable()
- .WithColumn("Type").AsInt32().NotNullable()
- .WithColumn("Sort").AsInt32().NotNullable()
- .WithColumn("Name").AsCustom("citext")
- .WithColumn("Data").AsCustom("citext")
- .WithColumn("AddedByUserId").AsCustom("citext").Nullable()
- .WithColumn("AddedOn").AsDateTime2().NotNullable();
+ Create.Table("Autofills".ToLower())
+ .WithColumn("AutofillId".ToLower()).AsCustom("citext").NotNullable().PrimaryKey()
+ .WithColumn("DepartmentId".ToLower()).AsInt32().Nullable()
+ .WithColumn("Type".ToLower()).AsInt32().NotNullable()
+ .WithColumn("Sort".ToLower()).AsInt32().NotNullable()
+ .WithColumn("Name".ToLower()).AsCustom("citext")
+ .WithColumn("Data".ToLower()).AsCustom("citext")
+ .WithColumn("AddedByUserId".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("AddedOn".ToLower()).AsDateTime2().NotNullable();
}
public override void Down()
diff --git a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0012_UpdatingUnitCallTypes.cs b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0012_UpdatingUnitCallTypes.cs
index e6101e2b..f2ad92cb 100644
--- a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0012_UpdatingUnitCallTypes.cs
+++ b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0012_UpdatingUnitCallTypes.cs
@@ -8,8 +8,8 @@ public class M0012_UpdatingUnitCallTypes : Migration
{
public override void Up()
{
- Alter.Table("UnitTypes").AddColumn("MapIconType").AsInt32().Nullable();
- Alter.Table("CallTypes").AddColumn("MapIconType").AsInt32().Nullable();
+ Alter.Table("UnitTypes".ToLower()).AddColumn("MapIconType".ToLower()).AsInt32().Nullable();
+ Alter.Table("CallTypes".ToLower()).AddColumn("MapIconType".ToLower()).AsInt32().Nullable();
}
public override void Down()
diff --git a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0013_UpdatingLinkedCall.cs b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0013_UpdatingLinkedCall.cs
index 5af775f7..e0d70019 100644
--- a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0013_UpdatingLinkedCall.cs
+++ b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0013_UpdatingLinkedCall.cs
@@ -8,7 +8,7 @@ public class M0013_UpdatingLinkedCall : Migration
{
public override void Up()
{
- Alter.Table("Calls").AddColumn("LinkedCallId").AsInt32().Nullable();
+ Alter.Table("Calls".ToLower()).AddColumn("LinkedCallId".ToLower()).AsInt32().Nullable();
}
public override void Down()
diff --git a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0014_AddingWorkshifts.cs b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0014_AddingWorkshifts.cs
index 986a0a13..adab6edc 100644
--- a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0014_AddingWorkshifts.cs
+++ b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0014_AddingWorkshifts.cs
@@ -8,61 +8,61 @@ public class M0014_AddingWorkshifts : Migration
{
public override void Up()
{
- Create.Table("Workshifts")
- .WithColumn("WorkshiftId").AsCustom("citext").NotNullable().PrimaryKey()
- .WithColumn("DepartmentId").AsInt32().NotNullable()
- .WithColumn("Type").AsInt32().NotNullable()
- .WithColumn("Name").AsCustom("citext").NotNullable()
- .WithColumn("Color").AsCustom("citext").NotNullable()
- .WithColumn("Start").AsDateTime2().NotNullable()
- .WithColumn("End").AsDateTime2().NotNullable()
- .WithColumn("AddedOn").AsDateTime2().NotNullable()
- .WithColumn("AddedById").AsCustom("citext").NotNullable();
+ Create.Table("Workshifts".ToLower())
+ .WithColumn("WorkshiftId".ToLower()).AsCustom("citext").NotNullable().PrimaryKey()
+ .WithColumn("DepartmentId".ToLower()).AsInt32().NotNullable()
+ .WithColumn("Type".ToLower()).AsInt32().NotNullable()
+ .WithColumn("Name".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("Color".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("Start".ToLower()).AsDateTime2().NotNullable()
+ .WithColumn("End".ToLower()).AsDateTime2().NotNullable()
+ .WithColumn("AddedOn".ToLower()).AsDateTime2().NotNullable()
+ .WithColumn("AddedById".ToLower()).AsCustom("citext").NotNullable();
Create.ForeignKey("FK_Workshifts_Department")
- .FromTable("Workshifts").ForeignColumn("DepartmentId")
- .ToTable("Departments").PrimaryColumn("DepartmentId");
+ .FromTable("Workshifts".ToLower()).ForeignColumn("DepartmentId".ToLower())
+ .ToTable("Departments".ToLower()).PrimaryColumn("DepartmentId".ToLower());
- Create.Table("WorkshiftDays")
- .WithColumn("WorkshiftDayId").AsCustom("citext").NotNullable().PrimaryKey()
- .WithColumn("WorkshiftId").AsCustom("citext").NotNullable()
- .WithColumn("Day").AsDateTime2().NotNullable()
- .WithColumn("Processed").AsBoolean().NotNullable();
+ Create.Table("WorkshiftDays".ToLower())
+ .WithColumn("WorkshiftDayId".ToLower()).AsCustom("citext").NotNullable().PrimaryKey()
+ .WithColumn("WorkshiftId".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("Day".ToLower()).AsDateTime2().NotNullable()
+ .WithColumn("Processed".ToLower()).AsBoolean().NotNullable();
Create.ForeignKey("FK_WorkshiftDays_Workshifts")
- .FromTable("WorkshiftDays").ForeignColumn("WorkshiftId")
- .ToTable("Workshifts").PrimaryColumn("WorkshiftId");
+ .FromTable("WorkshiftDays".ToLower()).ForeignColumn("WorkshiftId".ToLower())
+ .ToTable("Workshifts".ToLower()).PrimaryColumn("WorkshiftId".ToLower());
- Create.Table("WorkshiftEntities")
- .WithColumn("WorkshiftEntityId").AsCustom("citext").NotNullable().PrimaryKey()
- .WithColumn("WorkshiftId").AsCustom("citext").NotNullable()
- .WithColumn("BackingId").AsCustom("citext").NotNullable();
+ Create.Table("WorkshiftEntities".ToLower())
+ .WithColumn("WorkshiftEntityId".ToLower()).AsCustom("citext").NotNullable().PrimaryKey()
+ .WithColumn("WorkshiftId".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("BackingId".ToLower()).AsCustom("citext").NotNullable();
Create.ForeignKey("FK_WorkshiftEntities_Workshifts")
- .FromTable("WorkshiftEntities").ForeignColumn("WorkshiftId")
- .ToTable("Workshifts").PrimaryColumn("WorkshiftId");
+ .FromTable("WorkshiftEntities".ToLower()).ForeignColumn("WorkshiftId".ToLower())
+ .ToTable("Workshifts".ToLower()).PrimaryColumn("WorkshiftId".ToLower());
- Create.Table("WorkshiftFills")
- .WithColumn("WorkshiftFillId").AsCustom("citext").NotNullable().PrimaryKey()
- .WithColumn("WorkshiftId").AsCustom("citext").NotNullable()
- .WithColumn("WorkshiftDayId").AsCustom("citext").NotNullable()
- .WithColumn("WorkshiftEntityId").AsCustom("citext").NotNullable()
- .WithColumn("FilledById").AsInt32().NotNullable()
- .WithColumn("Approved").AsBoolean().NotNullable()
- .WithColumn("AddedOn").AsDateTime2().NotNullable()
- .WithColumn("AddedById").AsCustom("citext").NotNullable();
+ Create.Table("WorkshiftFills".ToLower())
+ .WithColumn("WorkshiftFillId".ToLower()).AsCustom("citext").NotNullable().PrimaryKey()
+ .WithColumn("WorkshiftId".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("WorkshiftDayId".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("WorkshiftEntityId".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("FilledById".ToLower()).AsInt32().NotNullable()
+ .WithColumn("Approved".ToLower()).AsBoolean().NotNullable()
+ .WithColumn("AddedOn".ToLower()).AsDateTime2().NotNullable()
+ .WithColumn("AddedById".ToLower()).AsCustom("citext").NotNullable();
Create.ForeignKey("FK_WorkshiftFills_Workshifts")
- .FromTable("WorkshiftFills").ForeignColumn("WorkshiftId")
- .ToTable("Workshifts").PrimaryColumn("WorkshiftId");
+ .FromTable("WorkshiftFills".ToLower()).ForeignColumn("WorkshiftId".ToLower())
+ .ToTable("Workshifts".ToLower()).PrimaryColumn("WorkshiftId".ToLower());
Create.ForeignKey("FK_WorkshiftFills_WorkshiftDays")
- .FromTable("WorkshiftFills").ForeignColumn("WorkshiftDayId")
- .ToTable("WorkshiftDays").PrimaryColumn("WorkshiftDayId");
+ .FromTable("WorkshiftFills".ToLower()).ForeignColumn("WorkshiftDayId".ToLower())
+ .ToTable("WorkshiftDays".ToLower()).PrimaryColumn("WorkshiftDayId".ToLower());
Create.ForeignKey("FK_WorkshiftFills_WorkshiftEntities")
- .FromTable("WorkshiftFills").ForeignColumn("WorkshiftEntityId")
- .ToTable("WorkshiftEntities").PrimaryColumn("WorkshiftEntityId");
+ .FromTable("WorkshiftFills".ToLower()).ForeignColumn("WorkshiftEntityId".ToLower())
+ .ToTable("WorkshiftEntities".ToLower()).PrimaryColumn("WorkshiftEntityId".ToLower());
}
public override void Down()
diff --git a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0015_AddingMissingWorkshiftValues.cs b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0015_AddingMissingWorkshiftValues.cs
index 6e3f4c8b..42f3ef73 100644
--- a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0015_AddingMissingWorkshiftValues.cs
+++ b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0015_AddingMissingWorkshiftValues.cs
@@ -8,8 +8,8 @@ public class M0015_AddingMissingWorkshiftValues : Migration
{
public override void Up()
{
- Alter.Table("Workshifts").AddColumn("Description").AsCustom("citext").Nullable();
- Alter.Table("WorkshiftFills").AddColumn("ReferenceId").AsCustom("citext").Nullable();
+ Alter.Table("Workshifts".ToLower()).AddColumn("Description".ToLower()).AsCustom("citext").Nullable();
+ Alter.Table("WorkshiftFills".ToLower()).AddColumn("ReferenceId".ToLower()).AsCustom("citext").Nullable();
}
public override void Down()
diff --git a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0017_AddingToAuditTable.cs b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0017_AddingToAuditTable.cs
index 1b1660b8..ea536e8e 100644
--- a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0017_AddingToAuditTable.cs
+++ b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0017_AddingToAuditTable.cs
@@ -7,12 +7,12 @@ public class M0017_AddingToAuditTable : Migration
{
public override void Up()
{
- Alter.Table("AuditLogs").AddColumn("IpAddress").AsCustom("citext").Nullable();
- Alter.Table("AuditLogs").AddColumn("Successful").AsBoolean().Nullable();
- Alter.Table("AuditLogs").AddColumn("ObjectId").AsCustom("citext").Nullable();
- Alter.Table("AuditLogs").AddColumn("ObjectDepartmentId").AsInt32().Nullable();
- Alter.Table("AuditLogs").AddColumn("UserAgent").AsCustom("citext").Nullable();
- Alter.Table("AuditLogs").AddColumn("ServerName").AsCustom("citext").Nullable();
+ Alter.Table("AuditLogs".ToLower()).AddColumn("IpAddress".ToLower()).AsCustom("citext").Nullable();
+ Alter.Table("AuditLogs".ToLower()).AddColumn("Successful".ToLower()).AsBoolean().Nullable();
+ Alter.Table("AuditLogs".ToLower()).AddColumn("ObjectId".ToLower()).AsCustom("citext").Nullable();
+ Alter.Table("AuditLogs".ToLower()).AddColumn("ObjectDepartmentId".ToLower()).AsInt32().Nullable();
+ Alter.Table("AuditLogs".ToLower()).AddColumn("UserAgent".ToLower()).AsCustom("citext").Nullable();
+ Alter.Table("AuditLogs".ToLower()).AddColumn("ServerName".ToLower()).AsCustom("citext").Nullable();
}
public override void Down()
diff --git a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0018_AddingToCallNotesAndFiles.cs b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0018_AddingToCallNotesAndFiles.cs
index ef99f3ed..ce360a3c 100644
--- a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0018_AddingToCallNotesAndFiles.cs
+++ b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0018_AddingToCallNotesAndFiles.cs
@@ -7,26 +7,26 @@ public class M0018_AddingToCallNotesAndFiles : Migration
{
public override void Up()
{
- Alter.Table("CallAttachments").AddColumn("IsDeleted").AsBoolean().NotNullable().WithDefaultValue(false);
- Alter.Table("CallAttachments").AddColumn("IsFlagged").AsBoolean().NotNullable().WithDefaultValue(false);
- Alter.Table("CallAttachments").AddColumn("FlaggedReason").AsCustom("citext").Nullable();
- Alter.Table("CallAttachments").AddColumn("FlaggedByUserId").AsCustom("citext").Nullable();
- Alter.Table("CallAttachments").AddColumn("DeletedByUserId").AsCustom("citext").Nullable();
- Alter.Table("CallAttachments").AddColumn("FlaggedOn").AsDateTime2().Nullable();
- Alter.Table("CallAttachments").AddColumn("DeletedOn").AsDateTime2().Nullable();
+ Alter.Table("CallAttachments".ToLower()).AddColumn("IsDeleted".ToLower()).AsBoolean().NotNullable().WithDefaultValue(false);
+ Alter.Table("CallAttachments".ToLower()).AddColumn("IsFlagged".ToLower()).AsBoolean().NotNullable().WithDefaultValue(false);
+ Alter.Table("CallAttachments".ToLower()).AddColumn("FlaggedReason".ToLower()).AsCustom("citext").Nullable();
+ Alter.Table("CallAttachments".ToLower()).AddColumn("FlaggedByUserId".ToLower()).AsCustom("citext").Nullable();
+ Alter.Table("CallAttachments".ToLower()).AddColumn("DeletedByUserId".ToLower()).AsCustom("citext").Nullable();
+ Alter.Table("CallAttachments".ToLower()).AddColumn("FlaggedOn".ToLower()).AsDateTime2().Nullable();
+ Alter.Table("CallAttachments".ToLower()).AddColumn("DeletedOn".ToLower()).AsDateTime2().Nullable();
- Alter.Table("CallNotes").AddColumn("IsDeleted").AsBoolean().NotNullable().WithDefaultValue(false);
- Alter.Table("CallNotes").AddColumn("IsFlagged").AsBoolean().NotNullable().WithDefaultValue(false);
- Alter.Table("CallNotes").AddColumn("FlaggedReason").AsCustom("citext").Nullable();
- Alter.Table("CallNotes").AddColumn("FlaggedByUserId").AsCustom("citext").Nullable();
- Alter.Table("CallNotes").AddColumn("DeletedByUserId").AsCustom("citext").Nullable();
- Alter.Table("CallNotes").AddColumn("FlaggedOn").AsDateTime2().Nullable();
- Alter.Table("CallNotes").AddColumn("DeletedOn").AsDateTime2().Nullable();
+ Alter.Table("CallNotes".ToLower()).AddColumn("IsDeleted".ToLower()).AsBoolean().NotNullable().WithDefaultValue(false);
+ Alter.Table("CallNotes".ToLower()).AddColumn("IsFlagged".ToLower()).AsBoolean().NotNullable().WithDefaultValue(false);
+ Alter.Table("CallNotes".ToLower()).AddColumn("FlaggedReason".ToLower()).AsCustom("citext").Nullable();
+ Alter.Table("CallNotes".ToLower()).AddColumn("FlaggedByUserId".ToLower()).AsCustom("citext").Nullable();
+ Alter.Table("CallNotes".ToLower()).AddColumn("DeletedByUserId".ToLower()).AsCustom("citext").Nullable();
+ Alter.Table("CallNotes".ToLower()).AddColumn("FlaggedOn".ToLower()).AsDateTime2().Nullable();
+ Alter.Table("CallNotes".ToLower()).AddColumn("DeletedOn".ToLower()).AsDateTime2().Nullable();
- Alter.Table("CallDispatches").AddColumn("DispatchedOn").AsDateTime2().NotNullable().WithDefault(SystemMethods.CurrentUTCDateTime); ;
- Alter.Table("CallDispatchGroups").AddColumn("DispatchedOn").AsDateTime2().NotNullable().WithDefault(SystemMethods.CurrentUTCDateTime); ;
- Alter.Table("CallDispatchRoles").AddColumn("DispatchedOn").AsDateTime2().NotNullable().WithDefault(SystemMethods.CurrentUTCDateTime); ;
- Alter.Table("CallDispatchUnits").AddColumn("DispatchedOn").AsDateTime2().NotNullable().WithDefault(SystemMethods.CurrentUTCDateTime); ;
+ Alter.Table("CallDispatches".ToLower()).AddColumn("DispatchedOn".ToLower()).AsDateTime2().NotNullable().WithDefault(SystemMethods.CurrentUTCDateTime); ;
+ Alter.Table("CallDispatchGroups".ToLower()).AddColumn("DispatchedOn".ToLower()).AsDateTime2().NotNullable().WithDefault(SystemMethods.CurrentUTCDateTime); ;
+ Alter.Table("CallDispatchRoles".ToLower()).AddColumn("DispatchedOn".ToLower()).AsDateTime2().NotNullable().WithDefault(SystemMethods.CurrentUTCDateTime); ;
+ Alter.Table("CallDispatchUnits".ToLower()).AddColumn("DispatchedOn".ToLower()).AsDateTime2().NotNullable().WithDefault(SystemMethods.CurrentUTCDateTime); ;
}
public override void Down()
diff --git a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0019_AddingDeleteReasonToCalls.cs b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0019_AddingDeleteReasonToCalls.cs
index 0e6193c3..82900ff4 100644
--- a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0019_AddingDeleteReasonToCalls.cs
+++ b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0019_AddingDeleteReasonToCalls.cs
@@ -7,9 +7,9 @@ public class M0019_AddingDeleteReasonToCalls : Migration
{
public override void Up()
{
- Alter.Table("Calls").AddColumn("DeletedReason").AsCustom("citext").Nullable();
- Alter.Table("Calls").AddColumn("DeletedByUserId").AsCustom("citext").Nullable();
- Alter.Table("Calls").AddColumn("DeletedOn").AsDateTime2().Nullable();
+ Alter.Table("Calls".ToLower()).AddColumn("DeletedReason".ToLower()).AsCustom("citext").Nullable();
+ Alter.Table("Calls".ToLower()).AddColumn("DeletedByUserId".ToLower()).AsCustom("citext").Nullable();
+ Alter.Table("Calls".ToLower()).AddColumn("DeletedOn".ToLower()).AsDateTime2().Nullable();
}
public override void Down()
diff --git a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0020_AddingLangToUPAndSystemQ.cs b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0020_AddingLangToUPAndSystemQ.cs
index a9b448c9..ad465f72 100644
--- a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0020_AddingLangToUPAndSystemQ.cs
+++ b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0020_AddingLangToUPAndSystemQ.cs
@@ -8,14 +8,14 @@ public class M0020_AddingLangToUPAndSystemQ : Migration
public override void Up()
{
// Adding Language to User Profile
- Alter.Table("UserProfiles").AddColumn("Language").AsCustom("citext").Nullable();
+ Alter.Table("UserProfiles".ToLower()).AddColumn("Language".ToLower()).AsCustom("citext").Nullable();
// Updating Queue Item to handle System Queue stuff (i.e. Delete Account and Department requests)
- Alter.Table("QueueItems").AddColumn("ToBeCompletedOn").AsDateTime2().Nullable();
- Alter.Table("QueueItems").AddColumn("Reason").AsCustom("citext").Nullable();
- Alter.Table("QueueItems").AddColumn("QueuedByUserId").AsCustom("citext").Nullable();
- Alter.Table("QueueItems").AddColumn("Data").AsCustom("citext").Nullable();
- Alter.Table("QueueItems").AddColumn("ReminderCount").AsInt32().Nullable();
+ Alter.Table("QueueItems".ToLower()).AddColumn("ToBeCompletedOn".ToLower()).AsDateTime2().Nullable();
+ Alter.Table("QueueItems".ToLower()).AddColumn("Reason".ToLower()).AsCustom("citext").Nullable();
+ Alter.Table("QueueItems".ToLower()).AddColumn("QueuedByUserId".ToLower()).AsCustom("citext").Nullable();
+ Alter.Table("QueueItems".ToLower()).AddColumn("Data".ToLower()).AsCustom("citext").Nullable();
+ Alter.Table("QueueItems".ToLower()).AddColumn("ReminderCount".ToLower()).AsInt32().Nullable();
}
public override void Down()
diff --git a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0021_AddingCallReferences.cs b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0021_AddingCallReferences.cs
index 2ed16d53..2625b8d2 100644
--- a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0021_AddingCallReferences.cs
+++ b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0021_AddingCallReferences.cs
@@ -8,21 +8,21 @@ public class M0021_AddingCallReferences : Migration
{
public override void Up()
{
- Create.Table("CallReferences")
- .WithColumn("CallReferenceId").AsCustom("citext").NotNullable().PrimaryKey()
- .WithColumn("SourceCallId").AsInt32().NotNullable()
- .WithColumn("TargetCallId").AsInt32().NotNullable()
- .WithColumn("AddedOn").AsDateTime2().NotNullable()
- .WithColumn("AddedByUserId").AsCustom("citext").NotNullable()
- .WithColumn("Note").AsCustom("citext").Nullable();
+ Create.Table("CallReferences".ToLower())
+ .WithColumn("CallReferenceId".ToLower()).AsCustom("citext").NotNullable().PrimaryKey()
+ .WithColumn("SourceCallId".ToLower()).AsInt32().NotNullable()
+ .WithColumn("TargetCallId".ToLower()).AsInt32().NotNullable()
+ .WithColumn("AddedOn".ToLower()).AsDateTime2().NotNullable()
+ .WithColumn("AddedByUserId".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("Note".ToLower()).AsCustom("citext").Nullable();
Create.ForeignKey("FK_CallReferences_Call_Source")
- .FromTable("CallReferences").ForeignColumn("SourceCallId")
- .ToTable("Calls").PrimaryColumn("CallId");
+ .FromTable("CallReferences".ToLower()).ForeignColumn("SourceCallId".ToLower())
+ .ToTable("Calls".ToLower()).PrimaryColumn("CallId".ToLower());
Create.ForeignKey("FK_CallReferences_Call_Target")
- .FromTable("CallReferences").ForeignColumn("TargetCallId")
- .ToTable("Calls").PrimaryColumn("CallId");
+ .FromTable("CallReferences".ToLower()).ForeignColumn("TargetCallId".ToLower())
+ .ToTable("Calls".ToLower()).PrimaryColumn("CallId".ToLower());
}
public override void Down()
diff --git a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0022_AddingQuantityForPlanAddon.cs b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0022_AddingQuantityForPlanAddon.cs
index 38423baf..432310f8 100644
--- a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0022_AddingQuantityForPlanAddon.cs
+++ b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0022_AddingQuantityForPlanAddon.cs
@@ -8,7 +8,7 @@ public class M0022_AddingQuantityForPlanAddon : Migration
{
public override void Up()
{
- Alter.Table("PaymentAddons").AddColumn("Quantity").AsInt64().NotNullable().WithDefaultValue(1);
+ Alter.Table("PaymentAddons".ToLower()).AddColumn("Quantity".ToLower()).AsInt64().NotNullable().WithDefaultValue(1);
}
public override void Down()
diff --git a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0023_AddingPlanAddonFor10Pack.cs b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0023_AddingPlanAddonFor10Pack.cs
index fd6dd08a..763f8578 100644
--- a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0023_AddingPlanAddonFor10Pack.cs
+++ b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0023_AddingPlanAddonFor10Pack.cs
@@ -8,14 +8,14 @@ public class M0023_AddingPlanAddonFor10Pack : Migration
{
public override void Up()
{
- if (Schema.Table("PlanAddons").Constraint("FK_PlanAddons_Plans").Exists())
+ if (Schema.Table("PlanAddons".ToLower()).Constraint("FK_PlanAddons_Plans").Exists())
{
- Delete.ForeignKey("FK_PlanAddons_Plans").OnTable("PlanAddons");
+ Delete.ForeignKey("FK_PlanAddons_Plans").OnTable("PlanAddons".ToLower());
}
- Alter.Table("PlanAddons").AlterColumn("PlanId").AsInt32().Nullable();
- Alter.Table("PlanAddons").AddColumn("TestExternalId").AsCustom("citext").Nullable();
- Insert.IntoTable("PlanAddons").Row(new { PlanAddonId = "6f4c5f8b-584d-4291-8a7d-29bf97ae6aa9", AddonType = 1, Cost = 35, ExternalId = "price_0N7MM5qJFDZJcnkVZy4Z51IC", TestExternalId = "price_0NLHvaqJFDZJcnkVS3DHnRA8" });
+ Alter.Table("PlanAddons".ToLower()).AlterColumn("PlanId".ToLower()).AsInt32().Nullable();
+ Alter.Table("PlanAddons".ToLower()).AddColumn("TestExternalId".ToLower()).AsCustom("citext").Nullable();
+ Insert.IntoTable("PlanAddons".ToLower()).Row(new { PlanAddonId = "6f4c5f8b-584d-4291-8a7d-29bf97ae6aa9", AddonType = 1, Cost = 35, ExternalId = "price_0N7MM5qJFDZJcnkVZy4Z51IC", TestExternalId = "price_0NLHvaqJFDZJcnkVS3DHnRA8" });
}
public override void Down()
diff --git a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0024_AddingDepartmentAudio.cs b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0024_AddingDepartmentAudio.cs
index 302def37..0f9df50a 100644
--- a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0024_AddingDepartmentAudio.cs
+++ b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0024_AddingDepartmentAudio.cs
@@ -8,18 +8,18 @@ public class M0024_AddingDepartmentAudio : Migration
{
public override void Up()
{
- Create.Table("DepartmentAudios")
- .WithColumn("DepartmentAudioId").AsCustom("citext").NotNullable().PrimaryKey()
- .WithColumn("DepartmentId").AsInt32().NotNullable()
- .WithColumn("DepartmentAudioType").AsInt32().NotNullable()
- .WithColumn("Name").AsCustom("citext").Nullable()
- .WithColumn("Data").AsCustom("citext").Nullable()
- .WithColumn("AddedOn").AsDateTime2().NotNullable()
- .WithColumn("AddedByUserId").AsCustom("citext").NotNullable();
+ Create.Table("DepartmentAudios".ToLower())
+ .WithColumn("DepartmentAudioId".ToLower()).AsCustom("citext").NotNullable().PrimaryKey()
+ .WithColumn("DepartmentId".ToLower()).AsInt32().NotNullable()
+ .WithColumn("DepartmentAudioType".ToLower()).AsInt32().NotNullable()
+ .WithColumn("Name".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("Data".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("AddedOn".ToLower()).AsDateTime2().NotNullable()
+ .WithColumn("AddedByUserId".ToLower()).AsCustom("citext").NotNullable();
Create.ForeignKey("FK_DepartmentAudios_Department")
- .FromTable("DepartmentAudios").ForeignColumn("DepartmentId")
- .ToTable("Departments").PrimaryColumn("DepartmentId");
+ .FromTable("DepartmentAudios".ToLower()).ForeignColumn("DepartmentId".ToLower())
+ .ToTable("Departments".ToLower()).PrimaryColumn("DepartmentId".ToLower());
}
public override void Down()
diff --git a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0025_AddingTypeToDepartmentAudio.cs b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0025_AddingTypeToDepartmentAudio.cs
index 375a54a8..76b9feed 100644
--- a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0025_AddingTypeToDepartmentAudio.cs
+++ b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0025_AddingTypeToDepartmentAudio.cs
@@ -8,7 +8,7 @@ public class M0025_AddingTypeToDepartmentAudio : Migration
{
public override void Up()
{
- Alter.Table("DepartmentAudios").AddColumn("Type").AsCustom("citext").Nullable();
+ Alter.Table("DepartmentAudios".ToLower()).AddColumn("Type".ToLower()).AsCustom("citext").Nullable();
}
public override void Down()
diff --git a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0026_AddingEntityPlan.cs b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0026_AddingEntityPlan.cs
index 6b360a09..ab1d7e29 100644
--- a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0026_AddingEntityPlan.cs
+++ b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0026_AddingEntityPlan.cs
@@ -8,18 +8,18 @@ public class M0026_AddingEntityPlan : Migration
{
public override void Up()
{
- Alter.Table("Plans").AddColumn("TestExternalId").AsCustom("citext").Nullable();
- Alter.Table("Payments").AddColumn("Quantity").AsInt64().NotNullable().WithDefaultValue(1);
+ Alter.Table("Plans".ToLower()).AddColumn("TestExternalId".ToLower()).AsCustom("citext").Nullable();
+ Alter.Table("Payments".ToLower()).AddColumn("Quantity".ToLower()).AsInt64().NotNullable().WithDefaultValue(1);
- Insert.IntoTable("Plans").Row(new { PlanId = 36, Name = "Entity", Cost = 0, Frequency = 3, ExternalId = "price_0OLxxPqJFDZJcnkVDRHyMUYb", TestExternalId = "price_0OJ0FsqJFDZJcnkVfE87UKr6" });
- Insert.IntoTable("Plans").Row(new { PlanId = 37, Name = "Entity Monthly", Cost = 0, Frequency = 2, ExternalId = "price_0OLxxPqJFDZJcnkVfJLISCp4", TestExternalId = "price_0OIzLPqJFDZJcnkVRn2tpwFF" });
+ Insert.IntoTable("Plans".ToLower()).Row(new { PlanId = 36, Name = "Entity", Cost = 0, Frequency = 3, ExternalId = "price_0OLxxPqJFDZJcnkVDRHyMUYb", TestExternalId = "price_0OJ0FsqJFDZJcnkVfE87UKr6" });
+ Insert.IntoTable("Plans".ToLower()).Row(new { PlanId = 37, Name = "Entity Monthly", Cost = 0, Frequency = 2, ExternalId = "price_0OLxxPqJFDZJcnkVfJLISCp4", TestExternalId = "price_0OIzLPqJFDZJcnkVRn2tpwFF" });
- Insert.IntoTable("PlanLimits").Row(new { PlanId = 36, LimitType = 6, LimitValue = 10 }); // Entities Per Pack
- Insert.IntoTable("PlanLimits").Row(new { PlanId = 37, LimitType = 6, LimitValue = 10 }); // Entities Per Pack
+ Insert.IntoTable("PlanLimits".ToLower()).Row(new { PlanId = 36, LimitType = 6, LimitValue = 10 }); // Entities Per Pack
+ Insert.IntoTable("PlanLimits".ToLower()).Row(new { PlanId = 37, LimitType = 6, LimitValue = 10 }); // Entities Per Pack
- Insert.IntoTable("PlanAddons").Row(new { PlanAddonId = "04b6db64-7dbf-4b3d-a1d1-60bffde004b4", PlanId = 36, AddonType = 1, Cost = 30000, ExternalId = "price_0NMZrMqJFDZJcnkVTpb07W60", TestExternalId = "price_0NLHvaqJFDZJcnkVS3DHnRA8" });
- Insert.IntoTable("PlanAddons").Row(new { PlanAddonId = "8f730f54-2574-445e-875a-5819f8bcda7a", PlanId = 37, AddonType = 1, Cost = 3000, ExternalId = "price_0NMZrMqJFDZJcnkVTpb07W60", TestExternalId = "price_0NLHvaqJFDZJcnkVS3DHnRA8" });
+ Insert.IntoTable("PlanAddons".ToLower()).Row(new { PlanAddonId = "04b6db64-7dbf-4b3d-a1d1-60bffde004b4", PlanId = 36, AddonType = 1, Cost = 30000, ExternalId = "price_0NMZrMqJFDZJcnkVTpb07W60", TestExternalId = "price_0NLHvaqJFDZJcnkVS3DHnRA8" });
+ Insert.IntoTable("PlanAddons".ToLower()).Row(new { PlanAddonId = "8f730f54-2574-445e-875a-5819f8bcda7a", PlanId = 37, AddonType = 1, Cost = 3000, ExternalId = "price_0NMZrMqJFDZJcnkVTpb07W60", TestExternalId = "price_0NLHvaqJFDZJcnkVS3DHnRA8" });
}
public override void Down()
diff --git a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0027_AddingFreeEntityLimits.cs b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0027_AddingFreeEntityLimits.cs
index 38c0638f..ea035b00 100644
--- a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0027_AddingFreeEntityLimits.cs
+++ b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0027_AddingFreeEntityLimits.cs
@@ -8,7 +8,7 @@ public class M0027_AddingFreeEntityLimits : Migration
{
public override void Up()
{
- Insert.IntoTable("PlanLimits").Row(new { PlanId = 1, LimitType = 6, LimitValue = 10 });
+ Insert.IntoTable("PlanLimits".ToLower()).Row(new { PlanId = 1, LimitType = 6, LimitValue = 10 });
}
public override void Down()
diff --git a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0028_AddingDeletedWorkshiftColumns.cs b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0028_AddingDeletedWorkshiftColumns.cs
index 73d8b337..84824cbb 100644
--- a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0028_AddingDeletedWorkshiftColumns.cs
+++ b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0028_AddingDeletedWorkshiftColumns.cs
@@ -8,8 +8,8 @@ public class M0028_AddingDeletedWorkshiftColumns : Migration
{
public override void Up()
{
- Alter.Table("Workshifts").AddColumn("DeletedOn").AsDateTime2().Nullable();
- Alter.Table("Workshifts").AddColumn("DeletedById").AsCustom("citext").Nullable();
+ Alter.Table("Workshifts".ToLower()).AddColumn("DeletedOn".ToLower()).AsDateTime2().Nullable();
+ Alter.Table("Workshifts".ToLower()).AddColumn("DeletedById".ToLower()).AsCustom("citext").Nullable();
}
public override void Down()
diff --git a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0029_AddingCustomStateDetailColumns.cs b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0029_AddingCustomStateDetailColumns.cs
index 7f824d1e..4d65b71d 100644
--- a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0029_AddingCustomStateDetailColumns.cs
+++ b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0029_AddingCustomStateDetailColumns.cs
@@ -8,8 +8,8 @@ public class M0029_AddingCustomStateDetailColumns : Migration
{
public override void Up()
{
- Alter.Table("CustomStateDetails").AddColumn("BaseType").AsInt32().NotNullable().WithDefaultValue(-1);
- Alter.Table("CustomStateDetails").AddColumn("TTL").AsInt32().NotNullable().WithDefaultValue(0);
+ Alter.Table("CustomStateDetails".ToLower()).AddColumn("BaseType".ToLower()).AsInt32().NotNullable().WithDefaultValue(-1);
+ Alter.Table("CustomStateDetails".ToLower()).AddColumn("TTL".ToLower()).AsInt32().NotNullable().WithDefaultValue(0);
}
public override void Down()
diff --git a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0030_AddingDocumentCategories.cs b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0030_AddingDocumentCategories.cs
index aa72498a..e0bf7c73 100644
--- a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0030_AddingDocumentCategories.cs
+++ b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0030_AddingDocumentCategories.cs
@@ -8,16 +8,16 @@ public class M0030_AddingDocumentCategories : Migration
{
public override void Up()
{
- Create.Table("DocumentCategories")
- .WithColumn("DocumentCategoryId").AsCustom("citext").NotNullable().PrimaryKey()
- .WithColumn("DepartmentId").AsInt32().NotNullable()
- .WithColumn("Name").AsCustom("citext").NotNullable()
- .WithColumn("AddedOn").AsDateTime2().NotNullable()
- .WithColumn("AddedById").AsCustom("citext").NotNullable();
+ Create.Table("DocumentCategories".ToLower())
+ .WithColumn("DocumentCategoryId".ToLower()).AsCustom("citext").NotNullable().PrimaryKey()
+ .WithColumn("DepartmentId".ToLower()).AsInt32().NotNullable()
+ .WithColumn("Name".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("AddedOn".ToLower()).AsDateTime2().NotNullable()
+ .WithColumn("AddedById".ToLower()).AsCustom("citext").NotNullable();
Create.ForeignKey("FK_DocumentCategories_Department")
- .FromTable("DocumentCategories").ForeignColumn("DepartmentId")
- .ToTable("Departments").PrimaryColumn("DepartmentId");
+ .FromTable("DocumentCategories".ToLower()).ForeignColumn("DepartmentId".ToLower())
+ .ToTable("Departments".ToLower()).PrimaryColumn("DepartmentId".ToLower());
}
public override void Down()
diff --git a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0031_AddingNoteCategories.cs b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0031_AddingNoteCategories.cs
index 7e50adc0..e4487bb9 100644
--- a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0031_AddingNoteCategories.cs
+++ b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0031_AddingNoteCategories.cs
@@ -8,16 +8,16 @@ public class M0031_AddingNoteCategories : Migration
{
public override void Up()
{
- Create.Table("NoteCategories")
- .WithColumn("NoteCategoryId").AsCustom("citext").NotNullable().PrimaryKey()
- .WithColumn("DepartmentId").AsInt32().NotNullable()
- .WithColumn("Name").AsCustom("citext").NotNullable()
- .WithColumn("AddedOn").AsDateTime2().NotNullable()
- .WithColumn("AddedById").AsCustom("citext").NotNullable();
+ Create.Table("NoteCategories".ToLower())
+ .WithColumn("NoteCategoryId".ToLower()).AsCustom("citext").NotNullable().PrimaryKey()
+ .WithColumn("DepartmentId".ToLower()).AsInt32().NotNullable()
+ .WithColumn("Name".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("AddedOn".ToLower()).AsDateTime2().NotNullable()
+ .WithColumn("AddedById".ToLower()).AsCustom("citext").NotNullable();
Create.ForeignKey("FK_NoteCategories_Department")
- .FromTable("NoteCategories").ForeignColumn("DepartmentId")
- .ToTable("Departments").PrimaryColumn("DepartmentId");
+ .FromTable("NoteCategories".ToLower()).ForeignColumn("DepartmentId".ToLower())
+ .ToTable("Departments".ToLower()).PrimaryColumn("DepartmentId".ToLower());
}
public override void Down()
diff --git a/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0032_AddingContacts.cs b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0032_AddingContacts.cs
new file mode 100644
index 00000000..a741ea6f
--- /dev/null
+++ b/Providers/Resgrid.Providers.MigrationsPg/Migrations/M0032_AddingContacts.cs
@@ -0,0 +1,170 @@
+using FluentMigrator;
+using System;
+
+namespace Resgrid.Providers.MigrationsPg.Migrations
+{
+ [Migration(32)]
+ public class M0032_AddingContacts : Migration
+ {
+ public override void Up()
+ {
+ //Delete.ForeignKey("FK_Conacts_Departments");
+ Delete.Table("Contacts".ToLower());
+
+ Create.Table("Contacts".ToLower())
+ .WithColumn("ContactId".ToLower()).AsCustom("citext").NotNullable().PrimaryKey()
+ .WithColumn("DepartmentId".ToLower()).AsInt32().NotNullable()
+ .WithColumn("ContactType".ToLower()).AsInt32()
+ .WithColumn("ContactCategoryId".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("FirstName".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("MiddleName".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("LastName".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("OtherName".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("CompanyName".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("Email".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("PhysicalAddressId".ToLower()).AsInt32().Nullable()
+ .WithColumn("MailingAddressId".ToLower()).AsInt32().Nullable()
+ .WithColumn("Website".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("Twitter".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("Facebook".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("LinkedIn".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("Instagram".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("Threads".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("Bluesky".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("Mastodon".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("LocationGpsCoordinates".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("EntranceGpsCoordinates".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("ExitGpsCoordinates".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("LocationGeofence".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("CountryIssuedIdNumber".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("CountryIdName".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("StateIdNumber".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("StateIdName".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("StateIdCountryName".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("Description".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("OtherInfo".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("HomePhoneNumber".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("CellPhoneNumber".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("FaxPhoneNumber".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("OfficePhoneNumber".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("Image".ToLower()).AsBinary().Nullable()
+ .WithColumn("IsDeleted".ToLower()).AsBoolean()
+ .WithColumn("AddedOn".ToLower()).AsDateTime2().NotNullable()
+ .WithColumn("AddedByUserId".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("EditedOn".ToLower()).AsDateTime2().Nullable()
+ .WithColumn("EditedByUserId".ToLower()).AsCustom("citext").Nullable();
+
+ Create.ForeignKey("FK_Contacts_Department")
+ .FromTable("Contacts".ToLower()).ForeignColumn("DepartmentId".ToLower())
+ .ToTable("Departments".ToLower()).PrimaryColumn("DepartmentId".ToLower());
+
+ Create.ForeignKey("FK_Contacts_PhysicalAddress")
+ .FromTable("Contacts".ToLower()).ForeignColumn("PhysicalAddressId".ToLower())
+ .ToTable("Addresses".ToLower()).PrimaryColumn("AddressId".ToLower());
+
+ Create.ForeignKey("FK_Contacts_MailingAddress")
+ .FromTable("Contacts".ToLower()).ForeignColumn("MailingAddressId".ToLower())
+ .ToTable("Addresses".ToLower()).PrimaryColumn("AddressId".ToLower());
+
+ Create.Table("ContactNoteTypes".ToLower())
+ .WithColumn("ContactNoteTypeId".ToLower()).AsCustom("citext").NotNullable().PrimaryKey()
+ .WithColumn("DepartmentId".ToLower()).AsInt32().NotNullable()
+ .WithColumn("Name".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("Color".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("DefaultShouldAlert".ToLower()).AsBoolean().NotNullable()
+ .WithColumn("DefaultVisibility".ToLower()).AsInt32().NotNullable()
+ .WithColumn("AddedOn".ToLower()).AsDateTime2().NotNullable()
+ .WithColumn("AddedByUserId".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("EditedOn".ToLower()).AsDateTime2()
+ .WithColumn("EditedByUserId".ToLower()).AsCustom("citext");
+
+ Create.ForeignKey("FK_ContactNoteTypes_Department")
+ .FromTable("ContactNoteTypes".ToLower()).ForeignColumn("DepartmentId".ToLower())
+ .ToTable("Departments".ToLower()).PrimaryColumn("DepartmentId".ToLower());
+
+ Create.Table("ContactNotes".ToLower())
+ .WithColumn("ContactNoteId".ToLower()).AsCustom("citext").NotNullable().PrimaryKey()
+ .WithColumn("DepartmentId".ToLower()).AsInt32().NotNullable()
+ .WithColumn("ContactId".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("ContactNoteTypeId".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("Note".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("Color".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("ShouldAlert".ToLower()).AsBoolean().NotNullable()
+ .WithColumn("Visibility".ToLower()).AsInt32().NotNullable()
+ .WithColumn("ExpiresOn".ToLower()).AsDateTime2().Nullable()
+ .WithColumn("IsDeleted".ToLower()).AsBoolean().NotNullable()
+ .WithColumn("AddedOn".ToLower()).AsDateTime2().NotNullable()
+ .WithColumn("AddedByUserId".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("EditedOn".ToLower()).AsDateTime2().Nullable()
+ .WithColumn("EditedByUserId".ToLower()).AsCustom("citext").Nullable();
+
+ Create.ForeignKey("FK_ContactNotes_Department")
+ .FromTable("ContactNotes".ToLower()).ForeignColumn("DepartmentId".ToLower())
+ .ToTable("Departments".ToLower()).PrimaryColumn("DepartmentId".ToLower());
+
+ Create.ForeignKey("FK_ContactNotes_Contacts")
+ .FromTable("ContactNotes".ToLower()).ForeignColumn("ContactId".ToLower())
+ .ToTable("Contacts".ToLower()).PrimaryColumn("ContactId".ToLower());
+
+ Create.Table("ContactAssociations".ToLower())
+ .WithColumn("ContactAssociationId".ToLower()).AsCustom("citext").NotNullable().PrimaryKey()
+ .WithColumn("DepartmentId".ToLower()).AsInt32().NotNullable()
+ .WithColumn("SourceContactId".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("TargetContactId".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("Type".ToLower()).AsInt32().NotNullable()
+ .WithColumn("Note".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("Twitter".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("AddedOn".ToLower()).AsDateTime2().NotNullable()
+ .WithColumn("AddedByUserId".ToLower()).AsCustom("citext").NotNullable();
+
+ Create.ForeignKey("FK_ContactAssociations_Department")
+ .FromTable("ContactAssociations".ToLower()).ForeignColumn("DepartmentId".ToLower())
+ .ToTable("Departments".ToLower()).PrimaryColumn("DepartmentId".ToLower());
+
+ Create.ForeignKey("FK_ContactAssociations_SourceContactId")
+ .FromTable("ContactAssociations".ToLower()).ForeignColumn("SourceContactId".ToLower())
+ .ToTable("Contacts".ToLower()).PrimaryColumn("ContactId".ToLower());
+
+ Create.ForeignKey("FK_ContactAssociations_TargetContactId")
+ .FromTable("ContactAssociations".ToLower()).ForeignColumn("TargetContactId".ToLower())
+ .ToTable("Contacts".ToLower()).PrimaryColumn("ContactId".ToLower());
+
+ Create.Table("CallContacts".ToLower())
+ .WithColumn("CallContactId".ToLower()).AsCustom("citext").NotNullable().PrimaryKey()
+ .WithColumn("DepartmentId".ToLower()).AsInt32().NotNullable()
+ .WithColumn("CallId".ToLower()).AsInt32().NotNullable()
+ .WithColumn("ContactId".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("CallContactType".ToLower()).AsInt32();
+
+ Create.ForeignKey("FK_CallContacts_Department")
+ .FromTable("CallContacts".ToLower()).ForeignColumn("DepartmentId".ToLower())
+ .ToTable("Departments".ToLower()).PrimaryColumn("DepartmentId".ToLower());
+
+ Create.ForeignKey("FK_CallContacts_Contacts")
+ .FromTable("Contacts".ToLower()).ForeignColumn("ContactId".ToLower())
+ .ToTable("Contacts".ToLower()).PrimaryColumn("ContactId".ToLower());
+
+ Create.Table("ContactCategories".ToLower())
+ .WithColumn("ContactCategoryId".ToLower()).AsCustom("citext").NotNullable().PrimaryKey()
+ .WithColumn("DepartmentId".ToLower()).AsInt32().NotNullable()
+ .WithColumn("Name".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("Description".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("Color".ToLower()).AsCustom("citext").Nullable()
+ .WithColumn("DisplayOnMap".ToLower()).AsBoolean().NotNullable()
+ .WithColumn("MapIcon".ToLower()).AsInt32().Nullable()
+ .WithColumn("AddedOn".ToLower()).AsDateTime2().NotNullable()
+ .WithColumn("AddedByUserId".ToLower()).AsCustom("citext").NotNullable()
+ .WithColumn("EditedOn".ToLower()).AsDateTime2().Nullable()
+ .WithColumn("EditedByUserId".ToLower()).AsCustom("citext").Nullable();
+
+ Create.ForeignKey("FK_ContactCategories_Department")
+ .FromTable("ContactCategories".ToLower()).ForeignColumn("DepartmentId".ToLower())
+ .ToTable("Departments".ToLower()).PrimaryColumn("DepartmentId".ToLower());
+ }
+
+ public override void Down()
+ {
+
+ }
+ }
+}
diff --git a/Repositories/Resgrid.Repositories.DataRepository/CallContactsRepository.cs b/Repositories/Resgrid.Repositories.DataRepository/CallContactsRepository.cs
new file mode 100644
index 00000000..54fbb0e7
--- /dev/null
+++ b/Repositories/Resgrid.Repositories.DataRepository/CallContactsRepository.cs
@@ -0,0 +1,25 @@
+using Resgrid.Model;
+using Resgrid.Model.Repositories;
+using Resgrid.Model.Repositories.Connection;
+using Resgrid.Model.Repositories.Queries;
+using Resgrid.Repositories.DataRepository.Configs;
+
+namespace Resgrid.Repositories.DataRepository
+{
+ public class CallContactsRepository : RepositoryBase, ICallContactsRepository
+ {
+ private readonly IConnectionProvider _connectionProvider;
+ private readonly SqlConfiguration _sqlConfiguration;
+ private readonly IQueryFactory _queryFactory;
+ private readonly IUnitOfWork _unitOfWork;
+
+ public CallContactsRepository(IConnectionProvider connectionProvider, SqlConfiguration sqlConfiguration, IUnitOfWork unitOfWork, IQueryFactory queryFactory)
+ : base(connectionProvider, sqlConfiguration, unitOfWork, queryFactory)
+ {
+ _connectionProvider = connectionProvider;
+ _sqlConfiguration = sqlConfiguration;
+ _queryFactory = queryFactory;
+ _unitOfWork = unitOfWork;
+ }
+ }
+}
diff --git a/Repositories/Resgrid.Repositories.DataRepository/Configs/SqlConfiguration.cs b/Repositories/Resgrid.Repositories.DataRepository/Configs/SqlConfiguration.cs
index 1d49c990..3355bad7 100644
--- a/Repositories/Resgrid.Repositories.DataRepository/Configs/SqlConfiguration.cs
+++ b/Repositories/Resgrid.Repositories.DataRepository/Configs/SqlConfiguration.cs
@@ -435,6 +435,16 @@ protected SqlConfiguration() { }
public string SelectAllUpcomingOrRecurringReportTasksQuery { get; set; }
#endregion Scheduled Tasks
+ #region Contacts
+ public string ContactsTableName { get; set; }
+ public string ContactAssociationsTableName { get; set; }
+ public string ContactCategoriesTableName { get; set; }
+ public string ContactNotesTableName { get; set; }
+ public string ContactNoteTypesTableName { get; set; }
+ public string CallContactTableName { get; set; }
+ public string SelectContactsByCategoryIdQuery { get; set; }
+ #endregion Contacts
+
// Identity
#region Table Names
diff --git a/Repositories/Resgrid.Repositories.DataRepository/ContactAssociationsRepository.cs b/Repositories/Resgrid.Repositories.DataRepository/ContactAssociationsRepository.cs
new file mode 100644
index 00000000..56534c25
--- /dev/null
+++ b/Repositories/Resgrid.Repositories.DataRepository/ContactAssociationsRepository.cs
@@ -0,0 +1,25 @@
+using Resgrid.Model;
+using Resgrid.Model.Repositories;
+using Resgrid.Model.Repositories.Connection;
+using Resgrid.Model.Repositories.Queries;
+using Resgrid.Repositories.DataRepository.Configs;
+
+namespace Resgrid.Repositories.DataRepository
+{
+ public class ContactAssociationsRepository : RepositoryBase, IContactAssociationsRepository
+ {
+ private readonly IConnectionProvider _connectionProvider;
+ private readonly SqlConfiguration _sqlConfiguration;
+ private readonly IQueryFactory _queryFactory;
+ private readonly IUnitOfWork _unitOfWork;
+
+ public ContactAssociationsRepository(IConnectionProvider connectionProvider, SqlConfiguration sqlConfiguration, IUnitOfWork unitOfWork, IQueryFactory queryFactory)
+ : base(connectionProvider, sqlConfiguration, unitOfWork, queryFactory)
+ {
+ _connectionProvider = connectionProvider;
+ _sqlConfiguration = sqlConfiguration;
+ _queryFactory = queryFactory;
+ _unitOfWork = unitOfWork;
+ }
+ }
+}
diff --git a/Repositories/Resgrid.Repositories.DataRepository/ContactCategoryRepository.cs b/Repositories/Resgrid.Repositories.DataRepository/ContactCategoryRepository.cs
new file mode 100644
index 00000000..224f545a
--- /dev/null
+++ b/Repositories/Resgrid.Repositories.DataRepository/ContactCategoryRepository.cs
@@ -0,0 +1,25 @@
+using Resgrid.Model;
+using Resgrid.Model.Repositories;
+using Resgrid.Model.Repositories.Connection;
+using Resgrid.Model.Repositories.Queries;
+using Resgrid.Repositories.DataRepository.Configs;
+
+namespace Resgrid.Repositories.DataRepository
+{
+ public class ContactCategoryRepository : RepositoryBase, IContactCategoryRepository
+ {
+ private readonly IConnectionProvider _connectionProvider;
+ private readonly SqlConfiguration _sqlConfiguration;
+ private readonly IQueryFactory _queryFactory;
+ private readonly IUnitOfWork _unitOfWork;
+
+ public ContactCategoryRepository(IConnectionProvider connectionProvider, SqlConfiguration sqlConfiguration, IUnitOfWork unitOfWork, IQueryFactory queryFactory)
+ : base(connectionProvider, sqlConfiguration, unitOfWork, queryFactory)
+ {
+ _connectionProvider = connectionProvider;
+ _sqlConfiguration = sqlConfiguration;
+ _queryFactory = queryFactory;
+ _unitOfWork = unitOfWork;
+ }
+ }
+}
diff --git a/Repositories/Resgrid.Repositories.DataRepository/ContactNoteTypesRepository.cs b/Repositories/Resgrid.Repositories.DataRepository/ContactNoteTypesRepository.cs
new file mode 100644
index 00000000..e02c343d
--- /dev/null
+++ b/Repositories/Resgrid.Repositories.DataRepository/ContactNoteTypesRepository.cs
@@ -0,0 +1,25 @@
+using Resgrid.Model;
+using Resgrid.Model.Repositories;
+using Resgrid.Model.Repositories.Connection;
+using Resgrid.Model.Repositories.Queries;
+using Resgrid.Repositories.DataRepository.Configs;
+
+namespace Resgrid.Repositories.DataRepository
+{
+ public class ContactNoteTypesRepository : RepositoryBase, IContactNoteTypesRepository
+ {
+ private readonly IConnectionProvider _connectionProvider;
+ private readonly SqlConfiguration _sqlConfiguration;
+ private readonly IQueryFactory _queryFactory;
+ private readonly IUnitOfWork _unitOfWork;
+
+ public ContactNoteTypesRepository(IConnectionProvider connectionProvider, SqlConfiguration sqlConfiguration, IUnitOfWork unitOfWork, IQueryFactory queryFactory)
+ : base(connectionProvider, sqlConfiguration, unitOfWork, queryFactory)
+ {
+ _connectionProvider = connectionProvider;
+ _sqlConfiguration = sqlConfiguration;
+ _queryFactory = queryFactory;
+ _unitOfWork = unitOfWork;
+ }
+ }
+}
diff --git a/Repositories/Resgrid.Repositories.DataRepository/ContactNotesRepository.cs b/Repositories/Resgrid.Repositories.DataRepository/ContactNotesRepository.cs
new file mode 100644
index 00000000..7463fda8
--- /dev/null
+++ b/Repositories/Resgrid.Repositories.DataRepository/ContactNotesRepository.cs
@@ -0,0 +1,25 @@
+using Resgrid.Model;
+using Resgrid.Model.Repositories;
+using Resgrid.Model.Repositories.Connection;
+using Resgrid.Model.Repositories.Queries;
+using Resgrid.Repositories.DataRepository.Configs;
+
+namespace Resgrid.Repositories.DataRepository
+{
+ public class ContactNotesRepository : RepositoryBase, IContactNotesRepository
+ {
+ private readonly IConnectionProvider _connectionProvider;
+ private readonly SqlConfiguration _sqlConfiguration;
+ private readonly IQueryFactory _queryFactory;
+ private readonly IUnitOfWork _unitOfWork;
+
+ public ContactNotesRepository(IConnectionProvider connectionProvider, SqlConfiguration sqlConfiguration, IUnitOfWork unitOfWork, IQueryFactory queryFactory)
+ : base(connectionProvider, sqlConfiguration, unitOfWork, queryFactory)
+ {
+ _connectionProvider = connectionProvider;
+ _sqlConfiguration = sqlConfiguration;
+ _queryFactory = queryFactory;
+ _unitOfWork = unitOfWork;
+ }
+ }
+}
diff --git a/Repositories/Resgrid.Repositories.DataRepository/ContactsRepository.cs b/Repositories/Resgrid.Repositories.DataRepository/ContactsRepository.cs
new file mode 100644
index 00000000..8439c2f1
--- /dev/null
+++ b/Repositories/Resgrid.Repositories.DataRepository/ContactsRepository.cs
@@ -0,0 +1,74 @@
+using Resgrid.Model;
+using Resgrid.Model.Repositories;
+using Resgrid.Model.Repositories.Connection;
+using Resgrid.Model.Repositories.Queries;
+using Resgrid.Repositories.DataRepository.Configs;
+using System.Collections.Generic;
+using System.Data.Common;
+using System.Threading.Tasks;
+using System;
+using Resgrid.Repositories.DataRepository.Queries.Contacts;
+using Dapper;
+using Resgrid.Framework;
+
+namespace Resgrid.Repositories.DataRepository
+{
+ public class ContactsRepository : RepositoryBase, IContactsRepository
+ {
+ private readonly IConnectionProvider _connectionProvider;
+ private readonly SqlConfiguration _sqlConfiguration;
+ private readonly IQueryFactory _queryFactory;
+ private readonly IUnitOfWork _unitOfWork;
+
+ public ContactsRepository(IConnectionProvider connectionProvider, SqlConfiguration sqlConfiguration, IUnitOfWork unitOfWork, IQueryFactory queryFactory)
+ : base(connectionProvider, sqlConfiguration, unitOfWork, queryFactory)
+ {
+ _connectionProvider = connectionProvider;
+ _sqlConfiguration = sqlConfiguration;
+ _queryFactory = queryFactory;
+ _unitOfWork = unitOfWork;
+ }
+
+ public async Task> GetContactsByCategoryIdAsync(int departmentId, string categoryId)
+ {
+ try
+ {
+ var selectFunction = new Func>>(async x =>
+ {
+ var dynamicParameters = new DynamicParametersExtension();
+ dynamicParameters.Add("DepartmentId", departmentId);
+ dynamicParameters.Add("CategoryId", categoryId);
+
+ var query = _queryFactory.GetQuery();
+
+ return await x.QueryAsync(sql: query,
+ param: dynamicParameters,
+ transaction: _unitOfWork.Transaction);
+ });
+
+ DbConnection conn = null;
+ if (_unitOfWork?.Connection == null)
+ {
+ using (conn = _connectionProvider.Create())
+ {
+ await conn.OpenAsync();
+
+ return await selectFunction(conn);
+ }
+ }
+ else
+ {
+ conn = _unitOfWork.CreateOrGetConnection();
+
+ return await selectFunction(conn);
+ }
+ }
+ catch (Exception ex)
+ {
+ Logging.LogException(ex);
+
+ throw;
+ }
+ }
+ }
+}
diff --git a/Repositories/Resgrid.Repositories.DataRepository/IdentityRepository.cs b/Repositories/Resgrid.Repositories.DataRepository/IdentityRepository.cs
index 2f5e9c56..803e8736 100644
--- a/Repositories/Resgrid.Repositories.DataRepository/IdentityRepository.cs
+++ b/Repositories/Resgrid.Repositories.DataRepository/IdentityRepository.cs
@@ -225,7 +225,7 @@ public List GetAllMembershipsForDepartment(int departmentId)
{
return db.Query(@"SELECT m.* FROM aspnetusers m
INNER JOIN departmentmembers dm ON dm.userid = m.id
- WHERE dm.departmentid = @departmentId AND dm.isdeleted = 0", new { departmentId = departmentId }).ToList();
+ WHERE dm.departmentid = @departmentId AND dm.isdeleted = false", new { departmentId = departmentId }).ToList();
}
}
else
@@ -249,7 +249,7 @@ public List GetAllUsersForDepartment(int departmentId)
{
return db.Query(@"SELECT u.* FROM aspnetusers u
INNER JOIN departmentmembers dm ON dm.userid = u.id
- WHERE dm.departmentid = @departmentId AND dm.isdeleted = 0", new { departmentId = departmentId }).ToList();
+ WHERE dm.departmentid = @departmentId AND dm.isdeleted = false", new { departmentId = departmentId }).ToList();
}
}
else
@@ -275,7 +275,7 @@ public List GetAllUsersForGroup(int groupId)
FROM aspnetusers u
INNER JOIN departmentgroupmembers dgm ON u.id = dgm.userid
INNER JOIN departmentmembers dm ON u.id = dm.userid
- WHERE dgm.departmentgroupid = @groupId AND dm.isdeleted = 0",
+ WHERE dgm.departmentgroupid = @groupId AND dm.isdeleted = false",
new { groupId = groupId }).ToList();
}
}
@@ -302,7 +302,7 @@ public List GetAllUsersForDepartmentWithinLimits(int departmentId,
{
return db.Query(@"SELECT u.* FROM aspnetusers u
INNER JOIN departmentmembers dm ON dm.userid = u.id
- WHERE dm.departmentid = @departmentId AND dm.isdeleted = 0 AND (@retrieveHidden = 1 OR (dm.ishidden = 0 OR dm.ishidden IS NULL)) AND (dm.isdisabled = 0 OR dm.isdisabled IS NULL)",
+ WHERE dm.departmentid = @departmentId AND dm.isdeleted = false AND (@retrieveHidden = true OR (dm.ishidden = false OR dm.ishidden IS NULL)) AND (dm.isdisabled = false OR dm.isdisabled IS NULL)",
new { departmentId = departmentId, retrieveHidden = retrieveHidden }).ToList();
}
}
@@ -328,7 +328,7 @@ public async Task> GetAllUsersForDepartmentWithinLimitsAsync(
{
var result = await db.QueryAsync(@"SELECT u.* FROM aspnetusers u
INNER JOIN departmentmembers dm ON dm.userid = u.id
- WHERE dm.departmentid = @departmentId AND dm.isdeleted = 0 AND (@retrieveHidden = 1 OR (dm.ishidden = 0 OR dm.ishidden IS NULL)) AND (dm.isdisabled = 0 OR dm.isdisabled IS NULL)",
+ WHERE dm.departmentid = @departmentId AND dm.isdeleted = false AND (@retrieveHidden = true OR (dm.ishidden = false OR dm.ishidden IS NULL)) AND (dm.isdisabled = false OR dm.isdisabled IS NULL)",
new { departmentId = departmentId, retrieveHidden = retrieveHidden });
return result.ToList();
diff --git a/Repositories/Resgrid.Repositories.DataRepository/Modules/ApiDataModule.cs b/Repositories/Resgrid.Repositories.DataRepository/Modules/ApiDataModule.cs
index 4987ce82..957cf583 100644
--- a/Repositories/Resgrid.Repositories.DataRepository/Modules/ApiDataModule.cs
+++ b/Repositories/Resgrid.Repositories.DataRepository/Modules/ApiDataModule.cs
@@ -161,6 +161,12 @@ protected override void Load(ContainerBuilder builder)
builder.RegisterType().As().InstancePerLifetimeScope();
builder.RegisterType().As().InstancePerLifetimeScope();
builder.RegisterType().As().InstancePerLifetimeScope();
+ builder.RegisterType().As().InstancePerLifetimeScope();
+ builder.RegisterType().As().InstancePerLifetimeScope();
+ builder.RegisterType().As().InstancePerLifetimeScope();
+ builder.RegisterType().As().InstancePerLifetimeScope();
+ builder.RegisterType().As().InstancePerLifetimeScope();
+ builder.RegisterType().As().InstancePerLifetimeScope();
}
}
}
diff --git a/Repositories/Resgrid.Repositories.DataRepository/Modules/DataModule.cs b/Repositories/Resgrid.Repositories.DataRepository/Modules/DataModule.cs
index 5d6cf0e1..7fd2a0da 100644
--- a/Repositories/Resgrid.Repositories.DataRepository/Modules/DataModule.cs
+++ b/Repositories/Resgrid.Repositories.DataRepository/Modules/DataModule.cs
@@ -160,6 +160,12 @@ protected override void Load(ContainerBuilder builder)
builder.RegisterType().As().InstancePerLifetimeScope();
builder.RegisterType().As().InstancePerLifetimeScope();
builder.RegisterType().As().InstancePerLifetimeScope();
+ builder.RegisterType().As().InstancePerLifetimeScope();
+ builder.RegisterType().As().InstancePerLifetimeScope();
+ builder.RegisterType().As().InstancePerLifetimeScope();
+ builder.RegisterType().As().InstancePerLifetimeScope();
+ builder.RegisterType().As().InstancePerLifetimeScope();
+ builder.RegisterType().As().InstancePerLifetimeScope();
}
}
}
diff --git a/Repositories/Resgrid.Repositories.DataRepository/Modules/NonWebDataModule.cs b/Repositories/Resgrid.Repositories.DataRepository/Modules/NonWebDataModule.cs
index 28d20953..4e1e5b92 100644
--- a/Repositories/Resgrid.Repositories.DataRepository/Modules/NonWebDataModule.cs
+++ b/Repositories/Resgrid.Repositories.DataRepository/Modules/NonWebDataModule.cs
@@ -160,6 +160,12 @@ protected override void Load(ContainerBuilder builder)
builder.RegisterType().As().InstancePerLifetimeScope();
builder.RegisterType().As().InstancePerLifetimeScope();
builder.RegisterType().As().InstancePerLifetimeScope();
+ builder.RegisterType().As().InstancePerLifetimeScope();
+ builder.RegisterType().As().InstancePerLifetimeScope();
+ builder.RegisterType().As().InstancePerLifetimeScope();
+ builder.RegisterType().As().InstancePerLifetimeScope();
+ builder.RegisterType().As().InstancePerLifetimeScope();
+ builder.RegisterType().As().InstancePerLifetimeScope();
}
}
}
diff --git a/Repositories/Resgrid.Repositories.DataRepository/Modules/TestingDataModule.cs b/Repositories/Resgrid.Repositories.DataRepository/Modules/TestingDataModule.cs
index 151641b7..74015828 100644
--- a/Repositories/Resgrid.Repositories.DataRepository/Modules/TestingDataModule.cs
+++ b/Repositories/Resgrid.Repositories.DataRepository/Modules/TestingDataModule.cs
@@ -160,6 +160,12 @@ protected override void Load(ContainerBuilder builder)
builder.RegisterType().As().InstancePerLifetimeScope();
builder.RegisterType().As().InstancePerLifetimeScope();
builder.RegisterType().As().InstancePerLifetimeScope();
+ builder.RegisterType().As().InstancePerLifetimeScope();
+ builder.RegisterType().As().InstancePerLifetimeScope();
+ builder.RegisterType().As().InstancePerLifetimeScope();
+ builder.RegisterType().As().InstancePerLifetimeScope();
+ builder.RegisterType().As().InstancePerLifetimeScope();
+ builder.RegisterType().As().InstancePerLifetimeScope();
}
}
}
diff --git a/Repositories/Resgrid.Repositories.DataRepository/Queries/Contacts/SelectContactsByCategoryIdQuery.cs b/Repositories/Resgrid.Repositories.DataRepository/Queries/Contacts/SelectContactsByCategoryIdQuery.cs
new file mode 100644
index 00000000..27c771d7
--- /dev/null
+++ b/Repositories/Resgrid.Repositories.DataRepository/Queries/Contacts/SelectContactsByCategoryIdQuery.cs
@@ -0,0 +1,33 @@
+using Resgrid.Model;
+using Resgrid.Model.Repositories.Queries.Contracts;
+using Resgrid.Repositories.DataRepository.Configs;
+using Resgrid.Repositories.DataRepository.Extensions;
+
+namespace Resgrid.Repositories.DataRepository.Queries.Contacts
+{
+ public class SelectContactsByCategoryIdQuery : ISelectQuery
+ {
+ private readonly SqlConfiguration _sqlConfiguration;
+ public SelectContactsByCategoryIdQuery(SqlConfiguration sqlConfiguration)
+ {
+ _sqlConfiguration = sqlConfiguration;
+ }
+
+ public string GetQuery()
+ {
+ var query = _sqlConfiguration.SelectContactsByCategoryIdQuery
+ .ReplaceQueryParameters(_sqlConfiguration, _sqlConfiguration.SchemaName,
+ _sqlConfiguration.ContactsTableName,
+ _sqlConfiguration.ParameterNotation,
+ new string[] { "%CATEGORYID%", "%DID%" },
+ new string[] { "CategoryId", "DepartmentId" });
+
+ return query;
+ }
+
+ public string GetQuery() where TEntity : class, IEntity
+ {
+ throw new System.NotImplementedException();
+ }
+ }
+}
diff --git a/Repositories/Resgrid.Repositories.DataRepository/Servers/PostgreSql/PostgreSqlConfiguration.cs b/Repositories/Resgrid.Repositories.DataRepository/Servers/PostgreSql/PostgreSqlConfiguration.cs
index 869d5f30..5a90de9d 100644
--- a/Repositories/Resgrid.Repositories.DataRepository/Servers/PostgreSql/PostgreSqlConfiguration.cs
+++ b/Repositories/Resgrid.Repositories.DataRepository/Servers/PostgreSql/PostgreSqlConfiguration.cs
@@ -1382,6 +1382,19 @@ SELECT dvc.*
";
#endregion Scheduled Tasks
+
+ #region Contacts
+ ContactsTableName = "Contacts";
+ ContactAssociationsTableName = "ContactAssociations";
+ ContactCategoriesTableName = "ContactCategories";
+ ContactNotesTableName = "ContactNotes";
+ ContactNoteTypesTableName = "ContactNoteTypes";
+ CallContactTableName = "CallContacts";
+ SelectContactsByCategoryIdQuery = @"
+ SELECT *
+ FROM %SCHEMA%.%TABLENAME%
+ WHERE ContactCategoryId = %CATEGORYID% AND DepartmentId = %DID%";
+ #endregion Contacts
}
}
}
diff --git a/Repositories/Resgrid.Repositories.DataRepository/Servers/SqlServer/SqlServerConfiguration.cs b/Repositories/Resgrid.Repositories.DataRepository/Servers/SqlServer/SqlServerConfiguration.cs
index 8dde0756..aad6244d 100644
--- a/Repositories/Resgrid.Repositories.DataRepository/Servers/SqlServer/SqlServerConfiguration.cs
+++ b/Repositories/Resgrid.Repositories.DataRepository/Servers/SqlServer/SqlServerConfiguration.cs
@@ -1345,6 +1345,19 @@ SELECT dvc.*
";
#endregion Scheduled Tasks
+
+ #region Contacts
+ ContactsTableName = "Contacts";
+ ContactAssociationsTableName = "ContactAssociations";
+ ContactCategoriesTableName = "ContactCategories";
+ ContactNotesTableName = "ContactNotes";
+ ContactNoteTypesTableName = "ContactNoteTypes";
+ CallContactTableName = "CallContacts";
+ SelectContactsByCategoryIdQuery = @"
+ SELECT *
+ FROM %SCHEMA%.%TABLENAME%
+ WHERE [ContactCategoryId] = %CATEGORYID% AND DepartmentId = %DID%";
+ #endregion Contacts
}
- }
+}
}
diff --git a/Tools/Resgrid.Console/Commands/DbUpdateCommand.cs b/Tools/Resgrid.Console/Commands/DbUpdateCommand.cs
index 2c57276b..f5a10477 100644
--- a/Tools/Resgrid.Console/Commands/DbUpdateCommand.cs
+++ b/Tools/Resgrid.Console/Commands/DbUpdateCommand.cs
@@ -6,6 +6,7 @@
using Microsoft.Extensions.DependencyInjection;
using Resgrid.Providers.Migrations.Migrations;
using FluentMigrator.Runner;
+using Resgrid.Providers.MigrationsPg.Migrations;
namespace Resgrid.Console.Commands
{
@@ -53,22 +54,40 @@ public string Execute(DbUpdateArgs args)
///
private static IServiceProvider CreateServices()
{
- return new ServiceCollection()
- // Add common FluentMigrator services
- .AddFluentMigratorCore()
- .ConfigureRunner(rb => rb
- // Add SQL Server support to FluentMigrator
- .AddSqlServer()
- // Set the timeout
- .WithGlobalCommandTimeout(TimeSpan.Zero)
- // Set the connection string
- .WithGlobalConnectionString(ConfigurationManager.ConnectionStrings["ResgridContext"].ConnectionString)
- // Define the assembly containing the migrations
- .ScanIn(typeof(M0001_InitialMigration).Assembly).For.Migrations().For.EmbeddedResources())
- // Enable logging to console in the FluentMigrator way
- .AddLogging(lb => lb.AddFluentMigratorConsole())
- // Build the service provider
- .BuildServiceProvider(false);
+ if (Config.DataConfig.DatabaseType == Config.DatabaseTypes.Postgres)
+ {
+ return new ServiceCollection()
+ // Add common FluentMigrator services
+ .AddFluentMigratorCore()
+ .ConfigureRunner(rb => rb
+ // Add SQL Server support to FluentMigrator
+ .AddPostgres11_0()
+ // Set the connection string
+ .WithGlobalConnectionString(Config.DataConfig.CoreConnectionString)
+ // Define the assembly containing the migrations
+ .ScanIn(typeof(M0001_InitialMigrationPg).Assembly).For.Migrations().For.EmbeddedResources())
+ // Enable logging to console in the FluentMigrator way
+ .AddLogging(lb => lb.AddFluentMigratorConsole())
+ // Build the service provider
+ .BuildServiceProvider(false);
+ }
+ else
+ {
+ return new ServiceCollection()
+ // Add common FluentMigrator services
+ .AddFluentMigratorCore()
+ .ConfigureRunner(rb => rb
+ // Add SQL Server support to FluentMigrator
+ .AddSqlServer()
+ // Set the connection string
+ .WithGlobalConnectionString(System.Configuration.ConfigurationManager.ConnectionStrings["ResgridContext"].ConnectionString)
+ // Define the assembly containing the migrations
+ .ScanIn(typeof(M0001_InitialMigration).Assembly).For.Migrations().For.EmbeddedResources())
+ // Enable logging to console in the FluentMigrator way
+ .AddLogging(lb => lb.AddFluentMigratorConsole())
+ // Build the service provider
+ .BuildServiceProvider(false);
+ }
}
///
diff --git a/Tools/Resgrid.Console/Properties/launchSettings.json b/Tools/Resgrid.Console/Properties/launchSettings.json
index 00e18d7d..38e45c70 100644
--- a/Tools/Resgrid.Console/Properties/launchSettings.json
+++ b/Tools/Resgrid.Console/Properties/launchSettings.json
@@ -2,7 +2,7 @@
"profiles": {
"Resgrid.Console": {
"commandName": "Project",
- "commandLineArgs": "--MigrateDocsDb"
+ "commandLineArgs": "--DbUpdate"
}
}
}
\ No newline at end of file
diff --git a/Web/Resgrid.Web.Eventing/Resgrid.Web.Eventing.csproj b/Web/Resgrid.Web.Eventing/Resgrid.Web.Eventing.csproj
index ea4e7049..42d03b8f 100644
--- a/Web/Resgrid.Web.Eventing/Resgrid.Web.Eventing.csproj
+++ b/Web/Resgrid.Web.Eventing/Resgrid.Web.Eventing.csproj
@@ -61,6 +61,7 @@
+
diff --git a/Web/Resgrid.Web.Eventing/Startup.cs b/Web/Resgrid.Web.Eventing/Startup.cs
index 6bd2ea1e..dc753354 100644
--- a/Web/Resgrid.Web.Eventing/Startup.cs
+++ b/Web/Resgrid.Web.Eventing/Startup.cs
@@ -49,6 +49,7 @@
using Org.BouncyCastle.Asn1.Ess;
using IPNetwork = Microsoft.AspNetCore.HttpOverrides.IPNetwork;
using System.Net.Http;
+using Resgrid.Providers.Messaging;
namespace Resgrid.Web.Eventing
{
@@ -75,7 +76,7 @@ public Startup(IHostingEnvironment env)
public void ConfigureServices(IServiceCollection services)
{
IdentityModelEventSource.ShowPII = true;
-
+
bool configResult = ConfigProcessor.LoadAndProcessConfig(Configuration["AppOptions:ConfigPath"]);
bool envConfigResult = ConfigProcessor.LoadAndProcessEnvVariables(Configuration.AsEnumerable());
@@ -284,10 +285,10 @@ public void ConfigureServices(IServiceCollection services)
options.RequireHttpsMetadata = false;
options.Audience = JwtConfig.Audience;
options.TokenValidationParameters = tokenValidationParameters;
-
+
// We have to hook the OnMessageReceived event in order to
// allow the JWT authentication handler to read the access
- // token from the query string when a WebSocket or
+ // token from the query string when a WebSocket or
// Server-Sent Events request comes in.
// Sending the access token in the query string is required due to
@@ -337,6 +338,7 @@ public void ConfigureContainer(ContainerBuilder builder)
builder.RegisterModule(new MarketingModule());
builder.RegisterModule(new PdfProviderModule());
builder.RegisterModule(new FirebaseProviderModule());
+ builder.RegisterModule(new MessagingProviderModule());
builder.RegisterType().As>().InstancePerLifetimeScope();
builder.RegisterType().As>().InstancePerLifetimeScope();
diff --git a/Web/Resgrid.Web.ServicesCore/Controllers/v4/ConfigController.cs b/Web/Resgrid.Web.ServicesCore/Controllers/v4/ConfigController.cs
index 898ed809..0bd74ea8 100644
--- a/Web/Resgrid.Web.ServicesCore/Controllers/v4/ConfigController.cs
+++ b/Web/Resgrid.Web.ServicesCore/Controllers/v4/ConfigController.cs
@@ -73,6 +73,11 @@ public async Task> GetConfig(string key)
result.Data.PersonnelLocationMinMeters = MappingConfig.PersonnelLocationMinMeters;
result.Data.UnitLocationMinMeters = MappingConfig.UnitLocationMinMeters;
+ result.Data.NovuEnvironmentId = ChatConfig.NovuEnvironmentId;
+ result.Data.NovuApplicationId = ChatConfig.NovuApplicationId;
+ result.Data.NovuBackendApiUrl = ChatConfig.NovuBackendUrl;
+ result.Data.NovuSocketUrl = ChatConfig.NovuSocketUrl;
+
result.PageSize = 1;
result.Status = ResponseHelper.Success;
ResponseHelper.PopulateV4ResponseData(result);
diff --git a/Web/Resgrid.Web.ServicesCore/Controllers/v4/SecurityController.cs b/Web/Resgrid.Web.ServicesCore/Controllers/v4/SecurityController.cs
index 4ea42565..92d74792 100644
--- a/Web/Resgrid.Web.ServicesCore/Controllers/v4/SecurityController.cs
+++ b/Web/Resgrid.Web.ServicesCore/Controllers/v4/SecurityController.cs
@@ -6,6 +6,7 @@
using Resgrid.Web.Services.Helpers;
using Resgrid.Web.Services.Models.v4.Security;
using Resgrid.Model;
+using Resgrid.Model.Providers;
namespace Resgrid.Web.Services.Controllers.v4
{
@@ -23,18 +24,21 @@ public class SecurityController : V4AuthenticatedApiControllerbase
private readonly IPermissionsService _permissionsService;
private readonly IPersonnelRolesService _personnelRolesService;
private readonly IUserProfileService _userProfileService;
+ private readonly INovuProvider _novuProvider;
///
/// Operations to perform against the security sub-system
///
public SecurityController(IDepartmentsService departmentsService, IDepartmentGroupsService departmentGroupsService,
- IPermissionsService permissionsService, IPersonnelRolesService personnelRolesService, IUserProfileService userProfileService)
+ IPermissionsService permissionsService, IPersonnelRolesService personnelRolesService, IUserProfileService userProfileService,
+ INovuProvider novuProvider)
{
_departmentsService = departmentsService;
_departmentGroupsService = departmentGroupsService;
_permissionsService = permissionsService;
_personnelRolesService = personnelRolesService;
_userProfileService = userProfileService;
+ _novuProvider = novuProvider;
}
#endregion Members and Constructors
@@ -95,6 +99,8 @@ public async Task> GetCurrentUsersRights()
result.Data.CanAddNote = _permissionsService.IsUserAllowed(createNotePermission, result.Data.IsAdmin, isGroupAdmin, roles);
result.Data.CanCreateMessage = _permissionsService.IsUserAllowed(createMessagePermission, result.Data.IsAdmin, isGroupAdmin, roles);
+ var novuSuccess = await _novuProvider.CreateSubscriber(UserId, DepartmentId, profile.MembershipEmail, profile.FirstName, profile.LastName);
+
result.PageSize = 1;
result.Status = ResponseHelper.Success;
ResponseHelper.PopulateV4ResponseData(result);
diff --git a/Web/Resgrid.Web.ServicesCore/Models/v4/Configs/GetConfigResult.cs b/Web/Resgrid.Web.ServicesCore/Models/v4/Configs/GetConfigResult.cs
index 310cc061..f1c4faf7 100644
--- a/Web/Resgrid.Web.ServicesCore/Models/v4/Configs/GetConfigResult.cs
+++ b/Web/Resgrid.Web.ServicesCore/Models/v4/Configs/GetConfigResult.cs
@@ -85,5 +85,25 @@ public class GetConfigResultData
/// API Key for the OpenWeatherAPI
///
public string OpenWeatherApiKey { get; set; }
+
+ ///
+ /// API url for Novu
+ ///
+ public string NovuBackendApiUrl { get; set; }
+
+ ///
+ /// Websocket url for Novu
+ ///
+ public string NovuSocketUrl { get; set; }
+
+ ///
+ /// Novu Application Id
+ ///
+ public string NovuApplicationId { get; set; }
+
+ ///
+ /// Novu Environment Id
+ ///
+ public string NovuEnvironmentId { get; set; }
}
}
diff --git a/Web/Resgrid.Web.ServicesCore/Resgrid.Web.Services.xml b/Web/Resgrid.Web.ServicesCore/Resgrid.Web.Services.xml
index 84ef8d3a..a23d6fea 100644
--- a/Web/Resgrid.Web.ServicesCore/Resgrid.Web.Services.xml
+++ b/Web/Resgrid.Web.ServicesCore/Resgrid.Web.Services.xml
@@ -2425,6 +2425,52 @@
Is the user a group admin
+
+
+ UserId (GUID/UUID) of the User to set. This field will be ignored if the input is used on a
+ function that is setting status for the current user.
+
+
+
+
+ The state/staffing level of the user to set for the user.
+
+
+
+
+ Note for the staffing level
+
+
+
+
+ The result object for a state/staffing level request.
+
+
+
+
+ The UserId GUID/UUID for the user state/staffing level being return
+
+
+
+
+ The full name of the user for the state/staffing level being returned
+
+
+
+
+ The current staffing level (state) type for the user
+
+
+
+
+ The timestamp of the last state/staffing level. This is converted UTC to the departments, or users, TimeZone.
+
+
+
+
+ Staffing note for the User's staffing
+
+
Input data to add a staffing schedule in the Resgrid system
@@ -2530,52 +2576,6 @@
Note for this staffing schedule
-
-
- UserId (GUID/UUID) of the User to set. This field will be ignored if the input is used on a
- function that is setting status for the current user.
-
-
-
-
- The state/staffing level of the user to set for the user.
-
-
-
-
- Note for the staffing level
-
-
-
-
- The result object for a state/staffing level request.
-
-
-
-
- The UserId GUID/UUID for the user state/staffing level being return
-
-
-
-
- The full name of the user for the state/staffing level being returned
-
-
-
-
- The current staffing level (state) type for the user
-
-
-
-
- The timestamp of the last state/staffing level. This is converted UTC to the departments, or users, TimeZone.
-
-
-
-
- Staffing note for the User's staffing
-
-
A resrouce in the system this could be a user or unit
@@ -3765,7 +3765,7 @@
Call Priorities, for example Low, Medium, High. Call Priorities can be system provided ones or custom for a department
-
+
Operations to perform against the security sub-system
@@ -5368,6 +5368,26 @@
API Key for the OpenWeatherAPI
+
+
+ API url for Novu
+
+
+
+
+ Websocket url for Novu
+
+
+
+
+ Novu Application Id
+
+
+
+
+ Novu Environment Id
+
+
Custom defined Status for Personnel and Units
@@ -6308,194 +6328,359 @@
Identifier of the new npte
-
+
- A GPS location for a point in time of a specificed person
+ The result of getting all personnel filters for the system
-
+
- PersonId of the person that the location is for
+ The Id value of the filter
-
+
- The timestamp of the location in UTC
+ The type of the filter
-
+
- GPS Latitude of the Person
+ The filters name
-
+
- GPS Longitude of the Person
+ Result containing all the data required to populate the New Call form
-
+
- GPS Latitude\Longitude Accuracy of the Person
+ Response Data
-
+
- GPS Altitude of the Person
+ Result that contains all the options available to filter personnel against compatible Resgrid APIs
-
+
- GPS Altitude Accuracy of the Person
+ Response Data
-
+
- GPS Speed of the Person
+ Result containing all the data required to populate the New Call form
-
+
- GPS Heading of the Person
+ Response Data
-
+
- A unit location in the Resgrid system
+ Information about a User
-
+
- Response Data
+ The UserId GUID/UUID for the user
-
+
- The information about a specific unit's location
+ DepartmentId of the deparment the user belongs to
-
+
- Id of the Person
+ Department specificed ID number for this user
-
+
- The Timestamp for the location in UTC
+ The Users First Name
-
+
- GPS Latitude of the Person
+ The Users Last Name
-
+
- GPS Longitude of the Person
+ The Users Email Address
-
+
- GPS Latitude\Longitude Accuracy of the Person
+ The Users Mobile Telephone Number
-
+
- GPS Altitude of the Person
+ GroupId the user is assigned to (0 for no group)
-
+
- GPS Altitude Accuracy of the Person
+ Name of the group the user is assigned to
-
+
- GPS Speed of the Person
+ Enumeration/List of roles the user currently holds
-
+
- GPS Heading of the Person
+ The current action/status type for the user
-
+
- The result of getting the current staffing for a user
+ The current action/status string for the user
-
+
- Response Data
+ The current action/status color hex string for the user
-
+
- Information about a User staffing
+ The timestamp of the last action. This is converted UTC to the departments, or users, TimeZone.
-
+
- The UserId GUID/UUID for the user status being return
+ The current action/status destination id for the user
-
+
- DepartmentId of the deparment the user belongs to
+ The current action/status destination name for the user
-
+
- The current staffing type for the user
+ The current staffing level (state) type for the user
-
+
- The timestamp of the last staffing. This is converted UTC version of the timestamp.
+ The current staffing level (state) string for the user
-
+
- The timestamp of the last staffing. This is converted UTC to the departments, or users, TimeZone.
+ The current staffing level (state) color hex string for the user
-
+
- Note for this staffing
+ The timestamp of the last state/staffing level. This is converted UTC to the departments, or users, TimeZone.
-
+
- Saves (sets) and Personnel Staffing in the system, for a single user
+ Users last known location
-
+
- UnitId of the apparatus that the state is being set for
+ Sorting weight for the user
-
+
- The UnitStateType of the Unit
+ A GPS location for a point in time of a specificed person
-
+
- The timestamp of the status event in UTC
+ PersonId of the person that the location is for
-
+
- The timestamp of the status event in the local time of the device
+ The timestamp of the location in UTC
-
+
- User provided note for this event
+ GPS Latitude of the Person
-
+
- The event id used for queuing on mobile applications
+ GPS Longitude of the Person
+
+
+
+
+ GPS Latitude\Longitude Accuracy of the Person
+
+
+
+
+ GPS Altitude of the Person
+
+
+
+
+ GPS Altitude Accuracy of the Person
+
+
+
+
+ GPS Speed of the Person
+
+
+
+
+ GPS Heading of the Person
+
+
+
+
+ A unit location in the Resgrid system
+
+
+
+
+ Response Data
+
+
+
+
+ The information about a specific unit's location
+
+
+
+
+ Id of the Person
+
+
+
+
+ The Timestamp for the location in UTC
+
+
+
+
+ GPS Latitude of the Person
+
+
+
+
+ GPS Longitude of the Person
+
+
+
+
+ GPS Latitude\Longitude Accuracy of the Person
+
+
+
+
+ GPS Altitude of the Person
+
+
+
+
+ GPS Altitude Accuracy of the Person
+
+
+
+
+ GPS Speed of the Person
+
+
+
+
+ GPS Heading of the Person
+
+
+
+
+ The result of getting the current staffing for a user
+
+
+
+
+ Response Data
+
+
+
+
+ Information about a User staffing
+
+
+
+
+ The UserId GUID/UUID for the user status being return
+
+
+
+
+ DepartmentId of the deparment the user belongs to
+
+
+
+
+ The current staffing type for the user
+
+
+
+
+ The timestamp of the last staffing. This is converted UTC version of the timestamp.
+
+
+
+
+ The timestamp of the last staffing. This is converted UTC to the departments, or users, TimeZone.
+
+
+
+
+ Note for this staffing
+
+
+
+
+ Saves (sets) and Personnel Staffing in the system, for a single user
+
+
+
+
+ UnitId of the apparatus that the state is being set for
+
+
+
+
+ The UnitStateType of the Unit
+
+
+
+
+ The timestamp of the status event in UTC
+
+
+
+
+ The timestamp of the status event in the local time of the device
+
+
+
+
+ User provided note for this event
+
+
+
+
+ The event id used for queuing on mobile applications
@@ -6783,282 +6968,117 @@
Response Data
-
+
- The result of getting all personnel filters for the system
+ Result containing all the data required to populate the New Call form
-
+
- The Id value of the filter
+ Response Data
-
+
- The type of the filter
+ Details of a protocol
-
+
- The filters name
+ Protocol id
-
+
- Result containing all the data required to populate the New Call form
+ Department id
-
+
- Response Data
+ Name of the Protocol
-
+
- Result that contains all the options available to filter personnel against compatible Resgrid APIs
+ Protocol code
-
+
- Response Data
+ This this protocol disabled
-
+
- Result containing all the data required to populate the New Call form
+ Protocol description
-
+
- Response Data
+ Text of the protocol
-
+
- Information about a User
+ UTC date and time when the Protocol was created
-
+
- The UserId GUID/UUID for the user
+ UserId of the user who created the protocol
-
+
- DepartmentId of the deparment the user belongs to
+ UTC timestamp of when the Protocol was updated
-
+
- Department specificed ID number for this user
+ Minimum triggering Weight of the Protocol
-
+
- The Users First Name
+ UserId that last updated the Protocol
-
+
- The Users Last Name
+ Triggers used to activate this Protocol
-
+
- The Users Email Address
+ Attachments for this Protocol
-
+
- The Users Mobile Telephone Number
+ Questions used to determine if this Protocol needs to be used or not
-
+
- GroupId the user is assigned to (0 for no group)
+ State type
-
+
- Name of the group the user is assigned to
+ Result containing all the data required to populate the New Call form
-
+
- Enumeration/List of roles the user currently holds
+ Response Data
-
+
- The current action/status type for the user
+ A role in the Resgrid system
-
-
- The current action/status string for the user
-
-
-
-
- The current action/status color hex string for the user
-
-
-
-
- The timestamp of the last action. This is converted UTC to the departments, or users, TimeZone.
-
-
-
-
- The current action/status destination id for the user
-
-
-
-
- The current action/status destination name for the user
-
-
-
-
- The current staffing level (state) type for the user
-
-
-
-
- The current staffing level (state) string for the user
-
-
-
-
- The current staffing level (state) color hex string for the user
-
-
-
-
- The timestamp of the last state/staffing level. This is converted UTC to the departments, or users, TimeZone.
-
-
-
-
- Users last known location
-
-
-
-
- Sorting weight for the user
-
-
-
-
- Result containing all the data required to populate the New Call form
-
-
-
-
- Response Data
-
-
-
-
- Details of a protocol
-
-
-
-
- Protocol id
-
-
-
-
- Department id
-
-
-
-
- Name of the Protocol
-
-
-
-
- Protocol code
-
-
-
-
- This this protocol disabled
-
-
-
-
- Protocol description
-
-
-
-
- Text of the protocol
-
-
-
-
- UTC date and time when the Protocol was created
-
-
-
-
- UserId of the user who created the protocol
-
-
-
-
- UTC timestamp of when the Protocol was updated
-
-
-
-
- Minimum triggering Weight of the Protocol
-
-
-
-
- UserId that last updated the Protocol
-
-
-
-
- Triggers used to activate this Protocol
-
-
-
-
- Attachments for this Protocol
-
-
-
-
- Questions used to determine if this Protocol needs to be used or not
-
-
-
-
- State type
-
-
-
-
- Result containing all the data required to populate the New Call form
-
-
-
-
- Response Data
-
-
-
-
- A role in the Resgrid system
-
-
-
+
Response Data
@@ -7854,518 +7874,518 @@
Default constructor
-
+
- Depicts a result after saving a unit status
+ Result that contains all the options available to filter units against compatible Resgrid APIs
-
+
Response Data
-
+
- Object inputs for setting a users Status/Action. If this object is used in an operation that sets
- a status for the current user the UserId value in this object will be ignored.
+ A unit in the Resgrid system
-
+
- UnitId of the apparatus that the state is being set for
+ Response Data
-
+
- The UnitStateType of the Unit
+ The information about a specific unit
-
+
- The Call/Station the unit is responding to
+ Id of the Unit
-
+
- The timestamp of the status event in UTC
+ The Id of the department the unit is under
-
+
- The timestamp of the status event in the local time of the device
+ Name of the Unit
-
+
- User provided note for this event
+ Department assigned type for the unit
-
+
- GPS Latitude of the Unit
+ Department assigned type id for the unit
-
+
- GPS Longitude of the Unit
+ Custom Statuses Set Id
-
+
- GPS Latitude\Longitude Accuracy of the Unit
+ Station Id of the station housing the unit (0 means no station)
-
+
- GPS Altitude of the Unit
+ Name of the station the unit is under
-
+
- GPS Altitude Accuracy of the Unit
+ Vehicle Identification Number for the unit
-
+
- GPS Speed of the Unit
+ Plate Number for the Unit
-
+
- GPS Heading of the Unit
+ Is the unit 4-Wheel drive
-
+
- The event id used for queuing on mobile applications
+ Does the unit require a special permit to drive
-
+
- The accountability roles filed for this event
+ Id number of the units current destionation (0 means no destination)
-
+
- Role filled by a User on a Unit for an event
+ The current status/state of the Unit
-
+
- Id of the locally stored event
+ The Timestamp of the status
-
+
- Local Event Id
+ The units current Latitude
-
+
- UserId of the user filling the role
+ The units current Longitude
-
+
- RoleId of the role being filled
+ Current user provide status note
-
+
- The name of the Role
+ Unit role information for roles on a unit
-
+
- Depicts a unit status in the Resgrid system.
+ Unit Role Id
-
+
- Response Data
+ User Id of the user in the role (could be null)
-
+
- Depicts a unit's status
+ Name of the Role
-
+
- Unit Id
+ Name of the user in the role (could be null)
-
+
- Units Name
+ Multiple Unit infos Result
-
+
- The Type of the Unit
+ Response Data
-
+
- Units current Status (State)
+ Default constructor
-
+
- CSS for status (for display)
+ The information about a specific unit
-
+
- CSS Style for status (for display)
+ Id of the Unit
-
+
- Timestamp of this Unit State
+ The Id of the department the unit is under
-
+
- Timestamp in Utc of this Unit State
+ Name of the Unit
-
+
- Destination Id (Station or Call)
+ Department assigned type for the unit
-
+