Skip to content

Releases: costs-to-expect/api

The Game item-type and more caching

07 Nov 14:51
4b25529
Compare
Choose a tag to compare

In this release, we continue our long-term task of ensuring the API can handle all the different item-types we have planned. The initial version of the API focused on expenses; slowly, we are adjusting the API to a more modular system.

Added

  • We are now locally caching the permitted and viewable resource types; this change means we can skip a more expensive query per API request whilst the response is cached, we are experimenting with the TTL.

Changed

  • We have added item name and description fields to the partial-transfers collection.
  • We have updated the schema for partial-transfers.
  • We have updated the game item-type; the winner field will now be null or an object, the object will have an id and a name.
  • We have updated the OPTIONS request for the game item-type; the allowed values for the winner field will display if necessary.
  • We have tweaked our middleware; we use our Hash class rather than duplicating the effort.
  • We have created several new classes to generate the allowed values data; these new classes are specific to each of our supported item-type. This change will speed up the OPTIONS requests for the non allocated-expense item type as we will no longer query the database when we know there will be no results.
  • We have added a check to limit access to the partial-transfers route. The 'allocated-expense' item-type supports the partial-transfers feature, partial-transfers don't make sense for the other item-types.
  • We have drastically simplified route validation. The API controls access to resources at the resource type level; we have updated all route checks to validate the requested resource type rather than validate specific access to the request entity.

Fixed

  • We have corrected several configuration file calls; our calls were looking at transfers, not partial transfers.
  • We have added localisation files for the simple-item and game item-type, several were missing.

Cache fix

18 Oct 22:15
594d103
Compare
Choose a tag to compare

In this release, we correct a minor cache issue and add extra information to resource type objects.

Changed

  • We have updated the friendly_name for item types; the updated names provide more information and make customising the App simpler.
  • We have updated the item-type object included within the resource type object; the item-type object will include the friendly_name field.
  • We have updated the description for our game item type; we are going to support dice games.
  • We have removed the duplicated includeUnpublished functions and added a reusable method to our Clause class.
  • We have disabled sessions for our web routes.

Fixed

  • We have corrected an issue with our cache; we were incorrectly creating public cache entries rather than private cache entries. No data is leaking because the cache for resource types controls access and the resource type cache is correct.
  • We have renamed the method which adds the clause to include unpublished costs. By default, the method excludes unpublished expenses, so we renamed the method to make the intention clear.

Board and Card game scoring

15 Oct 09:19
d142b20
Compare
Choose a tag to compare

In this release, we add initial support for our new feature, Board and Card game scoring. We expect there will be a couple of point updates as we develop the rest of the new feature in the Costs to Expect App.

Added

  • We have added a migration to create the game item-type table.
  • We have added the configuration for the game item-types.
  • We have added a schema for the game item-type.
  • We have added a schema for the game resource type item-type.
  • We have updated the item and resource type item collections; the collections are aware of the new game item-type.
  • We have updated the summary routes; the item and resource type item summaries are aware of the new game item-type.

Changed

  • We are upgrading summaries; the new game summaries include much more information than other summaries. We will upgrade all the summaries a little bit at a time.

Fixed

  • We have removed a rogue validation rule present in the POST request for the allocated-expense item type.
  • We have updated the item category and subcategory assignment routes. Category and subcategory assignment routes can show more than one item in the collection if the item-type configuration allows.

Multiple categories and item subtypes

08 Oct 09:58
7b78e1a
Compare
Choose a tag to compare

Added

  • We have added an item-subtype table; the subtypes will allow us to customise individual item-types within the Costs to Expect App.
  • We have added a migration for the new item-type and the subtypes supported by the item-type.
  • We have updated all resource collection and item response, we will include the selected item-subtype in the response.
  • We have added an item-subtype schema.
  • We have added an assigned-category schema for category assignments.
  • We have added an assigned-subcategory schema for subcategory assignments.

Changed

  • We have modified the unique indexes on the item_category and item_sub_category table; we need to remove the unique index to allow multiple category assignments per item.
  • We have updated create resource; we need you to define the item-subtype when creating a resource.
  • We have added comments to the allocated-expense and simple-expense models. We left join to the category and subcategory tables knowing there will only ever be at most one category. For later item-types multiple categories will get assigned to an item, we will need to come up with an alternative solution.
  • We have updated the clear cache calls for delete requests; we no longer add a job to the queue, we clear the cache synchronously.

Fixed

  • We have updated create resource type; we didn't start a transaction.
  • We have updated the returned response after creating a resource type; the chosen item type will now show in the response.

Multiple currencies

28 Sep 10:38
3047583
Compare
Choose a tag to compare

Added

  • We have updated the API to support multiple currencies, we are starting with GBP, USD and EUR.
  • We have added a /currencies route to detail the supported currencies.
  • We have increased the scope of our development test suite, specifically with regards to summaries.
  • We have added a /queue route to show the number of jobs in the queue.

