Problem/Motivation

File resolver for media file fields.

Proposed resolution

Add file field
Add File type
Add FileField resolver
Add File type to graphqls

Remaining tasks

User interface changes

NA

API changes

Add File

Data model changes

Add File

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Al Munnings created an issue. See original summary.

almunnings’s picture

Assigned: almunnings » Unassigned
Status: Active » Needs review

Patch adds File resolution. Looking for feedback :)

jmolivas’s picture

Thanks for the MR @Al Munnings, can you please fix the namespace "vcaas_graphql" as "graphql_compose"

jmolivas’s picture

Also let me know what do you think about, since the returned properties are related to the file scope

What is your opinion to rename properties from this:

      return [
        'url' => \Drupal::service('file_url_generator')->generateAbsoluteString($entity->getFileUri()),
        'filename' => $entity->getFilename(),
        'filesize' => (int) $entity->getSize(),
        'filemime' => $entity->getMimeType(),
      ];

to this:

      return [
        'url' => \Drupal::service('file_url_generator')->generateAbsoluteString($entity->getFileUri()),
        'name' => $entity->getFilename(),
        'size' => (int) $entity->getSize(),
        'mime' => $entity->getMimeType(),
      ];
jmolivas’s picture

Status: Needs review » Needs work

Also let me know what do you think about, since the returned properties are related to the file scope

What is your opinion to rename properties from this:

      return [
        'url' => \Drupal::service('file_url_generator')->generateAbsoluteString($entity->getFileUri()),
        'filename' => $entity->getFilename(),
        'filesize' => (int) $entity->getSize(),
        'filemime' => $entity->getMimeType(),
      ];

to this:

      return [
        'url' => \Drupal::service('file_url_generator')->generateAbsoluteString($entity->getFileUri()),
        'name' => $entity->getFilename(),
        'size' => (int) $entity->getSize(),
        'mime' => $entity->getMimeType(),
      ];
almunnings’s picture

Apologies on namespace, I double tapped the MR, so thats resolved in MR 30. Please ignore 29.

RE: Prop values. Yeah that makes sense, I'll update.

almunnings’s picture

Status: Needs work » Needs review

.

jmolivas’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.