Skip to content

Commit d84dcfc

Browse files
authored
Merge pull request #165 from Resgrid/develop
Develop
2 parents 4eae821 + 6450fbe commit d84dcfc

File tree

434 files changed

+5888
-901
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

434 files changed

+5888
-901
lines changed

Core/Resgrid.Config/DataConfig.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,43 @@
22
{
33
public class DataConfig
44
{
5+
/// <summary>
6+
/// The underlying database engine
7+
/// </summary>
8+
public static DatabaseTypes DatabaseType = DatabaseTypes.SqlServer;
9+
10+
/// <summary>
11+
/// The underlying database engine for the document database (does not support SqlServer)
12+
/// </summary>
13+
public static DatabaseTypes DocDatabaseType = DatabaseTypes.MongoDb;
14+
515
public static string ConnectionString = "Server=rgdevserver;Database=Resgrid;User Id=resgrid_app;Password=resgrid123;MultipleActiveResultSets=True;TrustServerCertificate=True;";
616

17+
/// <summary>
18+
/// Connection string for the core relational Resgrid database
19+
/// </summary>
20+
public static string CoreConnectionString = "";
21+
22+
/// <summary>
23+
/// Connection string for storing JSON document types (Postgres)
24+
/// </summary>
25+
public static string DocumentConnectionString = "";
26+
27+
728
public static string NoSqlConnectionString = "mongodb://resgrid:resgrid123@rgdevserver:27017";
829
public static string NoSqlDatabaseName = "resgrid";
930
public static string NoSqlApplicationName = "Resgrid";
1031

1132
public static string UsersIdentityRoleId = "38b461d7-e848-46ef-8c06-ece5b618d9d1";
1233
public static string AdminsIdentityRoleId = "1f6a03a8-62f4-4179-80fc-2eb96266cf04";
1334
public static string AffiliatesIdentityRoleId = "3aba8863-e46d-40cc-ab86-309f9c3e4f97";
35+
public static string QueryPrefix = "";
36+
}
37+
38+
public enum DatabaseTypes
39+
{
40+
SqlServer,
41+
Postgres,
42+
MongoDb
1443
}
1544
}

