OperationCode / operationcode_backend

This is the backend repo for the Operation Code website
https://operationcode.org
MIT License
62 stars 110 forks source link

Update Board Member image_src path to use absolute URLs to S3 assets #305

Closed jjhampton closed 6 years ago

jjhampton commented 6 years ago

Feature

Why is this feature being added?

Needed for front-end issue https://github.com/OperationCode/operationcode_frontend/issues/943 to be completed.

Currently, the front end Team page is not fetching Team Member data from the back-end API https://api.operationcode.org/api/v1/team_members, but is instead using static client-side JSON data.

The above front-end issue will switch to fetching that data from the API. However, for board members, the image_src property is currently in the format images/james_davis.jpg - a relative URL. It would take some extra work client-side to dynamically resolve these to the correct image asset paths. If the API instead passes an absolute URL for the correct image in our S3 bucket, the front-end could just use that value instead - similar to how the Code School API call is passing along absolute URLs to S3 for the logos.

Here is an example of the desired output from the API:

description : "Dr. James Davis is a professor at Louisiana State University, and director of the Stephenson Entrepreneurship Institute. He is also co-founder and chief technology officer of Health Engagements, a startup software development firm specializing in healthcare applications. Dr. Davis is a former captain in the U.S. Army, lieutenant colonel in the U.S. Army Reserve and recipient of the Bronze Star Medal.",
group: "board",
id: 99,
image_src: "https://s3.amazonaws.com/operationcode-assets/headshots/james_davis.jpg",
name: "Dr. James Davis",
role: "Chairman",
updated_at:"2018-04-13T14:55:24.646Z"

Additional Info

Moving forward, we’ll get the TeamMember db table accessible in the admin dashboard, and this can be maintained there

What should your feature do?

Allows the API to pass along absolute URLs (to S3) for the Board Member images that are used on the Team page.

hpjaj commented 6 years ago

Completed in https://github.com/OperationCode/operationcode_backend/pull/306