Compare commits

..

2 Commits

Author SHA1 Message Date
fafbc55732 Change authorization policy for EditCustomer method
Updated the authorization policy for the `EditCustomer` method in the `AdvertisementController` to allow access only to users with the "Customer" role, replacing the previous "Power User" role requirement.
2025-08-11 18:01:46 +02:00
555273aed1 Make PaymentType nullable and handle null cases
Updated the PaymentType property in PublicWalkRequestAcceptDto and WalkCreateDto to be nullable.
Modified ApiWalksController to safely assign PaymentType, using a default value when null to prevent runtime errors.
2025-08-06 16:46:32 +02:00
4 changed files with 6 additions and 6 deletions

View File

@ -40,6 +40,6 @@ namespace gehGassi.Dto.Walks
/// <summary>
/// Zahlungsart für den Walk
/// </summary>
public WalkPaymentTypeDto PaymentType { get; set; }
public WalkPaymentTypeDto? PaymentType { get; set; }
}
}

View File

@ -105,6 +105,6 @@ namespace gehGassi.Dto.Walks
/// <summary>
/// Zahlungsart für den Walk
/// </summary>
public WalkPaymentTypeDto PaymentType { get; set; }
public WalkPaymentTypeDto? PaymentType { get; set; }
}
}

View File

@ -776,7 +776,7 @@ namespace gehGassi.Web.Controllers
/// </summary>
/// <param name="model">Model</param>
/// <returns>Json</returns>
[Authorize(Policy = Policies.PowerUserOnly)]
[Authorize(Policy = Policies.CustomerOnly)]
[HasPermission(Permission.AdvertisementsManage, Permission.AdvertisementsEdit)]
[CustomerAuthorize("CustomerId")]
[ValidateAntiForgeryToken]

View File

@ -1039,7 +1039,7 @@ namespace gehGassi.Web.Controllers.Api
walk.CompletedInfo = string.Empty;
walk.Defactation = false;
walk.PaymentStatus = PaymentStatus.Pending;
walk.PaymentType = (WalkPaymentType)model.PaymentType;
walk.PaymentType = model.PaymentType != null ? (WalkPaymentType)model.PaymentType : WalkPaymentType.MangoPay;
walk.UpdatedAt = DateTimeOffset.UtcNow;
walk.Created = DateTimeOffset.UtcNow;
@ -3630,7 +3630,7 @@ namespace gehGassi.Web.Controllers.Api
walk.CompletedInfo = string.Empty;
walk.Defactation = false;
walk.PaymentStatus = PaymentStatus.Pending;
walk.PaymentType = (WalkPaymentType)model.PaymentType;
walk.PaymentType = model.PaymentType != null ? (WalkPaymentType)model.PaymentType : WalkPaymentType.MangoPay;
walk.UpdatedAt = DateTimeOffset.UtcNow;
walk.Created = DateTimeOffset.UtcNow;
@ -3810,7 +3810,7 @@ namespace gehGassi.Web.Controllers.Api
walk.CompletedInfo = string.Empty;
walk.Defactation = false;
walk.PaymentStatus = PaymentStatus.None;
walk.PaymentType = (WalkPaymentType)model.PaymentType;
walk.PaymentType = model.PaymentType != null ? (WalkPaymentType)model.PaymentType : WalkPaymentType.MangoPay;
walk.UpdatedAt = DateTimeOffset.UtcNow;
walk.Created = DateTimeOffset.UtcNow;