Core/Resgrid.Config/OidcConfig.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ namespace Resgrid.Config
66
{
77
public static class OidcConfig
88
{
9+
/// <summary>
10+
/// The underlying database engine for the OIDC database (Does not support Mongo)
11+
/// </summary>
12+
public static DatabaseTypes DatabaseType = DatabaseTypes.SqlServer;
13+
914
public static string Key = "";
1015

1116
public static string ConnectionString = "Server=rgdevserver;Database=ResgridOIDC;User Id=resgrid_odic;Password=resgrid123;MultipleActiveResultSets=True;TrustServerCertificate=True;";

Core/Resgrid.Config/WorkerConfig.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
{
33
public static class WorkerConfig
44
{
5+
/// <summary>
6+
/// The underlying database engine for the worker database (Does not support Mongo)
7+
/// </summary>
8+
public static DatabaseTypes DatabaseType = DatabaseTypes.SqlServer;
9+
510
public static string WorkerDbConnectionString = "Server=rgdevserver;Database=ResgridWorkers;User Id=resgrid_workers;Password=resgrid123;MultipleActiveResultSets=True;";
611
public static string PayloadKey = "XsBYpdbdHkhuGsU3tvTMawyV6d3M2F8EQ8wQ2jVLBREECQmwngACk2hm4Ykb7eW7Qsm6za8RdJBY5Z3xvN6erYry47nJ5XmL";
712
}

Core/Resgrid.Model/MapLayer.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,43 +12,67 @@ namespace Resgrid.Model
1212
public class MapLayer: NoSqlDocument
1313
{
1414
[BsonElement("departmentId")]
15+
[JsonProperty(PropertyName = "departmentId")]
1516
public int DepartmentId { get; set; }
1617

1718
[Required]
1819
[MaxLength(250)]
1920
[BsonElement("name")]
21+
[JsonProperty(PropertyName = "name")]
2022
public string Name { get; set; }
2123

2224
[BsonElement("type")]
25+
[JsonProperty(PropertyName = "type")]
2326
public int Type { get; set; }
2427

2528
[Required]
2629
[MaxLength(50)]
2730
[BsonElement("color")]
31+
[JsonProperty(PropertyName = "color")]
2832
public string Color { get; set; }
2933

3034
[BsonElement("data")]
35+
[JsonProperty(PropertyName = "data")]
3136
public MapLayerData Data { get; set; }
3237

3338
[BsonElement("isSearchable")]
39+
[JsonProperty(PropertyName = "isSearchable")]
3440
public bool IsSearchable { get; set; }
3541

3642
[BsonElement("isOnByDefault")]
43+
[JsonProperty(PropertyName = "isOnByDefault")]
3744
public bool IsOnByDefault { get; set; }
3845

3946
[BsonElement("addedById")]
47+
[JsonProperty(PropertyName = "addedById")]
4048
public string AddedById { get; set; }
4149

4250
[BsonElement("addedOn")]
51+
[JsonProperty(PropertyName = "addedOn")]
4352
public DateTime AddedOn { get; set; }
4453

4554
[BsonElement("isDeleted")]
55+
[JsonProperty(PropertyName = "isDeleted")]
4656
public bool IsDeleted { get; set; }
4757

4858
[BsonElement("updatedById")]
59+
[JsonProperty(PropertyName = "updatedById")]
4960
public string UpdatedById { get; set; }
5061

5162
[BsonElement("updatedOn")]
63+
[JsonProperty(PropertyName = "updatedOn")]
5264
public DateTime UpdatedOn { get; set; }
65+
66+
[BsonIgnore()]
67+
[JsonProperty(PropertyName = "id")]
68+
public string PgId { get; set; }
69+
70+
public string GetId()
71+
{
72+
if (!String.IsNullOrWhiteSpace(PgId))
73+
return PgId;
74+
75+
return Id.ToString();
76+
}
5377
}
5478
}

Core/Resgrid.Model/PersonnelLocation.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,16 @@ public class PersonnelLocation : NoSqlDocument
3939

4040
[BsonElement("heading")]
4141
public decimal? Heading { get; set; }
42+
43+
[BsonIgnore()]
44+
public string PgId { get; set; }
45+
46+
public string GetId()
47+
{
48+
if (!String.IsNullOrWhiteSpace(PgId))
49+
return PgId;
50+
51+
return Id.ToString();
52+
}
4253
}
4354
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System.Collections.Generic;
2+
using System.Threading.Tasks;
3+
4+
namespace Resgrid.Model.Repositories
5+
{
6+
public interface IMapLayersDocRepository
7+
{
8+
Task<List<MapLayer>> GetAllMapLayersByDepartmentIdAsync(int departmentId, MapLayerTypes type);
9+
Task<MapLayer> GetByIdAsync(string id);
10+
Task<MapLayer> GetByOldIdAsync(string id);
11+
Task<MapLayer> InsertAsync(MapLayer mapLayer);
12+
Task<MapLayer> UpdateAsync(MapLayer mapLayer);
13+
}
14+
}

Core/Resgrid.Model/Repositories/IOidcRepository.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace Resgrid.Model.Repositories
1+
using System.Threading.Tasks;
2+
3+
namespace Resgrid.Model.Repositories
24
{
35
/// <summary>
46
/// Interface IOidcRepository
@@ -9,6 +11,6 @@ public interface IOidcRepository
911
/// Updates the Oidc Database
1012
/// </summary>
1113
/// <returns>If the operation was successful</returns>
12-
bool UpdateOidcDatabase();
14+
Task<bool> UpdateOidcDatabaseAsync();
1315
}
1416
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System.Collections.Generic;
2+
using System.Threading.Tasks;
3+
4+
namespace Resgrid.Model.Repositories
5+
{
6+
public interface IPersonnelLocationsDocRepository
7+
{
8+
Task<List<PersonnelLocation>> GetAllLocationsByUnitIdAsync(string userId);
9+
Task<PersonnelLocation> GetLatestLocationsByUnitIdAsync(string userId);
10+
Task<List<PersonnelLocation>> GetLatestLocationsByDepartmentIdAsync(int departmentId);
11+
Task<PersonnelLocation> GetByIdAsync(string id);
12+
Task<PersonnelLocation> GetByOldIdAsync(string id);
13+
Task<PersonnelLocation> InsertAsync(PersonnelLocation location);
14+
}
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System.Collections.Generic;
2+
using System.Threading.Tasks;
3+
4+
namespace Resgrid.Model.Repositories
5+
{
6+
public interface IUnitLocationsDocRepository
7+
{
8+
Task<List<UnitsLocation>> GetAllLocationsByUnitIdAsync(int unitId);
9+
Task<UnitsLocation> GetLatestLocationsByUnitIdAsync(int unitId);
10+
Task<List<UnitsLocation>> GetLatestLocationsByDepartmentIdAsync(int departmentId);
11+
Task<UnitsLocation> GetByIdAsync(string id);
12+
Task<UnitsLocation> GetByOldIdAsync(string id);
13+
Task<UnitsLocation> InsertAsync(UnitsLocation location);
14+
}
15+
}

Core/Resgrid.Model/UnitsLocation.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,16 @@ public class UnitsLocation : NoSqlDocument
3939

4040
[BsonElement("heading")]
4141
public decimal? Heading { get; set; }
42+
43+
[BsonIgnore()]
44+
public string PgId { get; set; }
45+
46+
public string GetId()
47+
{
48+
if (!String.IsNullOrWhiteSpace(PgId))
49+
return PgId;
50+
51+
return Id.ToString();
52+
}
4253
}
4354
}

0 commit comments

Comments
 (0)