Skip to content

Commit

Permalink
Merge pull request #138 from deanblackborough/v1.22.1
Browse files Browse the repository at this point in the history
v1.22.1
  • Loading branch information
deanblackborough authored Aug 30, 2019
2 parents ad8a672 + fe0840f commit fb70b9c
Show file tree
Hide file tree
Showing 29 changed files with 91 additions and 43 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ XDEBUG_CONFIG=remote_host=host.docker.internal

MAILGUN_DOMAIN=
MAILGUN_SECRET=
MAILGUN_ENDPOINT=api.eu.mailgun.net

MAIL_FROM_ADDRESS=
MAIL_FROM_NAME
MAIL_TO_ADDRESS=
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

The complete changelog for the Costs to Expect REST API, follows the format defined at https://keepachangelog.com/en/1.0.0/

## [v1.22.1] - 2019-09-01
### Changed
- We have updated the domain for Mailgun, now mail.costs-to-expect.com rather than the temp domain.
- We have updated the OPTIONS requestion, they now show additional validation data if necessary.
- We have continued to unify information names in the OPTIONS requests; we use dashes instead of underscores.
- We have updated the from setting for emails so 'on behalf of' doesn't show for sent emails.

### Fixed
- `PATCH` missing from web.config, we have also corrected the PHP version number.
- String length validation rules missing from validation checks.

## [v1.22.0] - 2019-08-25
### Added
- We have added PATCH support for categories; if authenticated, you can update the selected category.
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/CategoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ private function conditionalPostParameters(): array
UtilityResponse::unableToDecode();
}

