New endpoints for transactions.

This commit is contained in:
James Cole
2018-12-04 19:36:54 +01:00
parent c0d6d0e28e
commit 64a3e46cbe
5 changed files with 68 additions and 101 deletions

View File

@@ -26,8 +26,6 @@ namespace FireflyIII\Transformers;
use FireflyIII\Models\Attachment;
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
use League\Fractal\Resource\Collection as FractalCollection;
use League\Fractal\Resource\Item;
use League\Fractal\TransformerAbstract;
use Symfony\Component\HttpFoundation\ParameterBag;
@@ -36,19 +34,6 @@ use Symfony\Component\HttpFoundation\ParameterBag;
*/
class AttachmentTransformer extends TransformerAbstract
{
/**
* List of resources possible to include
*
* @var array
*/
protected $availableIncludes = ['user'];
/**
* List of resources to automatically include
*
* @var array
*/
protected $defaultIncludes = ['user'];
/** @var ParameterBag */
protected $parameters;
@@ -68,20 +53,6 @@ class AttachmentTransformer extends TransformerAbstract
$this->repository = app(AttachmentRepositoryInterface::class);
}
/**
* Attach the user.
*
* @codeCoverageIgnore
*
* @param Attachment $attachment
*
* @return Item
*/
public function includeUser(Attachment $attachment): Item
{
return $this->item($attachment->user, new UserTransformer($this->parameters), 'users');
}
/**
* Transform attachment.
*
@@ -97,7 +68,8 @@ class AttachmentTransformer extends TransformerAbstract
'id' => (int)$attachment->id,
'updated_at' => $attachment->updated_at->toAtomString(),
'created_at' => $attachment->created_at->toAtomString(),
'attachable_type' => $attachment->attachable_type,
'attachable_id' => $attachment->attachable_id,
'attachable_type' => str_replace('FireflyIII\\Models\\','',$attachment->attachable_type),
'md5' => $attachment->md5,
'filename' => $attachment->filename,
'download_uri' => route('api.v1.attachments.download', [$attachment->id]),