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

RSVP routed #26

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
31 changes: 16 additions & 15 deletions handlers/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
func CreateEvent(c *gin.Context) {
var event models.CreateEvent
c.Writer.Header().Set("Access-Control-Allow-Origin", "*")
c.Writer.Header().Set("Access-Control-Allow-Credentials", "true")
c.Writer.Header().Set("Access-Control-Allow-Headers", "Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With")
c.Writer.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS, GET, PUT")
c.Writer.Header().Set("Access-Control-Allow-Credentials", "true")
c.Writer.Header().Set("Access-Control-Allow-Headers", "Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With")
c.Writer.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS, GET, PUT")
// Call BindJSON to bind the received JSON to event +add error handling later
if err := c.BindJSON(&event); err != nil {
fmt.Printf("error %+v", err)
Expand All @@ -33,7 +33,7 @@ func CreateEvent(c *gin.Context) {

eventrow, err := dbmap.Query(
"SELECT event_id, title, date, time, location, host_name, description, contact_info, public_private, num_of_RSVP, max_attendees FROM event ORDER BY event_id DESC LIMIT 1")
var events []models.GetEvent
var events []models.GetEvent

for eventrow.Next() {
var event models.GetEvent
Expand All @@ -53,9 +53,9 @@ func CreateEvent(c *gin.Context) {
func GetEvent(c *gin.Context) {
var events []models.GetEvent
c.Writer.Header().Set("Access-Control-Allow-Origin", "*")
c.Writer.Header().Set("Access-Control-Allow-Credentials", "true")
c.Writer.Header().Set("Access-Control-Allow-Headers", "Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With")
c.Writer.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS, GET, PUT")
c.Writer.Header().Set("Access-Control-Allow-Credentials", "true")
c.Writer.Header().Set("Access-Control-Allow-Headers", "Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With")
c.Writer.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS, GET, PUT")

seeRow := c.Param("eventID")
eventrow, err := dbmap.Query(
Expand All @@ -78,14 +78,13 @@ func GetEvent(c *gin.Context) {

func HandleCors(c *gin.Context) {
c.Writer.Header().Set("Access-Control-Allow-Origin", "*")
c.Writer.Header().Set("Access-Control-Allow-Credentials", "true")
c.Writer.Header().Set("Access-Control-Allow-Headers", "Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With")
c.Writer.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS, GET, PUT")
c.Writer.Header().Set("Access-Control-Allow-Credentials", "true")
c.Writer.Header().Set("Access-Control-Allow-Headers", "Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With")
c.Writer.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS, GET, PUT")

c.AbortWithStatus(204)
return

c.AbortWithStatus(204)
return

}

// creates a new event
Expand Down Expand Up @@ -169,7 +168,10 @@ func UpdateEvent(c *gin.Context) {

func CreateRSVP(c *gin.Context) {
var rsvp models.CreateRSVP

c.Writer.Header().Set("Access-Control-Allow-Origin", "*")
c.Writer.Header().Set("Access-Control-Allow-Credentials", "true")
c.Writer.Header().Set("Access-Control-Allow-Headers", "Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With")
c.Writer.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS, GET, PUT")
// Call BindJSON to bind the received JSON to event +add error handling later
if err := c.BindJSON(&rsvp); err != nil {
fmt.Println(err)
Expand Down Expand Up @@ -242,4 +244,3 @@ func DeleteEvent(c *gin.Context) {
}
c.JSON(204, nil) //success
}

2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ func main() {
api.GET("/event/:eventID", handlers.GetEvent)
api.OPTIONS("/event/:eventID", handlers.HandleCors)


// This endpoint will update info for an event
api.PATCH("/event/:eventID", handlers.UpdateEvent)

api.POST("/event/:eventID/rsvp", handlers.CreateRSVP)
api.OPTIONS("/event/:eventID/rsvp", handlers.HandleCors)

api.GET("/RSVP/:responseID", handlers.GetRSVP)

Expand Down
6 changes: 6 additions & 0 deletions views/js/evently/src/AboutUs.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.AboutUs {
background-color: white;
text-align: center;
height: 100%;
width: 100%;
}
31 changes: 31 additions & 0 deletions views/js/evently/src/AboutUs.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from 'react'
import './AboutUs.css'

function AboutUs() {
return (
<div className="AboutUs">
<h1>The team:</h1>
<div>
<ul>
<li>Laurent Benjamin</li>
<li>Noshin Ahmed</li>
<li>Sharron Qian</li>
<li>Tiffany Zhu</li>
<li>Umida Ravshanova</li>
</ul>
</div>
<h1>Special thanks to:</h1>
<div>
<ul>
<li>Diana Bishop</li>
<li>Ange Louis</li>
<li>Grace McGrath</li>
<li>Makayla Clausen</li>
</ul>
</div>
<h1>and everyone at Bitly who guided us on his project!</h1>
</div>
)
};

export default AboutUs;
35 changes: 9 additions & 26 deletions views/js/evently/src/App.css
Original file line number Diff line number Diff line change
@@ -1,31 +1,14 @@
.App {
text-align: center;
}

.App-logo {
height: 40vmin;
pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
}

.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
html, body {
margin: 0;
padding: 0;
border: 0;
}

.App-link {
color: #61dafb;
.App {
text-align: center;
margin: 0;
padding: 0;
border: 0;
}

ul{
Expand Down
25 changes: 12 additions & 13 deletions views/js/evently/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ import {
} from "react-router-dom";
import HomePage from './HomePage.jsx';
import CreateEvent from './CreateEvent.jsx';
// import RSVP from './RSVP.jsx';
import CommunityPage from './CommunityPage.jsx';
import AboutUs from './AboutUs.jsx';
import Header from './header.js';
import RSVP from './RSVP.jsx';
import ViewEvent from './ViewEvent.jsx';
//Add About Us page
//Add a community page

function App() {
return (
<div>
<main>
<nav>
<ul>
<li>
Expand All @@ -23,25 +24,23 @@ function App() {
<Link to="/create-event">Create</Link>
</li>
<li>
<p>RSVP</p>
{/* <Link to="/RSVP.jsx">RSVP</Link> */}
<Link to="/community-page">Community</Link>
</li>
<li>
<p>Community</p>
{/* <Link to="/Community.jsx">Community</Link> */}
</li>
<li>
<p>About Us</p>
{/* <Link to="/AboutUs.jsx">About Us</Link> */}
<Link to="/about-us">About Us</Link>
</li>
</ul>
</nav>
<Header/>
<Routes>
<Route path="/about-us" element={<AboutUs />} />
<Route path="/community-page" element={<CommunityPage />} />
<Route path="/rsvp/:event_id" element={<RSVP/>} />
<Route path="/create-event" element={<CreateEvent />} />
<Route path="/" element={<HomePage />} />
<Route path="/view-event/:event_id" element={<ViewEvent />} />
</Routes>
</div>
</main>
);
}

Expand Down
6 changes: 6 additions & 0 deletions views/js/evently/src/CommunityPage.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.Community {
background-color: white;
text-align: center;
height: 100%;
width: 100%;
}
12 changes: 12 additions & 0 deletions views/js/evently/src/CommunityPage.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react'
import './CommunityPage.css'

function CommunityPage() {
return (
<div className="Community">
<h1>Work in progress!</h1>
</div>
)
};

export default CommunityPage;
29 changes: 19 additions & 10 deletions views/js/evently/src/CreateEvent.css
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
h4 {
margin-bottom: 25px;
}

fieldset {
display: inline;

}

.input-box-fieldset {
padding-left: 50px;
padding-right: 50px;
padding-bottom: 20px;
.wrapper {
height: 200%;
width: 200%;
margin: 0;
border: 0;
padding: 0;
background-color: white;
}

.input-boxes {
width: 300px;
.input-box-fieldset, .pub-priv-box-fieldset {
width: 450px;
text-align: center;
padding-bottom: 30px;
}

.pub-priv-box-fieldset {
padding-left: 151px;
padding-right: 151px;
padding-bottom: 30px;
.input-boxes {
padding:10px;
width: 400px;
}

.container {
Expand All @@ -30,6 +38,7 @@ fieldset {
padding-left: 50px;
padding-top: 20px;
padding-right:450px;
background-color: white;
}

.upload-container {
Expand Down
11 changes: 1 addition & 10 deletions views/js/evently/src/CreateEvent.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, {useState} from 'react';
import './CreateEvent.css';
import Header from './header.js';

function CreateEvent() {
const [file, setFile] = useState();
Expand Down Expand Up @@ -38,7 +37,6 @@ if (res.status === 201) window.location.replace("/view-event/"+resJson.event_id)
console.log("EventTitle", EventTitle)
return(
<div className="wrapper">
<Header/>
<div className = "container">
<div className = "form-container">
<h2> Enter the details of your event:</h2>
Expand Down Expand Up @@ -104,7 +102,7 @@ console.log("EventTitle", EventTitle)
<h4>Contact info</h4>
<input value={ContactForm} className = "input-boxes" onChange={(e) => setContactForm(e.target.value)}/>
</fieldset> <br></br><br></br>
<button type="submit">Publish</button>
<button type="submit" className="save-button">Publish</button>
</form>
</div>

Expand All @@ -118,13 +116,6 @@ console.log("EventTitle", EventTitle)
<img src = {file} />
</fieldset>
<br></br><br></br>
<div>
{/* Button to publish draft */}


{/* Button to save draft (if have time) */}
<button type="save draft" className = "save-button">Save draft</button>
</div>
</div>
</div>
</div>
Expand Down
35 changes: 6 additions & 29 deletions views/js/evently/src/HomePage.css
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
html {
background-color: #EE6123;
}

#MainText {
/* background of page */
background-color: #EE6123;
margin: 0;
width: auto;
height: auto;
overflow: auto;
}

/* page text */
#MainText {
background-color: #EE6123;
font-size: 30px;
font-family: 'Inter';
text-align: center;
}

padding-top: 125px;
.HomePage {
height: 800px;
}

.buttons{
Expand All @@ -34,27 +32,6 @@ html {
border-radius: 8px;
}

#HomeLogo{
background-color: white;
border-radius: 50%;
padding: 7px;

height: 100px;
width: 100px;

top: 150px;
left: 10px;
position: absolute;
overflow: hidden;
}

.Title{
position: absolute;
top: 135px;
left: 150px;
color: rgb(255, 255, 255, 0.8);
}

.Text{
font-size: 80px;
color: white;
Expand Down
Loading