$conditional_post_fields['resource_type_id']['allowed_values'][$id] = [
$conditional_post_fields['resource_type_id']['allowed-values'][$id] = [
'value' => $id,
'name' => $resource_type['resource_type_name'],
'description' => $resource_type['resource_type_description']
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function optionsIndex(Request $request)
[
'GET' => [
'description' => trans('route-descriptions.api_GET_index'),
'authentication_required' => false,
'authentication-required' => false,
'parameters' => []
]
]
Expand Down Expand Up @@ -137,7 +137,7 @@ public function optionsChangeLog(Request $request)
[
'GET' => [
'description' => trans('route-descriptions.api_GET_changelog'),
'authentication_required' => false,
'authentication-required' => false,
'parameters' => []
]
]
Expand Down
19 changes: 0 additions & 19 deletions app/Http/Controllers/ItemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,25 +191,6 @@ public function optionsIndex(
$get + $post,
200
);

/*return $this->generateOptionsForIndex(
[
'description_localisation_string' => 'route-descriptions.item_GET_index',
'parameters_config_string' => 'api.item.parameters.collection',
'conditionals_config' => $conditional_parameters,
'sortable_config' => 'api.item.sortable',
'searchable_config' => 'api.item.searchable',
'enable_pagination' => true,
'allow_entire_collection' => $this->allow_entire_collection,
'authentication_required' => false
],
[
'description_localisation_string' => 'route-descriptions.item_POST',
'fields_config' => 'api.item.fields',
'conditionals_config' => [],
'authentication_required' => true
]
);*/
}

/**
Expand Down
6 changes: 4 additions & 2 deletions app/Mail/RequestError.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class RequestError extends Mailable
use Queueable, SerializesModels;

public $api_from_mail;
public $api_from_name;
public $request_error;

/**
Expand All @@ -24,7 +25,8 @@ class RequestError extends Mailable
*/
public function __construct(array $request_error)
{
$this->api_from_mail = Config::get('api.mail.request-error.from');
$this->api_from_mail = Config::get('api.mail.request-error.from_mail');
$this->api_from_name = Config::get('api.mail.request-error.from_name');
$this->request_error = $request_error;
}

Expand All @@ -35,7 +37,7 @@ public function __construct(array $request_error)
*/
public function build()
{
return $this->from($this->api_from_mail)->
return $this->from($this->api_from_mail, $this->api_from_name)->
view('mail.request-error')->
subject('Costs to Expect API: Request error');
}
Expand Down
2 changes: 1 addition & 1 deletion app/Option/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static public function option(): array
return [
'DELETE' => [
'description' => self::$description,
'authentication_required' => self::$authentication
'authentication-required' => self::$authentication
]
];
}
Expand Down
2 changes: 1 addition & 1 deletion app/Option/Get.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ static public function option(): array
return [
'GET' => [
'description' => self::$description,
'authentication_required' => self::$authentication,
'authentication-required' => self::$authentication,
'sortable' => self::$sortable_parameters,
'searchable' => self::$searchable_parameters,
'parameters' => self::$localised_parameters
Expand Down
2 changes: 1 addition & 1 deletion app/Option/Patch.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ static public function option(): array
return [
'PATCH' => [
'description' => self::$description,
'authentication_required' => self::$authentication,
'authentication-required' => self::$authentication,
'fields' => self::$localised_fields
]
];
Expand Down
2 changes: 1 addition & 1 deletion app/Option/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ static public function option(): array
return [
'POST' => [
'description' => self::$description,
'authentication_required' => self::$authentication,
'authentication-required' => self::$authentication,
'fields' => self::$localised_fields
]
];
Expand Down
2 changes: 2 additions & 0 deletions app/Validators/Request/Fields/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ private function createRules(int $resource_type_id = null): array
'name' => [
'required',
'string',
'max:255',
'unique:category,name,null,id,resource_type_id,' . $resource_type_id
],
],
Expand All @@ -53,6 +54,7 @@ private function updateRules(int $category_id, int $resource_type_id): array
'name' => [
'sometimes',
'string',
'max:255',
'unique:category,name,'. $category_id . ',id,resource_type_id,' . $resource_type_id
],
],
Expand Down
2 changes: 2 additions & 0 deletions app/Validators/Request/Fields/Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ private function createRules(int $resource_type_id): array
'name' => [
'required',
'string',
'max:255',
'unique:resource,name,null,id,resource_type_id,' . $resource_type_id
],
],
Expand All @@ -54,6 +55,7 @@ private function updateRules(int $resource_type_id, int $resource_id): array
'name' => [
'sometimes',
'string',
'max:255',
'unique:resource,name,'. $resource_id . ',id,resource_type_id,' . $resource_type_id
],
],
Expand Down
1 change: 1 addition & 0 deletions app/Validators/Request/Fields/ResourceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ private function updateRules(int $resource_type_id): array
'name' => [
'sometimes',
'string',
'max:255',
'unique:resource_type,name,'. $resource_type_id . ',id'
],
],
Expand Down
2 changes: 2 additions & 0 deletions app/Validators/Request/Fields/SubCategory.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ private function createRules(int $category_id): array
'name' => [
'required',
'string',
'max:255',
'unique:sub_category,name,null,id,category_id,' . $category_id
],
],
Expand All @@ -53,6 +54,7 @@ private function updateRules(int $category_id, int $subcategory_id): array
'name' => [
'sometimes',
'string',
'max:255',
'unique:sub_category,name,'. $subcategory_id . ',id,category_id,' . $category_id
],
],
Expand Down
7 changes: 7 additions & 0 deletions config/api/category/fields-patch.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,20 @@
'title' => 'category/fields.title-name',
'description' => 'category/fields.description-name',
'type' => 'string',
'validation' => [
'unique-for' => 'resource_type_id',
'max-length' => 255
],
'required' => true
],
'description' => [
'field' => 'description',
'title' => 'category/fields.title-description',
'description' => 'category/fields.description-description',
'type' => 'string',
'validation' => [
'max-length' => 255
],
'required' => true
]
];
7 changes: 7 additions & 0 deletions config/api/category/fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,20 @@
'title' => 'category/fields.title-name',
'description' => 'category/fields.description-name',
'type' => 'string',
'validation' => [
'unique-for' => 'resource_type_id',
'max-length' => 255
],
'required' => true
],
'description' => [
'field' => 'description',
'title' => 'category/fields.title-description',
'description' => 'category/fields.description-description',
'type' => 'string',
'validation' => [
'max-length' => 255
],
'required' => true
],
'resource_type_id' => [
Expand Down
2 changes: 1 addition & 1 deletion config/api/category/validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
],
'PATCH' => [
'fields' => [
'description' => 'sometimes|string'
'description' => 'sometimes|string|max:255'
],
'messages' => [
'name.unique' => 'category/validation.name-unique'
Expand Down
9 changes: 8 additions & 1 deletion config/api/item/fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
'title' => 'item/fields.title-description',
'description' => 'item/fields.description-description',
'type' => 'string',
'validation' => [
'max-length' => 255
],
'required' => true
],
'effective_date' => [
Expand Down Expand Up @@ -35,7 +38,11 @@
'field' => 'percentage',
'title' => 'item/fields.title-percentage',
'description' => 'item/fields.description-percentage',
'type' => 'string',
'type' => 'integer',
'validation' => [
'min' => 1,
'max' => 100
],
'required' => false
]
];
2 changes: 1 addition & 1 deletion config/api/item/validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
return [
'POST' => [
'fields' => [
'description' => 'required|string',
'description' => 'required|string|max:255',
'effective_date' => 'required|date_format:Y-m-d',
'publish_after' => 'sometimes|date_format:Y-m-d',
'total' => 'required|string|regex:/^\d+\.\d{2}$/',
Expand Down
3 changes: 2 additions & 1 deletion config/api/mail/request-error.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
declare(strict_types=1);

return [
'from' => env('MAIL_FROM_ADDRESS'),
'from_mail' => env('MAIL_FROM_ADDRESS'),
'from_name' => env('MAIL_FROM_NAME'),
'to' => env('MAIL_TO_ADDRESS'),
];
6 changes: 6 additions & 0 deletions config/api/resource-type/fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@
'title' => 'resource-type/fields.title-name',
'description' => 'resource-type/fields.description-name',
'type' => 'string',
'validation' => [
'max-length' => 255
],
'required' => true
],
'description' => [
'field' => 'description',
'title' => 'resource-type/fields.title-description',
'description' => 'resource-type/fields.description-description',
'type' => 'string',
'validation' => [
'max-length' => 255
],
'required' => true
],
'private' => [
Expand Down
6 changes: 3 additions & 3 deletions config/api/resource-type/validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
return [
'POST' => [
'fields' => [
'name' => 'required|string|unique:resource_type,name',
'description' => 'required|string',
'name' => 'required|string|max:255|unique:resource_type,name',
'description' => 'required|string|max:255',
'private' => 'sometimes|boolean'
],
'messages' => [
Expand All @@ -15,7 +15,7 @@
],
'PATCH' => [
'fields' => [
'description' => 'sometimes|string',
'description' => 'sometimes|string|max:255',
'private' => 'sometimes|boolean'
],
'messages' => [
Expand Down
7 changes: 7 additions & 0 deletions config/api/resource/fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,20 @@
'title' => 'resource/fields.title-name',
'description' => 'resource/fields.description-name',
'type' => 'string',
'validation' => [
'unique-for' => 'resource_type_id',
'max-length' => 255
],
'required' => true
],
'description' => [
'field' => 'description',
'title' => 'resource/fields.title-description',
'description' => 'resource/fields.description-description',
'type' => 'string',
'validation' => [
'max-length' => 255
],
'required' => true
],
'effective_date' => [
Expand Down
6 changes: 4 additions & 2 deletions config/api/resource/validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
'fields' => [
'description' => [
'required',
'string'
'string',
'max:255'
],
'effective_date' => [
'required',
Expand All @@ -23,7 +24,8 @@
'fields' => [
'description' => [
'sometimes',
'string'
'string',
'max:255'
],
'effective_date' => [
'sometimes',
Expand Down
7 changes: 7 additions & 0 deletions config/api/subcategory/fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,20 @@
'title' => 'subcategory/fields.title-name',
'description' => 'subcategory/fields.description-name',
'type' => 'string',
'validation' => [
'unique-for' => 'category_id',
'max-length' => 255
],
'required' => true
],
'description' => [
'field' => 'description',
'title' => 'subcategory/fields.title-description',
'description' => 'subcategory/fields.description-description',
'type' => 'string',
'validation' => [
'max-length' => 255
],
'required' => true
]
];
Loading

0 comments on commit fb70b9c

Please sign in to comment.