Changed

  • We have updated our item collections. If the item type includes a monetary value, a currency object will be part of the response.
  • We have updated the relevant item POSTs, currency_id is now required.
  • We have updated the relevant item PATCHes, `currency_id is an allowable field.
  • We have updated our item summaries, the format of the response summary objects supports multiple currencies if necessary.
  • We have updated our resource type item summaries, the format of the response summary objects supports multiple currencies if necessary.

Corrected permitted user check

17 Sep 09:26
b551e88
Compare
Choose a tag to compare

Changed

  • We have changed the cache which gets cleared when we create or delete a resource.
  • We have added a delay for the job which clears the cache on creation or deletion of a resource type and resource.

Fixed

  • We have corrected a type error; the permitted user check fails because of a type error.

Utilise queues

15 Sep 15:16
931e4d9
Compare
Choose a tag to compare

In this release, we move cache invalidation requests to a separate process. We have decided to utilise Laravel queues, so far, the API is more performant, and the minor delay in clearing cache is not causing any issues.

Added

  • We have added support for queues; we clear all cache via queues.

Changed

  • We have updated all our management controllers, we add a job to the queue rather than clearing the necessary cache synchronously.
  • We have added the Postman collection link to the menu and renamed the documentation button.
  • We have updated our README and included details on how to start the queue.

Fixed

  • We have corrected a couple of minor coding issues, unused parameters etc.
  • We have updated our changelog, small spelling error.
  • We have updated our controllers and added missing return statements.

Allowed values in OPTIONS requests and other bugs

12 Sep 15:35
d0c8ae7
Compare
Choose a tag to compare

Added

  • We have added additional tests to our POSTMAN test collection to ensure allowed values exist where expected.
  • We have updated our OPTIONS responses for summary controllers; where relevant, and we show the allowed values for a parameter or field.

Changed

  • We have updated our back-end dependencies.
  • We have updated our OPTIONS requests; in some cases, we were not showing allowed values for POST fields and GET parameters.

Fixed

  • We have tweaked our cache query; we use UNIX_TIMESTAMP() for comparison.
  • We have removed a unique index from the resource_type table.
  • We have updated the OPTIONS response for the resource-types collection; we show the allowed values for the item_type_id.

Item types more configuration driven

09 Sep 12:40
2e12526
Compare
Choose a tag to compare

Added

  • We have reworked our item configuration; we are moving away from multiple item type classes and moving towards a configuration based setup.

Changed

  • We have updated web.config; our server will not serve static JSON files.
  • We have updated our back-end dependencies.
  • We will no longer send request error mails for 404s; the number of emails is getting out of hand.
  • We have updated our cache manager; some endpoints will only ever have a public cache, never a private cache.

Fixed

  • We have fixed a small bug when creating items of type 'simple-item' and 'simple-expense'; we are not setting a date for 'created_at`.
  • We have tweaked our cache management system; our system will not create a private cache for authenticated users when they are looking at public endpoints for which they have no permissions.
  • We have updated the allowed values for some OPTIONS requests; the allowed values are sometimes not displaying.
  • We have made a minor tweak to the query for selecting cache keys.

Tweaks and fixes

22 Jul 15:04
b2cf26d
Compare
Choose a tag to compare

Added

  • We have added the ability to exclude public resource types; to exclude public resource types include exclude-public=1 in your request URIs.
  • We have added support for database transactions; if we are modifying more than one table, we use database transactions.
  • We have added a route to show the number of cached keys for the authenticated user and then optionally delete.
  • We have included the schema files for the API. The schema files are accessible at /api/schema/[type].

Changed

  • We have reworked our Option responses; we have moved the code from the controllers ready for the creation of a new package/library.
  • We have removed some duplication in our controllers, fetching dynamic data for Options requests and validation responses is simpler.
  • We have updated all manage controllers; we make use of the existinguser_id property if we need a user_id.
  • We have reworked how we are clearing cache; we clear the cache for all permitted users when any user makes a cache clearing change.

Fixed

  • We have fixed a couple of instances where we are not passing ids through our hashers.
  • We have fixed the included category and subcategory objects in the resource type items collection.
  • We have fixed a couple of transformers; we were not correctly formatting totals.
  • We have corrected not found calls; in some cases, we were showing error messages on our live environment that we don't want to show.
  • We have fixed the allowed values subcategories array; when we show the allowed values array with a validation error, the collection will have values.
  • We have reworked all our deletes; in some cases, we were possibly creating null references.
  • We have moved a call to fetch a config value; the function call is inside a loop which is a performance issue.
  • We have updated the item type models': the updated_at and created_at come from the relevant item type model.

Removed

  • We have removed all API request logging; the request logging isn't adding any value data that we can't get via other means.