Exercisegroup 0 and 1 complete implemented

This commit is contained in:
2024-11-18 15:41:33 +01:00
parent 9fbd9a1375
commit e2c45c6be0
18 changed files with 138 additions and 80 deletions

View File

@@ -30,26 +30,14 @@ account.get("/login", async (req: Request, res: Response) => {
"' AND password='" + req.query.password + "')"
)
// Mechanism to check exercise solved
if (results.length > 1) {
Exercise.update(
{ solved: true },
{
where: {
nameEn: "Register"
}
}
)
}
if (results.length != 0) {
// Creating session token
const token = jwt.sign({ userId: results[0]["id"] }, 'sjcucjdkdf')
// Status: 200 OK
res.status(200).json({
"success": true,
"token": token
success: true,
token: token
})
} else {
// Status: 401 Unauthorized
@@ -124,7 +112,7 @@ account.patch("/", verifyToken, (req: Request, res: Response) => {
{
where: { id: req.body.id }
})
.then(async account => {
.then(async result => {
for (let payment of req.body.payments) {
if (payment.id == undefined) {
payment["accountId"] = req.body.id