Skip to content

Commit

Permalink
changle the file upload use the url
Browse files Browse the repository at this point in the history
  • Loading branch information
xxl4 committed Dec 9, 2024
1 parent b27045f commit 69c372b
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 0 deletions.
89 changes: 89 additions & 0 deletions src/Docs/V1/Shopify/Controllers/Products/ProductsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,93 @@ public function CustomConfigurations() {
*/
public function saveCustomConfigurations() {
}

/**
* @OA\Get(
* path="/shopify/products/{id}/sync-comments",
* operationId="sync comments",
* tags={"Shopify"},
* summary="Sync shopify comments data",
* description="Sync shopify comments data",
* @OA\Parameter(
* name="id",
* description="Product id",
* required=true,
* in="path",
* @OA\Schema(
* type="integer"
* )
* ),
* @OA\Response(
* response=200,
* description="Successful operation",
* @OA\JsonContent(ref="#/components/schemas/Product")
* ),
* @OA\Response(
* response=400,
* description="Bad Request"
* )
* )
*/
public function syncComments()
{
}

/**
* @OA\Get(
* path="/shopify/products/{id}/clean-cache",
* operationId="cleanCache",
* tags={"Shopify"},
* summary="Clean cache",
* description="Clean cache",
* @OA\Parameter(
* name="id",
* description="Product id",
* required=true,
* in="path",
* @OA\Schema(
* type="integer"
* )
* ),
* @OA\Response(
* response=200,
* description="Successful operation",
* @OA\JsonContent(ref="#/components/schemas/Product")
* ),
* @OA\Response(
* response=400,
* description="Bad Request"
* )
* )
*/
public function cleanCache() {}

/**
* @OA\Get(
* path="/shopify/products/{id}/sync",
* operationId="sync",
* tags={"Shopify"},
* summary="Sync shopify data",
* description="Sync shopify data",
* @OA\Parameter(
* name="id",
* description="Product id",
* required=true,
* in="path",
* @OA\Schema(
* type="integer"
* )
* ),
* @OA\Response(
* response=200,
* description="Successful operation",
* @OA\JsonContent(ref="#/components/schemas/Product")
* ),
* @OA\Response(
* response=400,
* description="Bad Request"
* )
* )
*/
public function sync() {}
}
15 changes: 15 additions & 0 deletions src/Http/Controllers/Api/V1/Admin/ProductsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -403,5 +403,20 @@ public function saveCustomConfigurations($id, Request $request) {

}

// sync product comments
public function syncComments($id) {
$product = $this->getRepositoryInstance()->findOrFail($id);
if(!$product) {
throw new \Exception($id.' Product not found');
}

Artisan::queue("onebuy:import:products:comment:from:judge", ["--prod_id"=> $id])->onConnection('redis')->onQueue('shopify-comments'); // import the shopify comments

return response()->json([
'product_id' => $product->id,
'message' => "success"
]);
}


}
2 changes: 2 additions & 0 deletions src/Routes/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

Route::get('{id}/sync', 'sync'); // sync shopify data

Route::get('{id}/sync-comments', 'syncComments'); // sync shopify product comments data

Route::get('{id}/clean-cache', 'cleanCache'); // clean cache

// Route::get('{id}/ad-images', 'adImages'); // ad images
Expand Down

0 comments on commit 69c372b

Please sign in to comment.