Releases: costs-to-expect/api
Releases · costs-to-expect/api
Multiple item types
[v2.04.0] - 2019-11-11
Added
- We have added a GitHub callout to the top right corner of the API landing page, courtesy of https://github.com/tholman/github-corners.
Changed
- We have updated the code to ensure the data arrays in the config files get used whenever possible; minor data arrays for parameters defined in two locations.
- We have added additional summary models.
- We have moved the item and resource type item models, now organised by namespace, not the class filename.
- We have moved the item and resource type item transformers, now organised by namespace, not the class filename.
- We have moved all the
existsToUser
methods out of theitem
models and into aPermittedUser
model. - We have updated the
item
andresource type item
summary routes; they respect the chosen resource type (Allocated expenses and Simple expenses) and provide the relevant summary.
Fixed
- We have corrected several more class names, incorrect capitalisation.
[v2.03.0] - 2019-10-27
Added
- We have added a new route,
item-types
, the route shows the item types supported by the API.
Changed
- We have updated the landing page; the focus was previously on the website; the API is the backbone of the entire service; the site is ancillary.
- We have moved the summary controllers; we should use namespaces to organise the code, not filenames.
- We have moved the summary transformers; we should use namespaces to organise the code, not filenames.
- We have started to move the summary models; we should use namespaces to organise the code, not filenames.
- We have merged the authorised and general API routes section, the README details the API routes and the API summary routes in two tables.
- We have moved some configuration files. We thought it was odd how some were outside of folders; additionally, config files should only be in folders if there can be multiple files for the 'section'.
- We have moved localisation files to match their config partners.
- We have updated the allowed values for the
year
GET parameter; we derive the values from the data; the limit for Jack should be 2013 to 2019, for Niall te limit should be 2019. - We have updated the GET parameter validator; supplied values validated against values defined in the OPTIONS request.
Fixed
- We have corrected the category summary routes in the README.
- We have corrected the name of a few transformers, incorrect capitalisation.
- We have corrected the name of a few controllers, incorrect capitalisation.
- We have set the salt for the item type hasher.
- For uncaught exceptions, we return the trace when the API is in development mode.
- We have updated the code to generate conditional GET parameters; the item type defines which parameters exist.
Simple expense item type
Added
- We have updated the create resource type route. It is now possible to set the item type that you want to use. There are two expense types, "allocated expense" and "simple expense". An allocated expense allows you to allocated a percentage of the total cost; a simple expense only has a total, no allocation rate.
- The supported item types exposed in the resource types OPTIONS request, additional item types will be added over time.
- We have added an item type hasher to hash the ids for item types.
- We have added support for simple expenses, create a simple expense resource type and off you go, "simple expenses" instead of "allocated expenses".
Changed
- We have added an interface to use when interacting with items; it works out the item type by looking at the resource and then returns the relevant models and configuration data.
- We have updated numerous sections of the API to dynamically expose the relevant fields, sort parameters and search parameters etc. based on the current item type.
- We have moved several
item
based configuration files into the relevant item type folder.
Minor fixes and new Header
Added
- We have added an
X-Parameters
header; it contains the validated parameters for the request.
Changed
- We have updated the README; we have added a Headers section detailing the purpose of each Header.
- Requests are now only logged when the app is not in development mode.
Fixed
- The
required
value is incorrectly set totrue
for fields in the PATCH section of the options request. - We have corrected the queries for the total counts.
Minor change to item objects
Changed
- The
description
field in theitem_type
tables is now nullable. - We have updated the
item_type
tables; all descriptions are now null. - We have upgraded to version 5.8 of the Laravel framework.
Fixed
- The subcategory parameter is only passed through to the relevant controller if the category parameter is also valid.
Permitted users and multiple item types
Added
- We have added
updated_by
to theitem
table, records the user who was last to update a record. - We have added a
permitted_users
table; this is used to link users and resource types. - A permitted user record created/removed on addition/removal of a resource type.
- We have added a custom validator
ResourceTypeName
; it checks the given name is unique for the user based on the resource types they are permitted to modify. - We have added two useful properties to the base controller,
permitted_resource_types
andinclude_public
. - There are now two item types, allocated expense and simple expense. We have split the item table; there is the base item data and then the data for the specific item type.
Changed
- We have updated the
item
table,user_id
field has been changed tocreated_by
. - We have updated the validation rules for resource types; now aware of permitted users.
- We have renamed the
private
field in theresource_type
table; it is nowpublic
, the flag is no longer used to hide the data so it should be named based on the goal. - We have modified all requests to fetch resource types; the queries now take into account the public setting the resource types you are permitted to manage.
- We have reworked the
resource type
,resource
,item
,category
,subcategory
,item category
anditem subcategory
route validators. The validators check your permitted resource types, your intended action and the existence of theitem
based on your permissions. - We have added additional messages into the language files; API is multi-lingual friendly.
- We have renamed the route validation helper methods, the class is called
Route
, we don't also needroute
in the name. - We have renamed any incorrectly spelt subcategory variables, the space between
sub
andcategory
needed to go; models, classes and controllers, later. - We have updated the authentication field in the OPTIONS requests; we now show if authentications required for the HTTP verb and what your current authentication status is.
- We have added a base class for the
Option
classes to remove code duplication. - We have updated the
Option
classes; they now return the current authentication status for the current request. - We have renamed the
sub_category
field for theGET/resource-types/[resource-type]/resources/[resource]/items/[item]/category[category]/subcategory
collection and item. - We have recreated the migration files for new installs. NOTE: you cannot upgrade from v1 to v2 with the included migrations. I have an upgrade SQL file if you need help converting to the new schema.
Fixed
- We now return a more friendly error message for unauthenticated requests.
Removed
- We have removed
include_private
andresource_type_private
from the code, replaced byinclude_public
andpermitted_resources_types
.
Summary routes
Added
- We have added a new summary route,
/summary/categories
. - We have added a new summary route,
/summary/categories/{category_id}/subcategories
.
Changed
- We have added
X-Count
headers to several endpoints from which they were missing. - Content corrections in the README.
Fixed
- Minor corrections after the creation of additional Postman monitors.
More minor fixes
Added
- We have added an error log database table, initially, for capturing 500 errors.
- We have added an
InternalError
event and listener. After writing the error to the database, we send an email with the error.
Changed
- We have added string length validation for hashed id values; all should be ten characters.
- We have reduced the
request/access-log
limit to 25, from 50. - We have renamed the
CaptureAndSend
listener; it is specific to request errors so the name should beCaptureAndSendRequestError
.
Minor fixes
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.
PATCH support...finally
Added
- We have added PATCH support for categories; if authenticated, you can update the selected category.
- We have added PATCH support for subcategories; if authenticated, you can update the selected subcategory.
- We have added PATCH support for resource types; if authenticated, you can update the selected resource type.
- We have added PATCH support for resources; if authenticated, you can update the selected resource.
- We have added a Request utility class with helper methods for POST and PATCH request validation.
Changed
- Updated the copyright, should be G3D Development Limited, not me personally.
- We have removed the protected
areThereInvalidFieldsInRequest
method from the base controller. - We have removed the protected
isThereAnythingToPatchInRequest
method from the base controller. - We have removed the protected
returnValidationErrors
method from the base controller. - We have updated the README and added Mailgun.
Fixed
- We have corrected some data; the assigned categories and subcategories were missing for six expenses.
Debug field added to request error log
Added
- We have added a
debug
field to the request error log; you can optionally provide information that may be useful in tracking down the error.