mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-07-14 00:02:05 -04:00
Fix RO jobs
This commit is contained in:
@@ -787,7 +787,7 @@ class StudioPlusVideoController extends Controller
|
||||
{
|
||||
$studioPlusVideo->update($request->validated());
|
||||
|
||||
if($studioPlusVideo->job){
|
||||
if($studioPlusVideo->job && $studioPlusVideo->job->job_status != 'Completed'){
|
||||
|
||||
$data['id'] = $studioPlusVideo->job->id;
|
||||
|
||||
@@ -1394,8 +1394,9 @@ class StudioPlusVideoController extends Controller
|
||||
public function createAccount(Request $request, StudioPlusVideo $video)
|
||||
{
|
||||
try {
|
||||
|
||||
|
||||
DB::beginTransaction();
|
||||
|
||||
//lets create the user account first
|
||||
$password = Str::random(10);
|
||||
$user = User::create([
|
||||
@@ -1423,6 +1424,7 @@ class StudioPlusVideoController extends Controller
|
||||
]);
|
||||
|
||||
$product = (new AmazonProductService)->getProductDetails($video->asin);
|
||||
|
||||
$job_request->product()->create([
|
||||
'asin' => $video->asin,
|
||||
'name' => $video->product_name,
|
||||
@@ -1462,7 +1464,9 @@ class StudioPlusVideoController extends Controller
|
||||
'urls'
|
||||
]);
|
||||
|
||||
$this->sendReachoutAccountMail($user->email,$password);
|
||||
DB::commit();
|
||||
|
||||
$this->sendReachoutAccountMail($video->channel->user->email,$user->email,$password);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Reachout account successfully created and emailed to the client',
|
||||
@@ -1470,6 +1474,9 @@ class StudioPlusVideoController extends Controller
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
|
||||
DB::rollback();
|
||||
|
||||
return response()->json([
|
||||
'message' => $e->getMessage()
|
||||
], 400);
|
||||
|
||||
Reference in New Issue
Block a user