Skip to content

Commit

Permalink
update queries/schemas/components to pull through images for images 4…
Browse files Browse the repository at this point in the history
… and 5 too

relates #22
  • Loading branch information
jessicasalmon committed Nov 23, 2017
1 parent 851f6c9 commit c0e6e4a
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 22 deletions.
8 changes: 5 additions & 3 deletions graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ type Building {
recommendation: String,
latitude: Float,
longitude: Float,
image_main: String,
image_second: String,
image_third: String
featured_image: String,
second_image: String,
third_image: String,
fourth_image: String,
fifth_image: String
}

type Query {
Expand Down
13 changes: 6 additions & 7 deletions helpers/createDataObj.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const createDataObj = (data) => {
street_name: item['Street Name'],
postcode: item['Post Code'],
ward: item['Ward'],
conservation_area: item['Conservation Area'],
conservation_area: item['Conservation Area'],
date_built_actual: item['Date Built (actual)'],
date_built_estimate: item['Date Built (estimated/ unconfirmed)'],
architectural_style: item['Architectural Style'],
Expand All @@ -17,14 +17,13 @@ const createDataObj = (data) => {
recommendation: item['Recommendation'],
latitude: item['Latitude'],
longitude: item['Longitude'],
image_main: item['Image Main'],
image_second: item['Image Second'],
image_third: item['Image Third']
featured_image: item['Featured Image'],
second_image: item['Second Image'],
third_image: item['Third Image'],
fourth_image: item['Fourth Image'],
fifth_image: item['Fifth Image']
};
});
}

module.exports = createDataObj;



8 changes: 5 additions & 3 deletions models/islington.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ const islingtonSchema = new Schema({
recommendation: String,
latitude: Number,
longitude: Number,
image_main: String,
image_second: String,
image_third: String
featured_image: String,
second_image: String,
third_image: String,
fourth_image: String,
fifth_image: String
});

const Islington = mongoose.model("Islington", islingtonSchema);
Expand Down
8 changes: 5 additions & 3 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@ const query = gql`
recommendation
latitude
longitude
image_main
image_second
image_third
featured_image
second_image
third_image
fourth_image
fifth_image
}
}
`;
Expand Down
17 changes: 11 additions & 6 deletions src/BuildingDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ const BuildingDetails = ({ building }) => {
recommendation,
latitude,
longitude,
image_main,
image_second,
image_third } = building
featured_image,
second_image,
third_image,
fourth_image,
fifth_image
} = building

return (
<div>
Expand All @@ -40,9 +43,11 @@ const BuildingDetails = ({ building }) => {
<div> { date_local_listing } </div>
<div> { significance } </div>
<div> { recommendation } </div>
<img src={ image_main } />
<img src={ image_second } />
<img src={ image_third } />
<img src={ featured_image } />
<img src={ second_image } />
<img src={ third_image } />
<img src={ fourth_image } />
<img src={ fifth_image } />
</div>
);
};
Expand Down

0 comments on commit c0e6e4a

Please sign in to comment.