Skip to content

Commit

Permalink
UI+Connec
Browse files Browse the repository at this point in the history
  • Loading branch information
GO-viper7 committed Sep 3, 2022
1 parent a9ac6dd commit b41df8d
Show file tree
Hide file tree
Showing 56 changed files with 3,675 additions and 1,940 deletions.
11 changes: 9 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ app.use(express.static(path.join(__dirname, 'public')));
app.set("view engine", "ejs");
app.use(cookies.express(["some", "random", "keys"]))

app.use('/admin', adminData.router);
app.use(adminData.router);
app.use(shopRoutes.router);
app.use(discordRoutes);
app.use(invRoutes);
Expand All @@ -37,4 +37,11 @@ app.use(profileRoutes);

server.listen(process.env.PORT || 3000, () => {
console.log('Running on localhost 3000')
});
});



// Things to do : settings post, orders-> [...] [onClick] [status click mail]

// Backend Adjust, unique alert and profile alert

6 changes: 4 additions & 2 deletions controllers/userController.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const getProfile = async (req, res, next) => {
let cookies = req.cookies.get('key')
let result = await categorySchema.find({})
if (cookies == undefined) {
return res.status(200).render('shop', {prod: req.products, prof: '', url: process.env.discordURI, user: '', coins: '', bool: '', inv: '', cats: result, unique: ''})
return res.status(200).render('shop', {prod: req.products, prof: '', url: process.env.discordURI, user: '', coins: '', bool: '', inv: '', cats: result, unique: '', products: ''})
}
else {
next()
Expand Down Expand Up @@ -102,7 +102,7 @@ const getVerified = async (req, res, next) => {
return res.redirect('/logout')
}
else {
return res.render('shop', {prod: req.products, user: user.username, id : user.id, url: process.env.discordURI, coins: data.OctaCreds, prof: JSON.stringify(data), bool: '', ids: users, cats: result, unique: JSON.stringify(uniquePremItems)})
return res.render('shop', {prod: req.products, user: user, id : user.id, url: process.env.discordURI, coins: data.OctaCreds, prof: JSON.stringify(data), bool: '', ids: users, cats: result, unique: JSON.stringify(uniquePremItems), products: JSON.stringify(req.products)})
}
})
}catch (err) {
Expand All @@ -120,6 +120,7 @@ const getVerified = async (req, res, next) => {
const checkUnique = async (req, res, next) => {
try {
if ( req.body.red == true) {
console.log("went to red")
let user = await oauth.getUser(jwt.verify(req.cookies.get('key'), process.env.jwtSecret))
itemSchema.countDocuments({userId: user.id, premium: true, category: req.body.category, itemName: req.body.name}, async (err, count) => {
if (err) {
Expand Down Expand Up @@ -173,6 +174,7 @@ const sendMail = async (req, res, next) => {

const buyProduct = async (req, res, next) => {
try {
console.log('went to buy')
let user = await oauth.getUser(jwt.verify(req.cookies.get('key'), process.env.jwtSecret))
profileSchema.findOneAndUpdate({userId: user.id}, {OctaCreds : req.body.cost}, null, async (err, data) => {
if (err) {
Expand Down
3 changes: 1 addition & 2 deletions mailIds.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[
{"mailId": "[email protected]"},
{"mailId": "[email protected]"}
{"mailId": "[email protected]"}
]
Loading

0 comments on commit b41df8d

Please sign in to comment.