Improve client imports

This commit is contained in:
David Bomba 2022-09-10 09:44:43 +10:00
parent 29d6a56296
commit 3613a0e2d5
3 changed files with 49 additions and 47 deletions

View File

@ -26,6 +26,7 @@ class BlackListRule implements Rule
'arxxwalls.com', 'arxxwalls.com',
'superhostforumla.com', 'superhostforumla.com',
'wnpop.com', 'wnpop.com',
'dataservices.space',
]; ];
/** /**

View File

@ -173,18 +173,18 @@ class BaseImport
$is_free_hosted_client = $this->company->account->isFreeHostedClient(); $is_free_hosted_client = $this->company->account->isFreeHostedClient();
$hosted_client_count = $this->company->account->hosted_client_count; $hosted_client_count = $this->company->account->hosted_client_count;
if($this->factory_name instanceof ClientFactory && $is_free_hosted_client && (count($data) > $hosted_client_count))
{
$this->error_array[$entity_type][] = [
$entity_type => 'client',
'error' => 'Error, you are attempting to import more clients than your plan allows',
];
return $count;
}
foreach ($data as $key => $record) { foreach ($data as $key => $record) {
if($this->factory_name instanceof ClientFactory && $is_free_hosted_client && ($this->company->clients()->count() > $hosted_client_count))
{
$this->error_array[$entity_type][] = [
$entity_type => $record,
'error' => 'Client limit reached',
];
return $count;
}
try { try {
$entity = $this->transformer->transform($record); $entity = $this->transformer->transform($record);
// $validator = $this->request_name::runFormRequest($entity); // $validator = $this->request_name::runFormRequest($entity);

75
composer.lock generated
View File

@ -378,16 +378,16 @@
}, },
{ {
"name": "aws/aws-sdk-php", "name": "aws/aws-sdk-php",
"version": "3.235.3", "version": "3.235.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/aws/aws-sdk-php.git", "url": "https://github.com/aws/aws-sdk-php.git",
"reference": "d14bf468240f5bd8a0754b8a8248ff219ebada02" "reference": "3b002b92369dbcb8d86f32546cb324eabcd19a4e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/d14bf468240f5bd8a0754b8a8248ff219ebada02", "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/3b002b92369dbcb8d86f32546cb324eabcd19a4e",
"reference": "d14bf468240f5bd8a0754b8a8248ff219ebada02", "reference": "3b002b92369dbcb8d86f32546cb324eabcd19a4e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -464,9 +464,9 @@
"support": { "support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues", "issues": "https://github.com/aws/aws-sdk-php/issues",
"source": "https://github.com/aws/aws-sdk-php/tree/3.235.3" "source": "https://github.com/aws/aws-sdk-php/tree/3.235.5"
}, },
"time": "2022-09-07T18:17:39+00:00" "time": "2022-09-09T18:19:38+00:00"
}, },
{ {
"name": "bacon/bacon-qr-code", "name": "bacon/bacon-qr-code",
@ -3481,16 +3481,16 @@
}, },
{ {
"name": "laravel/framework", "name": "laravel/framework",
"version": "v9.28.0", "version": "v9.29.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/framework.git", "url": "https://github.com/laravel/framework.git",
"reference": "396a89e1f3654123d1c7f56306051212e5c75bc0" "reference": "585da0913e907fd54941260860ae3d7d4be8e8cb"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/396a89e1f3654123d1c7f56306051212e5c75bc0", "url": "https://api.github.com/repos/laravel/framework/zipball/585da0913e907fd54941260860ae3d7d4be8e8cb",
"reference": "396a89e1f3654123d1c7f56306051212e5c75bc0", "reference": "585da0913e907fd54941260860ae3d7d4be8e8cb",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3657,20 +3657,20 @@
"issues": "https://github.com/laravel/framework/issues", "issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework" "source": "https://github.com/laravel/framework"
}, },
"time": "2022-09-06T14:57:01+00:00" "time": "2022-09-09T18:21:21+00:00"
}, },
{ {
"name": "laravel/serializable-closure", "name": "laravel/serializable-closure",
"version": "v1.2.1", "version": "v1.2.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/serializable-closure.git", "url": "https://github.com/laravel/serializable-closure.git",
"reference": "d78fd36ba031a1a695ea5a406f29996948d7011b" "reference": "47afb7fae28ed29057fdca37e16a84f90cc62fae"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/serializable-closure/zipball/d78fd36ba031a1a695ea5a406f29996948d7011b", "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/47afb7fae28ed29057fdca37e16a84f90cc62fae",
"reference": "d78fd36ba031a1a695ea5a406f29996948d7011b", "reference": "47afb7fae28ed29057fdca37e16a84f90cc62fae",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3717,7 +3717,7 @@
"issues": "https://github.com/laravel/serializable-closure/issues", "issues": "https://github.com/laravel/serializable-closure/issues",
"source": "https://github.com/laravel/serializable-closure" "source": "https://github.com/laravel/serializable-closure"
}, },
"time": "2022-08-26T15:25:27+00:00" "time": "2022-09-08T13:45:54+00:00"
}, },
{ {
"name": "laravel/slack-notification-channel", "name": "laravel/slack-notification-channel",
@ -4387,16 +4387,16 @@
}, },
{ {
"name": "league/flysystem", "name": "league/flysystem",
"version": "3.2.1", "version": "3.3.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/thephpleague/flysystem.git", "url": "https://github.com/thephpleague/flysystem.git",
"reference": "81aea9e5217084c7850cd36e1587ee4aad721c6b" "reference": "d8295793b3e2f91aa39e1feb2d5bfce772891ae2"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/81aea9e5217084c7850cd36e1587ee4aad721c6b", "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/d8295793b3e2f91aa39e1feb2d5bfce772891ae2",
"reference": "81aea9e5217084c7850cd36e1587ee4aad721c6b", "reference": "d8295793b3e2f91aa39e1feb2d5bfce772891ae2",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4407,6 +4407,7 @@
"aws/aws-sdk-php": "3.209.31 || 3.210.0", "aws/aws-sdk-php": "3.209.31 || 3.210.0",
"guzzlehttp/guzzle": "<7.0", "guzzlehttp/guzzle": "<7.0",
"guzzlehttp/ringphp": "<1.1.1", "guzzlehttp/ringphp": "<1.1.1",
"phpseclib/phpseclib": "3.0.15",
"symfony/http-client": "<5.2" "symfony/http-client": "<5.2"
}, },
"require-dev": { "require-dev": {
@ -4420,7 +4421,7 @@
"friendsofphp/php-cs-fixer": "^3.5", "friendsofphp/php-cs-fixer": "^3.5",
"google/cloud-storage": "^1.23", "google/cloud-storage": "^1.23",
"microsoft/azure-storage-blob": "^1.1", "microsoft/azure-storage-blob": "^1.1",
"phpseclib/phpseclib": "^2.0", "phpseclib/phpseclib": "^3.0.14",
"phpstan/phpstan": "^0.12.26", "phpstan/phpstan": "^0.12.26",
"phpunit/phpunit": "^9.5.11", "phpunit/phpunit": "^9.5.11",
"sabre/dav": "^4.3.1" "sabre/dav": "^4.3.1"
@ -4457,11 +4458,11 @@
], ],
"support": { "support": {
"issues": "https://github.com/thephpleague/flysystem/issues", "issues": "https://github.com/thephpleague/flysystem/issues",
"source": "https://github.com/thephpleague/flysystem/tree/3.2.1" "source": "https://github.com/thephpleague/flysystem/tree/3.3.0"
}, },
"funding": [ "funding": [
{ {
"url": "https://offset.earth/frankdejonge", "url": "https://ecologi.com/frankdejonge",
"type": "custom" "type": "custom"
}, },
{ {
@ -4473,20 +4474,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-08-14T20:48:34+00:00" "time": "2022-09-09T11:11:42+00:00"
}, },
{ {
"name": "league/flysystem-aws-s3-v3", "name": "league/flysystem-aws-s3-v3",
"version": "3.2.0", "version": "3.3.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/thephpleague/flysystem-aws-s3-v3.git", "url": "https://github.com/thephpleague/flysystem-aws-s3-v3.git",
"reference": "257893ef7398b3c9255b26dff8b0118bb93fc5ff" "reference": "c9402e0b8d89d36b1b88ecf88c2a80b6d61fd114"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem-aws-s3-v3/zipball/257893ef7398b3c9255b26dff8b0118bb93fc5ff", "url": "https://api.github.com/repos/thephpleague/flysystem-aws-s3-v3/zipball/c9402e0b8d89d36b1b88ecf88c2a80b6d61fd114",
"reference": "257893ef7398b3c9255b26dff8b0118bb93fc5ff", "reference": "c9402e0b8d89d36b1b88ecf88c2a80b6d61fd114",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4527,11 +4528,11 @@
], ],
"support": { "support": {
"issues": "https://github.com/thephpleague/flysystem-aws-s3-v3/issues", "issues": "https://github.com/thephpleague/flysystem-aws-s3-v3/issues",
"source": "https://github.com/thephpleague/flysystem-aws-s3-v3/tree/3.2.0" "source": "https://github.com/thephpleague/flysystem-aws-s3-v3/tree/3.3.0"
}, },
"funding": [ "funding": [
{ {
"url": "https://offset.earth/frankdejonge", "url": "https://ecologi.com/frankdejonge",
"type": "custom" "type": "custom"
}, },
{ {
@ -4543,7 +4544,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-07-26T07:22:40+00:00" "time": "2022-09-09T10:03:42+00:00"
}, },
{ {
"name": "league/fractal", "name": "league/fractal",
@ -11988,16 +11989,16 @@
}, },
{ {
"name": "turbo124/beacon", "name": "turbo124/beacon",
"version": "v1.3.2", "version": "v1.3.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/turbo124/beacon.git", "url": "https://github.com/turbo124/beacon.git",
"reference": "e46e6122e28c2a7628ad40975bfd11a3ab883575" "reference": "4a0c9c6af3d88142e89184e67e9f0547078d5ef0"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/turbo124/beacon/zipball/e46e6122e28c2a7628ad40975bfd11a3ab883575", "url": "https://api.github.com/repos/turbo124/beacon/zipball/4a0c9c6af3d88142e89184e67e9f0547078d5ef0",
"reference": "e46e6122e28c2a7628ad40975bfd11a3ab883575", "reference": "4a0c9c6af3d88142e89184e67e9f0547078d5ef0",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -12044,9 +12045,9 @@
"turbo124" "turbo124"
], ],
"support": { "support": {
"source": "https://github.com/turbo124/beacon/tree/v1.3.2" "source": "https://github.com/turbo124/beacon/tree/v1.3.4"
}, },
"time": "2022-09-08T08:08:59+00:00" "time": "2022-09-09T23:30:23+00:00"
}, },
{ {
"name": "twilio/sdk", "name": "twilio/sdk",