Skip to content

Commit

Permalink
Merge pull request #145 from mark-szabo/v2.2
Browse files Browse the repository at this point in the history
V2.2.1
  • Loading branch information
mark-szabo authored Nov 6, 2024
2 parents 46fb51b + 42b5bc6 commit 4e6cc22
Show file tree
Hide file tree
Showing 35 changed files with 807 additions and 1,807 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8080",
"url": "https://localhost:51145",
"webRoot": "${workspaceFolder}"
}
]
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"**/obj": true
},
"azureFunctions.projectLanguage": "C#",
"azureFunctions.projectRuntime": "~2"
"azureFunctions.projectRuntime": "~4"
}
9 changes: 0 additions & 9 deletions CarWash.ClassLibrary/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,5 @@ namespace CarWash.ClassLibrary
/// </summary>
public class Constants
{
/// <summary>
/// Bookable slots and their capacity (in washes and not in minutes!)
/// </summary>
public static readonly List<Slot> Slots = new List<Slot>
{
new Slot {StartTime = 8, EndTime = 11, Capacity = 12},
new Slot {StartTime = 11, EndTime = 14, Capacity = 12},
new Slot {StartTime = 14, EndTime = 17, Capacity = 11}
};
}
}
179 changes: 97 additions & 82 deletions CarWash.ClassLibrary/Enums/ServiceType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,58 +25,14 @@ public enum ServiceType
TireCare = 10,
LeatherCare = 11,
PlasticCare = 12,
PreWash = 13
PreWash = 13,
PetHairRemoval = 14,
BikeRack = 15,
RoofBox = 16,
ChildSeat = 17
}
#pragma warning restore CS1591, SA1602

/// <summary>
/// Extension class for ServiceType.
/// </summary>
public static class ServiceExtensions
{
/// <summary>
/// Converts the ServiceType enum to a display-friendly string.
/// </summary>
/// <param name="serviceType">The service type to convert.</param>
/// <returns>A display-friendly string.</returns>
public static string ToFriendlyString(this ServiceType serviceType)
{
switch (serviceType)
{
case Exterior:
return "exterior";
case Interior:
return "interior";
case Carpet:
return "carpet";
case SpotCleaning:
return "spot cleaning";
case VignetteRemoval:
return "vignette removal";
case Polishing:
return "polishing";
case AcCleaningOzon:
return "AC cleaning 'ozon'";
case AcCleaningBomba:
return "AC cleaning 'bomba'";
case BugRemoval:
return "bug removal";
case WheelCleaning:
return "wheel cleaning";
case TireCare:
return "tire care";
case LeatherCare:
return "leather care";
case PlasticCare:
return "plastic care";
case PreWash:
return "prewash";
default:
return "no info";
}
}
}

/// <summary>
/// Services the users can choose from.
/// </summary>
Expand All @@ -85,26 +41,29 @@ public static class ServiceTypes
/// <summary>
/// Services the users can choose from.
/// </summary>
public static readonly List<Service> Types = new List<Service>
{
public static readonly List<Service> Types =
[
new Service {
Type = Exterior,
Name = "exterior",
Group = "Basics",
TimeInMinutes = 12,
Price = 3712,
PriceMpv = 4641,
Price = 6311,
PriceMpv = 7889,
Hidden = false
},
new Service {
Type = Interior,
Name = "interior",
Group = "Basics",
TimeInMinutes = 12,
Price = 2124,
PriceMpv = 3180,
Price = 3610,
PriceMpv = 5406,
Hidden = false},
new Service {
Type = Carpet,
Name = "carpet",
Group = "Basics",
Description = "whole carpet cleaning, including all the seats",
TimeInMinutes = 24,
Price = -1,
Expand All @@ -114,103 +73,154 @@ public static class ServiceTypes
new Service {
Type = SpotCleaning,
Name = "spot cleaning",
Group = "Extras",
Description = "partial cleaning of the carpet, only where it is needed (eg. when something is spilled in the car)",
TimeInMinutes = 0,
Price = 4474,
PriceMpv = 4474,
Price = 7606,
PriceMpv = 7606,
Hidden = false
},
new Service {
Type = VignetteRemoval,
Name = "vignette removal",
Group = "Extras",
Description = "eg. highway vignettes on the windscreen",
TimeInMinutes = 0,
Price = 593,
PriceMpv = 593,
Price = 1008,
PriceMpv = 1008,
Hidden = false
},
new Service {
Type = Polishing,
Name = "polishing",
Group = "Extras",
Description = "for small scratches",
TimeInMinutes = 0,
Price = 5693,
PriceMpv = 5693,
Price = 9679,
PriceMpv = 9679,
Hidden = false
},
new Service {
Type = AcCleaningOzon,
Name = "AC cleaning 'ozon'",
Group = "AC",
Description = "disinfects molecules with ozone",
TimeInMinutes = 0,
Price = 10166,
PriceMpv = 10166,
Price = 10091,
PriceMpv = 10091,
Hidden = false
},
new Service {
Type = AcCleaningBomba,
Name = "AC cleaning 'bomba'",
Group = "AC",
Description = "blowing chemical spray in the AC system",
TimeInMinutes = 0,
Price = 8131,
PriceMpv = 8131,
Price = 13822,
PriceMpv = 13822,
Hidden = false
},
new Service {
Type = BugRemoval,
Name = "bug removal",
Group = "Extras",
Description = "we'll add this if it's needed",
TimeInMinutes = 0,
Price = 1018,
PriceMpv = 1018,
Hidden = true
Price = 1732,
PriceMpv = 1732,
Hidden = false
},
new Service {
Type = WheelCleaning,
Name = "wheel cleaning",
Group = "Extras",
Description = "we'll add this if it's needed",
TimeInMinutes = 0,
Price = 1219,
PriceMpv = 1219,
Hidden = true
Price = 2073,
PriceMpv = 2073,
Hidden = false
},
new Service {
Type = TireCare,
Name = "tire care",
Group = "Extras",
Description = "we'll add this if it's needed",
TimeInMinutes = 0,
Price = 1018,
PriceMpv = 1018,
Hidden = true
Price = 1732,
PriceMpv = 1732,
Hidden = false
},
new Service {
Type = LeatherCare,
Name = "leather care",
Group = "Extras",
Description = "we'll add this if it's needed",
TimeInMinutes = 0,
Price = 10166,
PriceMpv = 10166,
Hidden = true
Price = 17283,
PriceMpv = 17283,
Hidden = false
},
new Service {
Type = PlasticCare,
Name = "plastic care",
Group = "Extras",
Description = "we'll add this if it's needed",
TimeInMinutes = 0,
Price = 9149,
PriceMpv = 9149,
Hidden = true
Hidden = false
},
new Service {
Type = PreWash,
Name = "prewash",
Group = "Extras",
Description = "we'll add this if it's needed",
TimeInMinutes = 0,
Price = 1018,
PriceMpv = 1018,
Hidden = true
Price = 1732,
PriceMpv = 1732,
Hidden = false
},
new Service {
Type = PetHairRemoval,
Name = "pet hair removal",
Group = "Extras",
Description = "we'll add this if it's needed",
TimeInMinutes = 0,
Price = 5080,
PriceMpv = 5080,
Hidden = false
},
new Service {
Type = BikeRack,
Name = "bike rack",
Group = "Extras",
Description = "we'll add this if it's needed",
TimeInMinutes = 0,
Price = 2332,
PriceMpv = 2332,
Hidden = false
},
new Service {
Type = RoofBox,
Name = "roof box",
Group = "Extras",
Description = "we'll add this if it's needed",
TimeInMinutes = 0,
Price = 6801,
PriceMpv = 6801,
Hidden = false
},
new Service {
Type = ChildSeat,
Name = "child seat",
Group = "Extras",
Description = "we'll add this if it's needed",
TimeInMinutes = 0,
Price = 8744,
PriceMpv = 8744,
Hidden = false
}
};
];
}

