mirror of
https://github.com/hargata/lubelog.git
synced 2026-02-03 17:53:02 -06:00
backend for managing equipments
This commit is contained in:
parent
c3ef5f4a5e
commit
331ebccaa1
@ -158,7 +158,7 @@ namespace CarCareTracker.Controllers
|
|||||||
Files = result.Files,
|
Files = result.Files,
|
||||||
Tags = result.Tags,
|
Tags = result.Tags,
|
||||||
ExtraFields = StaticHelper.AddExtraFields(result.ExtraFields, _extraFieldDataAccess.GetExtraFieldsById((int)ImportMode.OdometerRecord).ExtraFields),
|
ExtraFields = StaticHelper.AddExtraFields(result.ExtraFields, _extraFieldDataAccess.GetExtraFieldsById((int)ImportMode.OdometerRecord).ExtraFields),
|
||||||
EquipmentId = result.EquipmentId
|
EquipmentRecordId = result.EquipmentRecordId
|
||||||
};
|
};
|
||||||
return PartialView("Odometer/_OdometerRecordModal", convertedResult);
|
return PartialView("Odometer/_OdometerRecordModal", convertedResult);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,6 +29,7 @@ namespace CarCareTracker.Controllers
|
|||||||
private readonly IOdometerRecordDataAccess _odometerRecordDataAccess;
|
private readonly IOdometerRecordDataAccess _odometerRecordDataAccess;
|
||||||
private readonly IInspectionRecordDataAccess _inspectionRecordDataAccess;
|
private readonly IInspectionRecordDataAccess _inspectionRecordDataAccess;
|
||||||
private readonly IInspectionRecordTemplateDataAccess _inspectionRecordTemplateDataAccess;
|
private readonly IInspectionRecordTemplateDataAccess _inspectionRecordTemplateDataAccess;
|
||||||
|
private readonly IEquipmentRecordDataAccess _equipmentRecordTemplateDataAccess;
|
||||||
private readonly IWebHostEnvironment _webEnv;
|
private readonly IWebHostEnvironment _webEnv;
|
||||||
private readonly IConfigHelper _config;
|
private readonly IConfigHelper _config;
|
||||||
private readonly IFileHelper _fileHelper;
|
private readonly IFileHelper _fileHelper;
|
||||||
@ -64,7 +65,8 @@ namespace CarCareTracker.Controllers
|
|||||||
IWebHostEnvironment webEnv,
|
IWebHostEnvironment webEnv,
|
||||||
IConfigHelper config,
|
IConfigHelper config,
|
||||||
IInspectionRecordDataAccess inspectionRecordDataAccess,
|
IInspectionRecordDataAccess inspectionRecordDataAccess,
|
||||||
IInspectionRecordTemplateDataAccess inspectionRecordTemplateDataAccess)
|
IInspectionRecordTemplateDataAccess inspectionRecordTemplateDataAccess,
|
||||||
|
IEquipmentRecordDataAccess equipmentRecordTemplateDataAccess)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_dataAccess = dataAccess;
|
_dataAccess = dataAccess;
|
||||||
@ -84,13 +86,14 @@ namespace CarCareTracker.Controllers
|
|||||||
_planRecordTemplateDataAccess = planRecordTemplateDataAccess;
|
_planRecordTemplateDataAccess = planRecordTemplateDataAccess;
|
||||||
_inspectionRecordDataAccess = inspectionRecordDataAccess;
|
_inspectionRecordDataAccess = inspectionRecordDataAccess;
|
||||||
_inspectionRecordTemplateDataAccess = inspectionRecordTemplateDataAccess;
|
_inspectionRecordTemplateDataAccess = inspectionRecordTemplateDataAccess;
|
||||||
|
_equipmentRecordTemplateDataAccess = equipmentRecordTemplateDataAccess;
|
||||||
_odometerRecordDataAccess = odometerRecordDataAccess;
|
_odometerRecordDataAccess = odometerRecordDataAccess;
|
||||||
_extraFieldDataAccess = extraFieldDataAccess;
|
_extraFieldDataAccess = extraFieldDataAccess;
|
||||||
_userLogic = userLogic;
|
_userLogic = userLogic;
|
||||||
_odometerLogic = odometerLogic;
|
_odometerLogic = odometerLogic;
|
||||||
_vehicleLogic = vehicleLogic;
|
_vehicleLogic = vehicleLogic;
|
||||||
_webEnv = webEnv;
|
_webEnv = webEnv;
|
||||||
_config = config;
|
_config = config;
|
||||||
}
|
}
|
||||||
private int GetUserID()
|
private int GetUserID()
|
||||||
{
|
{
|
||||||
@ -167,6 +170,7 @@ namespace CarCareTracker.Controllers
|
|||||||
_planRecordTemplateDataAccess.DeleteAllPlanRecordTemplatesByVehicleId(vehicleId) &&
|
_planRecordTemplateDataAccess.DeleteAllPlanRecordTemplatesByVehicleId(vehicleId) &&
|
||||||
_inspectionRecordDataAccess.DeleteAllInspectionRecordsByVehicleId(vehicleId) &&
|
_inspectionRecordDataAccess.DeleteAllInspectionRecordsByVehicleId(vehicleId) &&
|
||||||
_inspectionRecordTemplateDataAccess.DeleteAllInspectionReportTemplatesByVehicleId(vehicleId) &&
|
_inspectionRecordTemplateDataAccess.DeleteAllInspectionReportTemplatesByVehicleId(vehicleId) &&
|
||||||
|
_equipmentRecordTemplateDataAccess.DeleteAllEquipmentRecordsByVehicleId(vehicleId) &&
|
||||||
_supplyRecordDataAccess.DeleteAllSupplyRecordsByVehicleId(vehicleId) &&
|
_supplyRecordDataAccess.DeleteAllSupplyRecordsByVehicleId(vehicleId) &&
|
||||||
_odometerRecordDataAccess.DeleteAllOdometerRecordsByVehicleId(vehicleId) &&
|
_odometerRecordDataAccess.DeleteAllOdometerRecordsByVehicleId(vehicleId) &&
|
||||||
_userLogic.DeleteAllAccessToVehicle(vehicleId) &&
|
_userLogic.DeleteAllAccessToVehicle(vehicleId) &&
|
||||||
@ -196,6 +200,7 @@ namespace CarCareTracker.Controllers
|
|||||||
_planRecordTemplateDataAccess.DeleteAllPlanRecordTemplatesByVehicleId(vehicleId) &&
|
_planRecordTemplateDataAccess.DeleteAllPlanRecordTemplatesByVehicleId(vehicleId) &&
|
||||||
_inspectionRecordDataAccess.DeleteAllInspectionRecordsByVehicleId(vehicleId) &&
|
_inspectionRecordDataAccess.DeleteAllInspectionRecordsByVehicleId(vehicleId) &&
|
||||||
_inspectionRecordTemplateDataAccess.DeleteAllInspectionReportTemplatesByVehicleId(vehicleId) &&
|
_inspectionRecordTemplateDataAccess.DeleteAllInspectionReportTemplatesByVehicleId(vehicleId) &&
|
||||||
|
_equipmentRecordTemplateDataAccess.DeleteAllEquipmentRecordsByVehicleId(vehicleId) &&
|
||||||
_supplyRecordDataAccess.DeleteAllSupplyRecordsByVehicleId(vehicleId) &&
|
_supplyRecordDataAccess.DeleteAllSupplyRecordsByVehicleId(vehicleId) &&
|
||||||
_odometerRecordDataAccess.DeleteAllOdometerRecordsByVehicleId(vehicleId) &&
|
_odometerRecordDataAccess.DeleteAllOdometerRecordsByVehicleId(vehicleId) &&
|
||||||
_userLogic.DeleteAllAccessToVehicle(vehicleId) &&
|
_userLogic.DeleteAllAccessToVehicle(vehicleId) &&
|
||||||
@ -1084,7 +1089,7 @@ namespace CarCareTracker.Controllers
|
|||||||
{
|
{
|
||||||
var existingRecord = _odometerRecordDataAccess.GetOdometerRecordById(recordId);
|
var existingRecord = _odometerRecordDataAccess.GetOdometerRecordById(recordId);
|
||||||
existingRecord.Id = default;
|
existingRecord.Id = default;
|
||||||
existingRecord.EquipmentId = new List<int>();
|
existingRecord.EquipmentRecordId = new List<int>();
|
||||||
foreach (int vehicleId in vehicleIds)
|
foreach (int vehicleId in vehicleIds)
|
||||||
{
|
{
|
||||||
existingRecord.VehicleId = vehicleId;
|
existingRecord.VehicleId = vehicleId;
|
||||||
|
|||||||
@ -14,6 +14,7 @@
|
|||||||
PlanRecord = 9,
|
PlanRecord = 9,
|
||||||
OdometerRecord = 10,
|
OdometerRecord = 10,
|
||||||
VehicleRecord = 11,
|
VehicleRecord = 11,
|
||||||
InspectionRecord = 12
|
InspectionRecord = 12,
|
||||||
|
EquipmentRecord = 13
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
54
External/Implementations/Litedb/EquipmentRecordDataAccess.cs
vendored
Normal file
54
External/Implementations/Litedb/EquipmentRecordDataAccess.cs
vendored
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
using CarCareTracker.External.Interfaces;
|
||||||
|
using CarCareTracker.Helper;
|
||||||
|
using CarCareTracker.Models;
|
||||||
|
using LiteDB;
|
||||||
|
|
||||||
|
namespace CarCareTracker.External.Implementations
|
||||||
|
{
|
||||||
|
public class EquipmentRecordDataAccess : IEquipmentRecordDataAccess
|
||||||
|
{
|
||||||
|
private ILiteDBHelper _liteDB { get; set; }
|
||||||
|
private static string tableName = "equipmentrecords";
|
||||||
|
public EquipmentRecordDataAccess(ILiteDBHelper liteDB)
|
||||||
|
{
|
||||||
|
_liteDB = liteDB;
|
||||||
|
}
|
||||||
|
public List<EquipmentRecord> GetEquipmentRecordsByVehicleId(int vehicleId)
|
||||||
|
{
|
||||||
|
var db = _liteDB.GetLiteDB();
|
||||||
|
var table = db.GetCollection<EquipmentRecord>(tableName);
|
||||||
|
var equipmentRecords = table.Find(Query.EQ(nameof(EquipmentRecord.VehicleId), vehicleId));
|
||||||
|
return equipmentRecords.ToList() ?? new List<EquipmentRecord>();
|
||||||
|
}
|
||||||
|
public EquipmentRecord GetEquipmentRecordById(int equipmentRecordId)
|
||||||
|
{
|
||||||
|
var db = _liteDB.GetLiteDB();
|
||||||
|
var table = db.GetCollection<EquipmentRecord>(tableName);
|
||||||
|
return table.FindById(equipmentRecordId);
|
||||||
|
}
|
||||||
|
public bool DeleteEquipmentRecordById(int equipmentRecordId)
|
||||||
|
{
|
||||||
|
var db = _liteDB.GetLiteDB();
|
||||||
|
var table = db.GetCollection<EquipmentRecord>(tableName);
|
||||||
|
table.Delete(equipmentRecordId);
|
||||||
|
db.Checkpoint();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public bool SaveEquipmentRecordToVehicle(EquipmentRecord equipmentRecord)
|
||||||
|
{
|
||||||
|
var db = _liteDB.GetLiteDB();
|
||||||
|
var table = db.GetCollection<EquipmentRecord>(tableName);
|
||||||
|
table.Upsert(equipmentRecord);
|
||||||
|
db.Checkpoint();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public bool DeleteAllEquipmentRecordsByVehicleId(int vehicleId)
|
||||||
|
{
|
||||||
|
var db = _liteDB.GetLiteDB();
|
||||||
|
var table = db.GetCollection<EquipmentRecord>(tableName);
|
||||||
|
var equipmentRecords = table.DeleteMany(Query.EQ(nameof(EquipmentRecord.VehicleId), vehicleId));
|
||||||
|
db.Checkpoint();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
161
External/Implementations/Postgres/EquipmentRecordDataAccess.cs
vendored
Normal file
161
External/Implementations/Postgres/EquipmentRecordDataAccess.cs
vendored
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
using CarCareTracker.External.Interfaces;
|
||||||
|
using CarCareTracker.Models;
|
||||||
|
using Npgsql;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
namespace CarCareTracker.External.Implementations
|
||||||
|
{
|
||||||
|
public class PGEquipmentRecordDataAccess : IEquipmentRecordDataAccess
|
||||||
|
{
|
||||||
|
private NpgsqlDataSource pgDataSource;
|
||||||
|
private readonly ILogger<PGEquipmentRecordDataAccess> _logger;
|
||||||
|
private static string tableName = "equipmentrecords";
|
||||||
|
public PGEquipmentRecordDataAccess(IConfiguration config, ILogger<PGEquipmentRecordDataAccess> logger)
|
||||||
|
{
|
||||||
|
pgDataSource = NpgsqlDataSource.Create(config["POSTGRES_CONNECTION"]);
|
||||||
|
|
||||||
|
_logger = logger;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//create table if not exist.
|
||||||
|
string initCMD = $"CREATE SCHEMA IF NOT EXISTS app; CREATE TABLE IF NOT EXISTS app.{tableName} (id INT GENERATED BY DEFAULT AS IDENTITY primary key, vehicleId INT not null, data jsonb not null)";
|
||||||
|
using (var ctext = pgDataSource.CreateCommand(initCMD))
|
||||||
|
{
|
||||||
|
ctext.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public List<EquipmentRecord> GetEquipmentRecordsByVehicleId(int vehicleId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string cmd = $"SELECT data FROM app.{tableName} WHERE vehicleId = @vehicleId";
|
||||||
|
var results = new List<EquipmentRecord>();
|
||||||
|
using (var ctext = pgDataSource.CreateCommand(cmd))
|
||||||
|
{
|
||||||
|
ctext.Parameters.AddWithValue("vehicleId", vehicleId);
|
||||||
|
using (NpgsqlDataReader reader = ctext.ExecuteReader())
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
EquipmentRecord equipmentRecord = JsonSerializer.Deserialize<EquipmentRecord>(reader["data"] as string);
|
||||||
|
results.Add(equipmentRecord);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex.Message);
|
||||||
|
return new List<EquipmentRecord>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public EquipmentRecord GetEquipmentRecordById(int equipmentRecordId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string cmd = $"SELECT data FROM app.{tableName} WHERE id = @id";
|
||||||
|
var result = new EquipmentRecord();
|
||||||
|
using (var ctext = pgDataSource.CreateCommand(cmd))
|
||||||
|
{
|
||||||
|
ctext.Parameters.AddWithValue("id", equipmentRecordId);
|
||||||
|
using (NpgsqlDataReader reader = ctext.ExecuteReader())
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
EquipmentRecord equipmentRecord = JsonSerializer.Deserialize<EquipmentRecord>(reader["data"] as string);
|
||||||
|
result = equipmentRecord;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex.Message);
|
||||||
|
return new EquipmentRecord();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool DeleteEquipmentRecordById(int equipmentRecordId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string cmd = $"DELETE FROM app.{tableName} WHERE id = @id";
|
||||||
|
using (var ctext = pgDataSource.CreateCommand(cmd))
|
||||||
|
{
|
||||||
|
ctext.Parameters.AddWithValue("id", equipmentRecordId);
|
||||||
|
return ctext.ExecuteNonQuery() > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex.Message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool SaveEquipmentRecordToVehicle(EquipmentRecord equipmentRecord)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (equipmentRecord.Id == default)
|
||||||
|
{
|
||||||
|
string cmd = $"INSERT INTO app.{tableName} (vehicleId, data) VALUES(@vehicleId, CAST(@data AS jsonb)) RETURNING id";
|
||||||
|
using (var ctext = pgDataSource.CreateCommand(cmd))
|
||||||
|
{
|
||||||
|
ctext.Parameters.AddWithValue("vehicleId", equipmentRecord.VehicleId);
|
||||||
|
ctext.Parameters.AddWithValue("data", "{}");
|
||||||
|
equipmentRecord.Id = Convert.ToInt32(ctext.ExecuteScalar());
|
||||||
|
//update json data
|
||||||
|
if (equipmentRecord.Id != default)
|
||||||
|
{
|
||||||
|
string cmdU = $"UPDATE app.{tableName} SET data = CAST(@data AS jsonb) WHERE id = @id";
|
||||||
|
using (var ctextU = pgDataSource.CreateCommand(cmdU))
|
||||||
|
{
|
||||||
|
var serializedData = JsonSerializer.Serialize(equipmentRecord);
|
||||||
|
ctextU.Parameters.AddWithValue("id", equipmentRecord.Id);
|
||||||
|
ctextU.Parameters.AddWithValue("data", serializedData);
|
||||||
|
return ctextU.ExecuteNonQuery() > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return equipmentRecord.Id != default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string cmd = $"UPDATE app.{tableName} SET data = CAST(@data AS jsonb) WHERE id = @id";
|
||||||
|
using (var ctext = pgDataSource.CreateCommand(cmd))
|
||||||
|
{
|
||||||
|
var serializedData = JsonSerializer.Serialize(equipmentRecord);
|
||||||
|
ctext.Parameters.AddWithValue("id", equipmentRecord.Id);
|
||||||
|
ctext.Parameters.AddWithValue("data", serializedData);
|
||||||
|
return ctext.ExecuteNonQuery() > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex.Message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool DeleteAllEquipmentRecordsByVehicleId(int vehicleId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string cmd = $"DELETE FROM app.{tableName} WHERE vehicleId = @id";
|
||||||
|
using (var ctext = pgDataSource.CreateCommand(cmd))
|
||||||
|
{
|
||||||
|
ctext.Parameters.AddWithValue("id", vehicleId);
|
||||||
|
ctext.ExecuteNonQuery();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex.Message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
13
External/Interfaces/IEquipmentRecordDataAccess.cs
vendored
Normal file
13
External/Interfaces/IEquipmentRecordDataAccess.cs
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using CarCareTracker.Models;
|
||||||
|
|
||||||
|
namespace CarCareTracker.External.Interfaces
|
||||||
|
{
|
||||||
|
public interface IEquipmentRecordDataAccess
|
||||||
|
{
|
||||||
|
public List<EquipmentRecord> GetEquipmentRecordsByVehicleId(int vehicleId);
|
||||||
|
public EquipmentRecord GetEquipmentRecordById(int serviceRecordId);
|
||||||
|
public bool DeleteEquipmentRecordById(int equipmentRecordId);
|
||||||
|
public bool SaveEquipmentRecordToVehicle(EquipmentRecord serviceRecord);
|
||||||
|
public bool DeleteAllEquipmentRecordsByVehicleId(int vehicleId);
|
||||||
|
}
|
||||||
|
}
|
||||||
14
Models/EquipmentRecord/EquipmentRecord.cs
Normal file
14
Models/EquipmentRecord/EquipmentRecord.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
namespace CarCareTracker.Models
|
||||||
|
{
|
||||||
|
public class EquipmentRecord
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int VehicleId { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
public bool IsEquipped { get; set; }
|
||||||
|
public string Notes { get; set; }
|
||||||
|
public List<string> Tags { get; set; } = new List<string>();
|
||||||
|
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
||||||
|
public List<ExtraField> ExtraFields { get; set; } = new List<ExtraField>();
|
||||||
|
}
|
||||||
|
}
|
||||||
27
Models/EquipmentRecord/EquipmentRecordInput.cs
Normal file
27
Models/EquipmentRecord/EquipmentRecordInput.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
namespace CarCareTracker.Models
|
||||||
|
{
|
||||||
|
public class EquipmentRecordInput
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int VehicleId { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
public bool IsEquipped { get; set; }
|
||||||
|
public string Notes { get; set; }
|
||||||
|
public List<string> Tags { get; set; } = new List<string>();
|
||||||
|
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
||||||
|
public List<ExtraField> ExtraFields { get; set; } = new List<ExtraField>();
|
||||||
|
public EquipmentRecord ToEquipmentRecord() {
|
||||||
|
return new EquipmentRecord
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
VehicleId = VehicleId,
|
||||||
|
Description = Description,
|
||||||
|
IsEquipped = IsEquipped,
|
||||||
|
Notes = Notes,
|
||||||
|
Files = Files,
|
||||||
|
Tags = Tags,
|
||||||
|
ExtraFields = ExtraFields
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
15
Models/EquipmentRecord/EquipmentRecordViewModel.cs
Normal file
15
Models/EquipmentRecord/EquipmentRecordViewModel.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
namespace CarCareTracker.Models
|
||||||
|
{
|
||||||
|
public class EquipmentRecordViewModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int VehicleId { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
public bool IsEquipped { get; set; }
|
||||||
|
public string Notes { get; set; }
|
||||||
|
public List<string> Tags { get; set; } = new List<string>();
|
||||||
|
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
||||||
|
public List<ExtraField> ExtraFields { get; set; } = new List<ExtraField>();
|
||||||
|
public int DistanceTraveled { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -12,6 +12,6 @@
|
|||||||
public List<string> Tags { get; set; } = new List<string>();
|
public List<string> Tags { get; set; } = new List<string>();
|
||||||
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
||||||
public List<ExtraField> ExtraFields { get; set; } = new List<ExtraField>();
|
public List<ExtraField> ExtraFields { get; set; } = new List<ExtraField>();
|
||||||
public List<int> EquipmentId { get; set; } = new List<int>();
|
public List<int> EquipmentRecordId { get; set; } = new List<int>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
||||||
public List<string> Tags { get; set; } = new List<string>();
|
public List<string> Tags { get; set; } = new List<string>();
|
||||||
public List<ExtraField> ExtraFields { get; set; } = new List<ExtraField>();
|
public List<ExtraField> ExtraFields { get; set; } = new List<ExtraField>();
|
||||||
public List<int> EquipmentId { get; set; } = new List<int>();
|
public List<int> EquipmentRecordId { get; set; } = new List<int>();
|
||||||
public OdometerRecord ToOdometerRecord() { return new OdometerRecord {
|
public OdometerRecord ToOdometerRecord() { return new OdometerRecord {
|
||||||
Id = Id,
|
Id = Id,
|
||||||
VehicleId = VehicleId,
|
VehicleId = VehicleId,
|
||||||
@ -22,7 +22,7 @@
|
|||||||
Tags = Tags,
|
Tags = Tags,
|
||||||
ExtraFields = ExtraFields,
|
ExtraFields = ExtraFields,
|
||||||
InitialMileage = InitialMileage,
|
InitialMileage = InitialMileage,
|
||||||
EquipmentId = EquipmentId
|
EquipmentRecordId = EquipmentRecordId
|
||||||
}; }
|
}; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -60,6 +60,7 @@ if (!string.IsNullOrWhiteSpace(builder.Configuration["POSTGRES_CONNECTION"])){
|
|||||||
builder.Services.AddSingleton<IExtraFieldDataAccess, PGExtraFieldDataAccess>();
|
builder.Services.AddSingleton<IExtraFieldDataAccess, PGExtraFieldDataAccess>();
|
||||||
builder.Services.AddSingleton<IInspectionRecordDataAccess, PGInspectionRecordDataAccess>();
|
builder.Services.AddSingleton<IInspectionRecordDataAccess, PGInspectionRecordDataAccess>();
|
||||||
builder.Services.AddSingleton<IInspectionRecordTemplateDataAccess, PGInspectionRecordTemplateDataAccess>();
|
builder.Services.AddSingleton<IInspectionRecordTemplateDataAccess, PGInspectionRecordTemplateDataAccess>();
|
||||||
|
builder.Services.AddSingleton<IEquipmentRecordDataAccess, PGEquipmentRecordDataAccess>();
|
||||||
builder.Services.AddSingleton<IUserHouseholdDataAccess, PGUserHouseholdDataAccess>();
|
builder.Services.AddSingleton<IUserHouseholdDataAccess, PGUserHouseholdDataAccess>();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -83,6 +84,7 @@ else
|
|||||||
builder.Services.AddSingleton<IExtraFieldDataAccess, ExtraFieldDataAccess>();
|
builder.Services.AddSingleton<IExtraFieldDataAccess, ExtraFieldDataAccess>();
|
||||||
builder.Services.AddSingleton<IInspectionRecordDataAccess, InspectionRecordDataAccess>();
|
builder.Services.AddSingleton<IInspectionRecordDataAccess, InspectionRecordDataAccess>();
|
||||||
builder.Services.AddSingleton<IInspectionRecordTemplateDataAccess, InspectionRecordTemplateDataAccess>();
|
builder.Services.AddSingleton<IInspectionRecordTemplateDataAccess, InspectionRecordTemplateDataAccess>();
|
||||||
|
builder.Services.AddSingleton<IEquipmentRecordDataAccess, EquipmentRecordDataAccess>();
|
||||||
builder.Services.AddSingleton<IUserHouseholdDataAccess, UserHouseholdDataAccess>();
|
builder.Services.AddSingleton<IUserHouseholdDataAccess, UserHouseholdDataAccess>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user