Skip to content
Open
Show file tree
Hide file tree
Changes from 149 commits
Commits
Show all changes
158 commits
Select commit Hold shift + click to select a range
2ba6840
Allow path to be null and eager load relations
alecritson Dec 14, 2020
379f412
Allow null on basket id
alecritson Dec 14, 2020
e3ac284
Don’t try and parse option json values
alecritson Dec 14, 2020
b8ffa92
Add create basket to spec
alecritson Dec 14, 2020
39c0690
Don’t parse and/or sort product option data
alecritson Dec 14, 2020
c09cc06
Merge in master
alecritson Dec 14, 2020
739049f
Updates and improvements
alecritson Jan 6, 2021
521983b
Add tests
alecritson Jan 6, 2021
dbd933e
Add attribute and negate n+1 issue
alecritson Jan 6, 2021
8c422ce
Tidy up
alecritson Jan 6, 2021
dc16f3e
Aggregation and filter fixes
alecritson Jan 6, 2021
8790608
Squashed commit of the following:
alecritson Jan 6, 2021
cc0b1a7
Fix page/offset
alecritson Jan 8, 2021
696ba08
Change - to a pipe for multi filtering
alecritson Jan 8, 2021
558f5c4
Change post to put on basket lines
alecritson Jan 8, 2021
4bd4138
Revert channel and customer group scope
alecritson Jan 8, 2021
fd01639
Add parsing and add handle to attribute
alecritson Jan 8, 2021
7651454
Fix tests
alecritson Jan 8, 2021
965763d
Clean up
alecritson Jan 12, 2021
9ebb818
Add check if we’re in the console
alecritson Jan 12, 2021
410fc2c
If the name column exists already, remove and replace it
alecritson Jan 12, 2021
90164a3
Add draft flag
alecritson Jan 12, 2021
553c3da
Remove global scope bypassing on index
alecritson Jan 12, 2021
bbd6cb4
Use eager loaded categories
alecritson Jan 12, 2021
4e260b3
Add count to pagination
alecritson Jan 12, 2021
c8c6834
Tweak offset logic
alecritson Jan 12, 2021
0bd681b
Don’t send up billing info
alecritson Jan 12, 2021
d39f5fd
Fix up discount CRUD
alecritson Jan 14, 2021
c1ce7f5
Fix issue with passed index on search
alecritson Jan 14, 2021
587f9a3
Set default channels on discount when creating
alecritson Jan 15, 2021
79012ad
Make name nullable
alecritson Jan 15, 2021
61a2251
Apply fixes from StyleCI (#347)
alecritson Jan 15, 2021
e7388d1
Fix shipping estimate endpoint
alecritson Jan 15, 2021
7fe181c
Import missing class
alecritson Jan 15, 2021
600c8d0
Adjust imports
alecritson Jan 18, 2021
a012413
Only reindex products if we have any
alecritson Jan 18, 2021
d0a4062
Fix asset uploading for YouTube and urls
alecritson Jan 20, 2021
933299b
Update root category nested set before deleting
alecritson Jan 20, 2021
9d8c12e
Add fillable
alecritson Jan 20, 2021
47a4798
Add loading
alecritson Jan 20, 2021
d7cfe1f
Improve filtering
alecritson Jan 20, 2021
06b3fb2
Allow empty array on relations
alecritson Jan 20, 2021
2765d8f
Set default depth to 0 (root)
alecritson Jan 20, 2021
d35f913
Fix PSR-4
alecritson Jan 20, 2021
74618cf
Apply fixes from StyleCI (#351)
alecritson Jan 20, 2021
780884a
Only apply filters if we’re not on the hub
alecritson Jan 20, 2021
6e0c2a8
Add method to delete from index
alecritson Jan 20, 2021
c1e1184
Pass user through when setting billing address
alecritson Jan 20, 2021
ee17a22
Add counts to search id fetching
alecritson Jan 20, 2021
fbed3bb
Save address against user
alecritson Jan 20, 2021
a623172
Remove product from index with hard deleting
alecritson Jan 20, 2021
531f6ff
Add category observer
alecritson Jan 20, 2021
a587f94
Remove permission check for the time
alecritson Jan 20, 2021
f54f6df
Only delete if we have an index
alecritson Jan 20, 2021
5d463cc
Set up a mock transport for Elasticsearch
alecritson Jan 20, 2021
60439ce
Apply fixes from StyleCI (#353)
alecritson Jan 21, 2021
cfa2fc7
Updates
alecritson Jan 21, 2021
9897b20
Make depth 1 by default
alecritson Jan 22, 2021
402b7ac
StyleCI fix
alecritson Jan 22, 2021
91f2623
Apply fixes from StyleCI (#355)
alecritson Jan 22, 2021
d974bb3
Only cancel if full refund
alecritson Jan 25, 2021
c12c6c3
Add nullable to fields
alecritson Feb 11, 2021
9f9d207
Add payment provider actions
alecritson Feb 11, 2021
6183a38
Add action to rebuild tree
alecritson Feb 11, 2021
ccce131
Add some maintenance migrations
alecritson Feb 11, 2021
bd0d189
Typehint request
alecritson Feb 11, 2021
067beb7
Register the rebuild tree command
alecritson Feb 11, 2021
be03b26
Run drafter in a transaction
alecritson Feb 11, 2021
22b51f4
Routing fixes
alecritson Feb 11, 2021
9edf949
Use `include` for current user
alecritson Feb 11, 2021
3324b49
Init action
alecritson Feb 11, 2021
ddf3db4
Update to support multiple pipe values
alecritson Feb 11, 2021
e0d6663
Add stripe intents driver
alecritson Feb 11, 2021
4dca575
Fixes and remove generic company_name field
alecritson Feb 11, 2021
a10b861
Check for settings asset source
alecritson Feb 11, 2021
7677d6d
Add endpoint for user addresses
alecritson Feb 11, 2021
f988fdd
Update spec
alecritson Feb 11, 2021
e57d639
Add timestamps
alecritson Feb 11, 2021
941abfb
Shipping updates
alecritson Feb 11, 2021
315eaf9
Fixes
alecritson Feb 11, 2021
aaff3d2
Drafting refactoring
alecritson Feb 11, 2021
d9f9e51
Fix wildcard search
alecritson Feb 16, 2021
2968148
Search optimisations
alecritson Feb 16, 2021
206bdd8
Drafting Refactor
alecritson Feb 16, 2021
247fc63
Allow attribute data to be null on update
alecritson Feb 16, 2021
f27ebd0
Start migration to actions
alecritson Feb 16, 2021
84de763
Update spec
alecritson Feb 16, 2021
5db6c22
Add and fix drafting testing
alecritson Feb 16, 2021
c05165f
Apply fixes from StyleCI (#358)
alecritson Feb 16, 2021
c1ea5e0
Add initial 0.12 changelog
alecritson Feb 16, 2021
43c9bb5
Merge branch 'master' into release/0.12.0
alecritson Feb 16, 2021
c9e7184
Remove empty line
alecritson Feb 16, 2021
c8d2d44
Fixes
alecritson Feb 19, 2021
5029cdf
Fix some publishing issues
alecritson Feb 19, 2021
fa5a16e
Fix factory
alecritson Feb 19, 2021
7816f34
Allow path to be passed through on update
alecritson Feb 19, 2021
92ce28e
Versioning updates
alecritson Feb 21, 2021
f0b923f
Don’t override draft relation loading
alecritson Feb 22, 2021
7330a28
Handle passing of handle as ownertype
alecritson Feb 22, 2021
e59af76
Category draft and version updates
alecritson Feb 22, 2021
186ad78
Reporting updates
alecritson Feb 26, 2021
52ff88f
Only drop if the country exists
alecritson Feb 26, 2021
22620cc
Fixes to migrations
alecritson Feb 26, 2021
0b04479
Check for column before adding
alecritson Feb 26, 2021
dbe5dc9
Add numeric validation to price field
alecritson Mar 1, 2021
9b3f5aa
Add Codacy yaml
alecritson Mar 1, 2021
759c426
Ignore tests on codacy
alecritson Mar 1, 2021
83163e8
Remove logging
alecritson Mar 1, 2021
895b197
Apply fixes from StyleCI (#360)
alecritson Mar 1, 2021
e025b6a
Ignore database codacy
alecritson Mar 1, 2021
c9c17e7
Return invoice download
alecritson Mar 2, 2021
0d81818
Update spec
alecritson Mar 9, 2021
3c12929
Update spec
alecritson Mar 9, 2021
77c8c24
Update guzzle
alecritson Mar 9, 2021
3584898
Update user fetching and reports
alecritson Mar 9, 2021
ec1935a
Fix OpenAPI spec error (#361)
glennjacobs Mar 9, 2021
4875541
Fire indexable event
alecritson Mar 10, 2021
e30def7
Trim the SKU
alecritson Mar 10, 2021
478ada4
Fix drafting
alecritson Mar 10, 2021
a3773bb
Merge branch 'release/0.12.0' of https://github.com/getcandy/candy-ap…
alecritson Mar 10, 2021
abe613d
Add action to get current customer groups
alecritson Mar 10, 2021
8a6102d
Make threshold 1 for displaying
alecritson Mar 10, 2021
39b1842
Return element no matter what
alecritson Mar 11, 2021
f0b64d0
Fixes to asset id association
alecritson Mar 11, 2021
fb85c23
Add check before we remove the column
alecritson Mar 11, 2021
8bf1059
Add report exports
alecritson Mar 15, 2021
d143f46
Update CHANGELOG.md
alecritson Mar 16, 2021
9247e27
Update CHANGELOG.md
alecritson Mar 16, 2021
8319958
Move shipping method index to an action
alecritson Mar 17, 2021
ede0d31
Merge branch 'release/0.12.0' of https://github.com/getcandy/candy-ap…
alecritson Mar 17, 2021
6983e47
Add reward resources
alecritson Mar 17, 2021
2a3c3af
Check placed_at is null for active order
alecritson Mar 17, 2021
b0cd8f2
Return exchange rate
alecritson Mar 17, 2021
92b51b3
Apply fixes from StyleCI (#362)
alecritson Mar 17, 2021
7e6a358
Handle multiple emails if billing/shipping differ
alecritson Mar 17, 2021
7f67fc9
Fix array access
alecritson Mar 17, 2021
d7399d5
Merge branch 'release/0.12.0' of https://github.com/getcandy/candy-ap…
alecritson Mar 17, 2021
c831d92
Language Refactoring (#363)
alecritson Mar 18, 2021
72a7399
Trigger indexable even when restoring
alecritson Mar 18, 2021
aaaa441
Add keyword search to product families
alecritson Mar 18, 2021
9a601f7
Add phone email to mass assignment
alecritson Mar 18, 2021
71c15f7
Hotfix `lang` attribute reference
alecritson Mar 18, 2021
d5dca98
Feat/route refactoring (#366)
alecritson Mar 19, 2021
23060f5
Fixes to drafting and route creation
alecritson Mar 19, 2021
14114e0
Update references to RouteResource
alecritson Mar 19, 2021
ebc118e
Recycle bin updates
alecritson Mar 19, 2021
dbfc2f5
Fix recycle bin searching
alecritson Mar 19, 2021
6350ce0
Spec update
alecritson Mar 22, 2021
cffbc43
Fix tests
alecritson Mar 22, 2021
1829b89
Add activity log spec update
alecritson Mar 23, 2021
7fe420c
Merge in master
alecritson Mar 24, 2021
a67ecfa
Add recyclebin and model examples
alecritson Mar 24, 2021
f06da6c
Merge branch 'master' into open-api/0.12-spec
alecritson Mar 24, 2021
df86513
Update spec
alecritson Mar 25, 2021
e8130fd
Fix to api spec formatting
glennjacobs Mar 26, 2021
806974c
Update spec for channels
alecritson Mar 26, 2021
ee5f918
Merge branch 'open-api/0.12-spec' of https://github.com/getcandy/cand…
alecritson Mar 26, 2021
99f32c8
Update SearchForRoute.php
glennjacobs Jun 10, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .codacy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
exclude_paths:
- "**/*.md"
- "**/*.js"
- "**/*.json"
- "tests/**/*"
- "database/**/*"
100 changes: 99 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,101 @@

## 0.12.0
### Upgrading

Update the composer package

```bash
$ composer update @getcandy/candy-api
```

```bash
$ php artisan migrate
```

### High Impact Changes

#### Maintenance Migrations

Some columns have been added/removed from the database. The tables/columns affected are:

- `orders`
- Removed `company_name` column as it wasn't being used and we have other columns for that now
- Added `billing_company_name` and `shipping_company_name` columns.
- `countries`
- Remove `country` column in favour of a `country_id` relationship

#### Eager loading relations for the current user

Previously when returning the current user via `users/current` there was some hard coded includes, this has been replaced to allow the `include` query parameter.
You should update any calls to this endpoint if you rely on included resources. The previous default includes were:

```php
['addresses.country', 'roles.permissions', 'customer', 'savedBaskets.basket.lines']
```

### Drafting has changed

The way drafting previously worked has now been refactored to be less destructive. You should reindex your products before going back into the hub to get everything in sync.

You can do this by running `php artisan candy:products:reindex` and `php artisan candy:categories:reindex`H

### Route searching

The way you search for routes has changed on the API. We have removed the `path` column and also the `locale` column in favour of a `language_id` relation.

When you search for a route, previously you would do something like:
```javascript
const { data } = await axios('routes/search', {
params: {
slug: 'slug-for-the-product',
path: null,
include: 'element'
}
})
```
This should now be changed to:
```javascript
const { data } = await axios('routes/search', {
params: {
slug: 'slug-for-the-product',
language_code: 'en',
element_type: 'product',
include: 'element'
}
})
```

### 🐞 Fixes
- Fixed an issue that was causing a indefinite wildcard search on products
- Allow certain fields to be nullable on a customer address (`company_name`, `address_two`, `address_three`)
- Fixed some issues on route creation
- Fixed issue where shipping method relationships were not having their timestamps updated
- Fixes to some migrations
- Fixed an issue where the recycle bin item wasn't returned on the relationship
- Fixed and issue where the indexable event wasn't being triggered when publishing a resource
- Fixes to drafting and publishing of resources
- Fixed an issue where `path` wasn't updating when updating a route

### ⭐ Improvements

- Slight optimisation for Elasticsearch and the fields it returns
- Drafting and Publishing of a draft will now run in a transaction, you can also extend the drafting functionality in your plugins.
- SKU uses `trim` when being saved
- Languages have been refactored and simplified so now we only rely on `code`. The `lang` column has been replaced by `code` and the `iso` column has been removed.
- When detecting the language to use for API responses, we now parse the `accept-language` header properly.
### 🏗️ Additions

- Added endpoint to get a payment provider via it's given ID
- Added Stripe Payment Intents provider
- Added a `RebuildTree` action and command for categories, so if your category tree is messed up you can run `candy:categories:rebuild`
- Added `user/addresses` endpoint to get the current users saved addresses
- Added initial report exporting logic, this will now run and exporter in the background and email you when ready to download.
- Add some additional reports
- Average spending across customer groups
- Total spending across customer groups

---

# 0.3.8

- [added] Added CategoryStoredEvent when editing categories
Expand All @@ -17,4 +115,4 @@ Add lockfile to .gitignore
# 0.3.4

- [changed] Changed `type` to `search_type` to be more explicit. Also `search_type` is no longer a required field and will default to a product search
- [changed] Changed `includes` on search to `include`
- [changed] Changed `includes` on search to `include`
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
"doctrine/dbal": "2.9.2",
"ruflin/elastica": "^7.0",
"spatie/laravel-permission": "^3.17",
"supportpal/accept-language-parser": "^0.1",
"vinkla/hashids": "^9.0",
"paypal/rest-api-sdk-php": "*",
"laravel/helpers": "1.3.0",
"neondigital/laravel-drafting": "dev-master",
"neondigital/laravel-versioning": "dev-master",
"staudenmeir/eloquent-has-many-deep": "^1.13",
"laravel/legacy-factories": "^1.0.4",
"guzzlehttp/guzzle": "^7.1.0"
"guzzlehttp/guzzle": "^7.2.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
Expand Down
6 changes: 6 additions & 0 deletions config/getcandy.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@
'table_columns' => [
'name', 'reference', 'account_no', 'contact_email', 'type', 'account', 'order_total', 'delivery_total', 'zone', 'date',
],
'invoicing' => [
'pdf' => [
'pipelines' => [
],
],
],
'statuses' => [

/*
Expand Down
31 changes: 31 additions & 0 deletions database/factories/AssetFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

use Faker\Generator as Faker;
use GetCandy\Api\Core\Assets\Models\Asset;

/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
*/

$factory->define(Asset::class, function (Faker $faker) {
return [
'location' => $faker->word,
'kind' => 'image',
'sub_kind' => 'jpg',
'width' => $faker->randomNumber,
'height' => $faker->randomNumber,
'title' => $faker->word,
'original_filename' => "{$faker->word}.jpg",
'caption' => $faker->word,
'size' => $faker->randomNumber,
'extension' => 'jpg',
'filename' => "{$faker->unique()->word}.jpg",
];
});
25 changes: 25 additions & 0 deletions database/factories/AssetSourceFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

use Faker\Generator as Faker;
use GetCandy\Api\Core\Assets\Models\AssetSource;

/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
*/

$factory->define(AssetSource::class, function (Faker $faker) {
return [
'name' => $faker->word,
'handle' => $faker->word,
'disk' => 'public',
'default' => $faker->boolean,
'path' => $faker->word,
];
});
25 changes: 25 additions & 0 deletions database/factories/AssociationGroupFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

use Faker\Generator as Faker;
use GetCandy\Api\Core\Associations\Models\AssociationGroup;
use Illuminate\Support\Str;

/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
*/

$factory->define(AssociationGroup::class, function (Faker $faker) {
$name = $faker->unique()->company;

return [
'name' => $name,
'handle' => Str::slug($name),
];
});
25 changes: 25 additions & 0 deletions database/factories/CategoryFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

use Faker\Generator as Faker;
use GetCandy\Api\Core\Categories\Models\Category;

/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
*/

$factory->define(Category::class, function (Faker $faker) {
return [
'attribute_data' => [
'name' => [
'en' => $faker->word,
],
],
];
});
8 changes: 2 additions & 6 deletions database/factories/LanguageFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

use Faker\Generator as Faker;
use GetCandy\Api\Core\Languages\Models\Language;
use Illuminate\Support\Str;

/*
|--------------------------------------------------------------------------
Expand All @@ -16,12 +15,9 @@
*/

$factory->define(Language::class, function (Faker $faker) {
$name = $faker->unique()->company;

return [
'name' => $name,
'lang' => ucfirst($name),
'iso' => Str::slug($name),
'name' => $faker->unique()->country,
'code' => $faker->unique()->languageCode,
'default' => $faker->boolean,
'enabled' => $faker->boolean,
];
Expand Down
4 changes: 1 addition & 3 deletions database/factories/ProductFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
return [
'attribute_data' => [
'name' => [
'webstore' => [
'en' => $faker->name,
],
'en' => $faker->name,
],
],
];
Expand Down
2 changes: 1 addition & 1 deletion database/factories/RouteFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
return [
'element_type' => Product::class,
'element_id' => 1,
'language_id' => 1,
'slug' => Str::slug($faker->word),
'path' => Str::slug($faker->word),
'default' => $faker->boolean,
];
});
23 changes: 23 additions & 0 deletions database/factories/TaxFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

use Faker\Generator as Faker;
use GetCandy\Api\Core\Taxes\Models\Tax;

/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
*/

$factory->define(Tax::class, function (Faker $faker) {
return [
'name' => $faker->word,
'percentage' => $faker->numberBetween(0, 20),
'default' => $faker->boolean,
];
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\QueryException;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

Expand All @@ -13,11 +14,17 @@ class AddSetNullOnDeleteOnOrderLines extends Migration
*/
public function up()
{
try {
Schema::table('order_lines', function (Blueprint $table) {
$table->dropForeign('order_lines_product_variant_id_foreign');
});
} catch (QueryException $e) {
//
}
Schema::table('order_lines', function (Blueprint $table) {
$table->dropForeign('order_lines_product_variant_id_foreign');
$table->foreign('product_variant_id')
->references('id')->on('product_variants')
->onDelete('SET NULL');
->references('id')->on('product_variants')
->onDelete('SET NULL');
});
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddBillingShippingCompanyNameToOrders extends Migration
{
/**
* Run the migrations.
*/
public function up()
{
Schema::table('orders', function (Blueprint $table) {
if (Schema::hasColumn('orders', 'company_name')) {
$table->dropColumn('company_name');
}
if (! Schema::hasColumn('orders', 'billing_company_name')) {
$table->string('billing_company_name')->after('billing_email')->nullable()->index();
}
if (! Schema::hasColumn('orders', 'shipping_company_name')) {
$table->string('shipping_company_name')->after('billing_email')->nullable()->index();
}
});
}

/**
* Reverse the migrations.
*/
public function down()
{
Schema::table('orders', function (Blueprint $table) {
$table->string('company_name')->nullable();
$table->dropIfExists('billing_company_name');
$table->dropIfExists('shipping_company_name');
});
}
}
Loading