Added the check to check the system defined types

This commit is contained in:
ashutosh.nehete 2025-09-03 14:50:03 +05:30
parent cd489f45ae
commit c27b2a2ff1

View File

@ -1371,7 +1371,11 @@ namespace Marco.Pms.Services.Service
_logger.LogWarning("Employee {EmployeeId} tries to {Action} Document Type, but not found in database", loggedInEmployee.Id, action); _logger.LogWarning("Employee {EmployeeId} tries to {Action} Document Type, but not found in database", loggedInEmployee.Id, action);
return ApiResponse<object>.ErrorResponse("Document Type not found", "Document Type not found", 404); return ApiResponse<object>.ErrorResponse("Document Type not found", "Document Type not found", 404);
} }
if (documentType.IsSystem)
{
_logger.LogWarning("Employee {EmployeeId} tries to {Action} Document Type, but could not take action on system defined entity", loggedInEmployee.Id, action);
return ApiResponse<object>.ErrorResponse($"Document is system defined cannot be {action}d", $"Document is system defined cannot be {action}d", 400);
}
// Mapping DocumentTypeMatser to BsonDocument // Mapping DocumentTypeMatser to BsonDocument
var existingEntityBson = _updateLogHelper.EntityToBsonDocument(documentType); var existingEntityBson = _updateLogHelper.EntityToBsonDocument(documentType);