Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed event images not showing #57

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
Binary file added app/.DS_Store
Binary file not shown.
9 changes: 8 additions & 1 deletion app/api/v1/event/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ router
.route("/:uuid?")
.get((req, res, next) => {
if (req.user.isPending()) return next(new error.Forbidden());

// CASE: no UUID is present, should return all elements
if (!req.params.uuid || !req.params.uuid.trim()) {
const offset = parseInt(req.query.offset, 10);
Expand All @@ -62,6 +61,14 @@ router
: Event.getAll(offset, limit);
getEvents
.then((events) => {
events.forEach(e => {
// reformat google drive file links
if (e.cover && e.cover.includes('drive.google.com')) {
const fileID = e.cover.match(/\/file\/d\/(.+?)\//)[1];
e.cover = `https://drive.google.com/thumbnail?id=${fileID}&sz=s1000`;
}
})

res.json({
error: null,
events: events.map((e) => e.getPublic(req.user.isAdmin())),
Expand Down
13 changes: 12 additions & 1 deletion app/db/dev-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,17 @@ module.exports = (User, Event) => {
major: "Cognitive Science",
}),

User.create({
email: "churro@g.ucla.edu",
accessType: "ADMIN",
state: "ACTIVE",
firstName: "Charles",
lastName: "Zhu",
points: 880,
year: 2,
major: "Computer Science",
}),

Event.create({
title: "Project A*: Dynamic Programming",
description:
Expand All @@ -177,7 +188,7 @@ module.exports = (User, Event) => {
"<p>React is high-demand front-end Javascript library first created by Facebook. React powers the front-end of several major companies ranging from Facebook, AirBnb, Uber, and much more. We'll be hosting an introduction to React led by a Codesmith instructor to give you the tools necessary to work on your very first React project. Bring your laptop!</p><p>This session is designed for beginners to intermediates. React is perfect for beginners with basic HTML/CSS/Javascript knowledge looking to turn their static websites into full-fledged interactive web-apps. If you are already familiar with Javascript libraries like jQuery, learning React is a powerful alternative. Furthermore, React can be used to build mobile apps through Facebook's React Native library.</p>",
committee: "Hack",
cover:
"https://www.uclaacm.com/nextimg/%2Fimages%2Fcommittees%2Fhack%2Fhack_motif_applied.png/828/75?url=%2Fimages%2Fcommittees%2Fhack%2Fhack_motif_applied.png&w=828&q=75",
"https://drive.google.com/file/d/1W3Fu5sQ3dQzac1XCZkZo0iZyZhO4HPqE/view?usp=sharing",
location: "Blackstone LaunchPad at UCLA",
eventLink: "https://www.facebook.com/events/174847826374758/",
startDate: new Date(2017, 5, 7, 19),
Expand Down