Skip to content

Commit

Permalink
Merge branch 'feature/create-shop-api' of https://github.com/openfood…
Browse files Browse the repository at this point in the history
…foundation/vine into feature/create-shop-api
  • Loading branch information
ok200lyndon committed Aug 19, 2024
2 parents 3877f19 + 0981d00 commit 5228745
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions app/Http/Controllers/Api/V1/ApiShopsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ public function store(): JsonResponse
* The validation array.
*/
$validationArray = [
'shop_name' => [
'shop_name' => [
'required',
'string',
],
'user_email' => [
'required',
'email',
],
'user_name' => [
'user_name' => [
'required',
'string',
],
Expand Down Expand Up @@ -144,7 +144,8 @@ public function store(): JsonResponse
$this->message = ApiResponse::RESPONSE_SAVED->value . '. Here is the API Token for the user linked to this new team. It will only be displayed ONCE, so please store it in a secure manner.';
$this->data = $token->plainTextToken;

} catch (Exception $e) {
}
catch (Exception $e) {

$this->responseCode = 500;
$this->message = ApiResponse::RESPONSE_ERROR->value . ': "' . $e->getMessage() . '".';
Expand Down
8 changes: 4 additions & 4 deletions tests/Feature/API/App/Shops/ShopPostTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@ public function userWithPermissionCanCreate()
PersonalAccessTokenAbility::SHOPS_CREATE->value,
]);

$shopName = fake()->name();
$userName = fake()->name();
$shopName = fake()->name();
$userName = fake()->name();
$userEmail = fake()->email();

$user = User::whereEmail($userEmail)->first();
self::assertNull($user);

$payload = [
'shop_name' => $shopName,
'user_name' => $userName,
'shop_name' => $shopName,
'user_name' => $userName,
'user_email' => $userEmail,
];

Expand Down

0 comments on commit 5228745

Please sign in to comment.