/// <summary>
Expand All @@ -229,6 +239,11 @@ public class Service
/// </summary>
public string Name { get; set; }

/// <summary>
/// Gets or sets the group name of the service.
/// </summary>
public string Group { get; set; }

/// <summary>
/// Gets or sets the description of the service.
/// </summary>
Expand Down
44 changes: 22 additions & 22 deletions CarWash.ClassLibrary/Models/CarWashConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,28 @@ public class CarWashConfiguration
/// </example>
public List<Slot> Slots { get; set; } = new List<Slot>();

/// <summary>
/// List of companies whose users can use the CarWash app.
/// </summary>
/// <remarks>
/// You MUST include the CarWash as a company!
/// Location: Database
/// Key: Companies
/// </remarks>
/// <example>
/// [
/// {
/// "Name": "carwash",
/// "TenantId": "86cf3673-fa54-46ac-8a6c-164633955f8e",
/// "DailyLimit": 0
/// },
/// {
/// "Name": "contoso",
/// "TenantId": "d31a1195-d2ed-4a04-820c-3e1e455e380b",
/// "DailyLimit": 15
/// }
/// ]
/// </example>
///// <summary>
///// List of companies whose users can use the CarWash app.
///// </summary>
///// <remarks>
///// You MUST include the CarWash as a company!
///// Location: Database
///// Key: Companies
///// </remarks>
///// <example>
///// [
///// {
///// "Name": "carwash",
///// "TenantId": "86cf3673-fa54-46ac-8a6c-164633955f8e",
///// "DailyLimit": 0
///// },
///// {
///// "Name": "contoso",
///// "TenantId": "d31a1195-d2ed-4a04-820c-3e1e455e380b",
///// "DailyLimit": 15
///// }
///// ]
///// </example>
//public List<Company> Companies { get; set; } = new List<Company>();

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion CarWash.Functions/EmailExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static async Task Send(this Email email)
if (email == null) return;

// Load connection string from appsettings
var connectionString = Environment.GetEnvironmentVariable("StorageAccount", EnvironmentVariableTarget.Process);
var connectionString = Environment.GetEnvironmentVariable("ConnectionStrings:StorageAccount", EnvironmentVariableTarget.Process);

// Parse the connection string and return a reference to the storage account.
var storage = new QueueServiceClient(connectionString);
Expand Down
4 changes: 2 additions & 2 deletions CarWash.Functions/FunctionsDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ internal class FunctionsDbContext : DbContext, IPushDbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
var connectionString = Environment.GetEnvironmentVariable("Database", EnvironmentVariableTarget.Process);
if (string.IsNullOrEmpty(connectionString)) throw new Exception("Application setting 'SqlDatabase' was not found. Add it on the Azure portal!");
var connectionString = Environment.GetEnvironmentVariable("ConnectionStrings:SqlDatabase", EnvironmentVariableTarget.Process);
if (string.IsNullOrEmpty(connectionString)) throw new Exception("Application setting 'ConnectionStrings:SqlDatabase' was not found. Add it on the Azure portal!");
optionsBuilder.UseSqlServer(connectionString);
var isDevelopment = Environment.GetEnvironmentVariable("Environment", EnvironmentVariableTarget.Process) == "Development";
if (isDevelopment) optionsBuilder.UseLoggerFactory(new LoggerFactory(new[] { new DebugLoggerProvider() }));
Expand Down
Loading

0 comments on commit 4e6cc22

Please sign in to comment.