Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
97725e8
added migration and seeds file
Lili00ani Mar 20, 2024
a67bbab
fixed bug of wrong casing in event model
Lili00ani Mar 21, 2024
44ba52e
changed as in many to many relationship
Lili00ani Mar 21, 2024
d3dcd83
updated migration, model and seeders file
Lili00ani Mar 21, 2024
ed5a0d9
cleared
Lili00ani Mar 21, 2024
3b4fc6a
Merge pull request #1 from Lili00ani/l1
kendigm Mar 22, 2024
36f6d5d
added events controller
Lili00ani Mar 22, 2024
99a3971
check and updated migration, model and seeders for event
Lili00ani Mar 22, 2024
cc01281
removed env
Lili00ani Mar 22, 2024
77cc524
changed duration attribute and updated event controller
Lili00ani Mar 22, 2024
d95c439
Merge pull request #2 from Lili00ani/l3
kendigm Mar 23, 2024
218a86d
updated naming for events controller
Lili00ani Mar 24, 2024
1fca08d
User Authentication
kendigm Mar 24, 2024
169ecc5
added bookings and payment get request
Lili00ani Mar 24, 2024
2dd3e65
User Authentication
kendigm Mar 25, 2024
629e9a9
added stripe checkout
Lili00ani Mar 25, 2024
97c2182
User Authentication and Authorization implementation utilizing Postgr…
kendigm Mar 26, 2024
a638069
User Roles Http Only Cookies Postgres Sequelize
kendigm Mar 26, 2024
6cc4ad2
fixed stripe get session status
Lili00ani Mar 26, 2024
9bbde91
Merge pull request #3 from Lili00ani/k1
Lili00ani Mar 26, 2024
5e71a4a
combined stripe with booking controller
Lili00ani Mar 26, 2024
33bce2b
updated booking controller
Lili00ani Mar 26, 2024
b40a61b
merged with auth
Lili00ani Mar 27, 2024
b57595e
Merge pull request #4 from Lili00ani/l3
kendigm Mar 27, 2024
0e8606a
commented auth and moved userModal
Lili00ani Mar 29, 2024
fa0ffd0
added get controller for events search
Lili00ani Mar 29, 2024
085e9ba
added auth0
Lili00ani Mar 29, 2024
799ceb2
added filter by category
Lili00ani Mar 29, 2024
de3182c
Authentication Api integration Done.
kendigm Mar 31, 2024
3c53bae
Merge pull request #5 from Lili00ani/k1
Lili00ani Apr 2, 2024
0626bff
updated bookings controller
Lili00ani Apr 2, 2024
54b125c
merged
Lili00ani Apr 2, 2024
7b612aa
updated booking controller
Lili00ani Apr 2, 2024
71f7b15
updated user model, migration and seeders
Lili00ani Apr 2, 2024
5e252dd
Merge pull request #6 from Lili00ani/l4
kendigm Apr 4, 2024
d844bff
updated search event controller
Lili00ani Apr 5, 2024
33066d4
deleted unused controller
Lili00ani Apr 5, 2024
1238540
Arbetsmiljo-Portalen v3
kendigm Apr 6, 2024
a10749b
updated booking controller to include event venue
Lili00ani Apr 6, 2024
754647d
Merge pull request #7 from Lili00ani/l4
kendigm Apr 7, 2024
b605571
Auth0
kendigm Apr 7, 2024
6abc533
Auth0
kendigm Apr 7, 2024
c3dd4d3
Auth0 error handling
kendigm Apr 7, 2024
3018d51
Auth0 api
kendigm Apr 7, 2024
802b1af
Auth0 routes
kendigm Apr 7, 2024
323b8f3
Merge pull request #9 from Lili00ani/k1
Lili00ani Apr 8, 2024
30e148d
cleaned up
Lili00ani Apr 12, 2024
8cbc734
updated booking controller with user auth0
Lili00ani Apr 12, 2024
2db444f
fixed booking free events controller
Lili00ani Apr 13, 2024
643597b
fixed bug return page
Lili00ani Apr 13, 2024
bc966b4
Merge pull request #10 from Lili00ani/l4
kendigm Apr 13, 2024
ddd2589
Email integration template design
kendigm Apr 14, 2024
f976eaa
Booking Email integration template design
kendigm Apr 14, 2024
0f38f73
Booking Email integration template design
kendigm Apr 14, 2024
e5ae8ef
added admins
Lili00ani Apr 14, 2024
0e6c40b
added event images
Lili00ani Apr 14, 2024
b7b8bd0
added booking controller
Lili00ani Apr 14, 2024
9d39e27
Merge pull request #12 from Lili00ani/l5
kendigm Apr 15, 2024
3ad6f5f
Mailing
kendigm Apr 15, 2024
3862847
Merge branch 'main2' of https://github.com/Lili00ani/project3-backend…
kendigm Apr 15, 2024
b91d5a7
Merge pull request #13 from Lili00ani/k1
Lili00ani Apr 15, 2024
918b12b
updated controller
Lili00ani Apr 15, 2024
54abd50
Merge branch 'main2' into l5
Lili00ani Apr 15, 2024
2f8454a
added order in the booking controller
Lili00ani Apr 15, 2024
63e5ed1
Merge pull request #14 from Lili00ani/l5
kendigm Apr 16, 2024
370346f
cleaned up files
Lili00ani Apr 16, 2024
ab88916
removed auth0 url
Lili00ani Apr 16, 2024
ac6072f
Merge pull request #15 from Lili00ani/l5
Lili00ani Apr 19, 2024
ea9e208
fixed database
Lili00ani Apr 20, 2024
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
26 changes: 25 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
node_modules/
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no readme file

# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

.env
8 changes: 8 additions & 0 deletions .sequelizerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const path = require("path");

module.exports = {
config: path.resolve("config", "database.js"),
"models-path": path.resolve("db", "models"),
"seeders-path": path.resolve("db", "seeders"),
"migrations-path": path.resolve("db", "migrations"),
};
11 changes: 11 additions & 0 deletions config/database.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require("dotenv").config();

module.exports = {
development: {
username: process.env.DB_USERNAME,
password: process.env.DB_PASSWORD,
database: process.env.DB_NAME,
host: process.env.DB_HOST,
dialect: process.env.DB_DIALECT,
},
};
59 changes: 59 additions & 0 deletions controllers/adminsController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
const BaseController = require("./baseController");

class AdminsController extends BaseController {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since you are not using the Jwt middleware, please note that you can just create admins easily

constructor(model) {
super(model);
}

// Create user database
async insertUser(req, res) {
const { email, name } = req.body;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably check that these values exist first, and also that they are of the proper type, before we create sth in the database with these

try {
const output = await this.model.findOrCreate({
where: { email: email },
defaults: { name: name },
});
return res.json(output);
} catch (err) {
console.log(err.message);
return res.status(400).json({ error: true, msg: err.message });
}
}

async getUser(req, res) {
const { email } = req.body;
try {
const output = await this.model.findOne({
where: { email: email },
});
return res.json(output);
} catch (err) {
console.log(err.message);
return res.status(400).json({ error: true, msg: err.message });
}
}

async updateUserName(req, res) {
const { adminID } = req.params;
const { newName } = req.body;
try {
const admin = await this.model.findOne({
where: { id: adminID },
});

if (!admin) {
return res.status(404).json({ error: true, msg: "Admin not found" });
}

admin.name = newName;
await admin.save();

return res.json({ success: true, msg: "Name updated successfully" });
} catch (err) {
console.log(err.message);
return res.status(400).json({ error: true, msg: err.message });
}
}
}

module.exports = AdminsController;
18 changes: 18 additions & 0 deletions controllers/baseController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
class BaseController {
constructor(model) {
this.model = model;
}

async getAll(req, res) {
console.log(this.model);
try {
const output = await this.model.findAll();
return res.json(output);
} catch (err) {
console.log(err);
return res.status(400).json({ error: true, msg: err });
}
}
}

module.exports = BaseController;
Loading