Skip to content

Commit

Permalink
ergwr
Browse files Browse the repository at this point in the history
  • Loading branch information
billy1479 committed Dec 6, 2023
1 parent 4c4eabb commit 0e0cecb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
14 changes: 7 additions & 7 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
"extends": "standard",
"rules": {
"semi": [2, "always"],
"indent": "off"
}
};
// module.exports = {
// "extends": "standard",
// "rules": {
// "semi": [2, "always"],
// "indent": "off"
// }
// };
28 changes: 14 additions & 14 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const express = require('express');
const app = express()
const fs = require('fs')
const app = express();
const fs = require('fs');

const bookingsFile = './client/Data/bookings.json';
const currentFilmsFile = './client/Data/currentFilms.json';
Expand All @@ -18,42 +18,42 @@ const upcomingFilms = require(upcomingFilmsFile);

app.get('/currentFilms', function (req, resp) {
resp.send(currentFilms);
})
});

app.get('/upcomingFilms', function (req, resp) {
resp.send(upcomingFilms);
})
});

app.get('/reruns', function (req, resp) {
resp.send(reruns);
})
});

app.get('/filmNames', function (req, resp) {
var filmNameArray = [];
var currentFilmKeys = Object.keys(currentFilms);
currentFilmKeys.forEach(function (x) {
filmNameArray.push([currentFilms[x][0], x]);
})
});

var upComingFilmKeys = Object.keys(upcomingFilms);
upComingFilmKeys.forEach(function (x) {
filmNameArray.push([upcomingFilms[x][0], x]);
})
});

var rerunsFilmKeys = Object.keys(reruns);
rerunsFilmKeys.forEach(function (x) {
filmNameArray.push([reruns[x][0], x]);
})
});
resp.send(filmNameArray);
})
});

// For the search bar
app.get('/Bookings/:email', function (req,resp) {
const email = req.params.email;
const bookingEmails = Object.keys(bookings);
const bookingEmails = Object.keys(bookings);
try {
result = bookings[email]
} catch(err) {result = ['False']}
result = bookings[email];
} catch(err) {result = ['False']};
resp.send(result);
})

Expand All @@ -70,7 +70,7 @@ app.post('/Bookings/MakeABooking', function (req, resp) {
var value = [date, film, filmTime, noOfAdults, noOfChildren, firstName, surname]
bookings[userEmail] = value;
fs.writeFileSync(bookingsFile, JSON.stringify(bookings));
resp.send(value)
resp.send(value);
})

module.exports = app;
module.exports = app;
2 changes: 1 addition & 1 deletion client/Data/bookings.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"[email protected]":["2023-01-28","Transformers: Rise of the Beasts","10.00AM","1","0","Billy","Stapleton"]}
{"[email protected]":["2023-01-28","Transformers: Rise of the Beasts","10.00AM","1","0","Billy","Stapleton"],"[email protected]":["2023-01-24","SMATSV","screen1",1,1,"Billy","Stapleton"]}

0 comments on commit 0e0cecb

Please sign in to comment.