Final clean up

This commit is contained in:
Nikola Petrov 2024-07-16 15:20:26 +02:00
parent 905ab263de
commit 3ba36e7430
9 changed files with 18 additions and 17 deletions

View File

@ -28,9 +28,9 @@ export default {
const uri = "https://id.twitch.tv/oauth2/token?client_id=" + userFound.twitch_client_id + "&client_secret=" + userFound.twitch_client_secret + "&grant_type=client_credentials";
var response = await fetch(uri, { method: 'POST' });
var mData = await response.json();
const mData = await response.json();
var mheaders = {
const mheaders = {
'Accept': 'application/json',
'Client-ID': userFound.twitch_client_id,
'Authorization': 'Bearer ' + mData.access_token
@ -51,9 +51,9 @@ export default {
return res.status(404).json({ message: 'wrong code' });
}
var date = new Date(gameData[0].first_release_date * 1000);
const date = new Date(gameData[0].first_release_date * 1000);
const options: Intl.DateTimeFormatOptions = { day: 'numeric', month: 'short', year: 'numeric' }
var dateStr = date.toLocaleDateString(undefined, options);
const dateStr = date.toLocaleDateString(undefined, options);
response = await fetch(
@ -83,7 +83,7 @@ export default {
},
remove: async function (req: Request, res: Response) {
var id = req.body.code;
const id = req.body.code;
try {
const movie = await GameModel.findOneAndDelete({ code: id });

View File

@ -65,7 +65,7 @@ export default {
* mediaController.delete()
*/
remove: async function (req: Request, res: Response) {
var id = req.body.code;
const id = req.body.code;
try {

View File

@ -1,4 +1,4 @@
import { type Express, type NextFunction, type Request, type Response } from "express";
import { type NextFunction, type Request, type Response } from "express";
import UserModel from '../models/userModel';

View File

@ -1,12 +1,11 @@
import express, { type Request, type Response } from "express";
const router = express.Router();
import checkAuthenticated from '../../miscellaneous/checkAuthenticated';
import mediaRouter from './mediaRouter';
import gameRouter from './gameRouter';
import cashTransactionRouter from './cashTransactionRouter';
const router = express.Router();
router.use('/games', gameRouter);
router.use('/movies', mediaRouter);
router.use('/series', mediaRouter);

View File

@ -1,7 +1,8 @@
import express from "express";
const router = express.Router();
import cashTransaction from '../../controllers/cashTransactionController';
const router = express.Router();
router.post('/list', cashTransaction.list);
router.post('/', cashTransaction.create);

View File

@ -1,8 +1,9 @@
import express from "express";
var router = express.Router();
import gameController from '../../controllers/gameController';
import checkAuthenticated from '../../miscellaneous/checkAuthenticated';
const router = express.Router();
router.get('/', gameController.list);
router.post('/', checkAuthenticated, gameController.create);

View File

@ -2,7 +2,7 @@ import express from "express";
import mediaController from '../../controllers/mediaController.js';
import checkAuthenticated from '../../miscellaneous/checkAuthenticated';
var router = express.Router();
const router = express.Router();
router.get('/', mediaController.list);

View File

@ -1,8 +1,8 @@
import express, { type Request, type Response } from "express";
const router = express.Router();
import userData from './userKnowledge.json';
const router = express.Router();
/* GET home page. */
router.get('/', function (req: Request, res: Response) {
const project = userData.project;

View File

@ -1,9 +1,9 @@
import express, { type Request, type Response } from "express";
var router = express.Router();
import userController from '../controllers/userController';
import checkAuthenticated from '../miscellaneous/checkAuthenticated';
const router = express.Router();
/* GET home page. */
router.get('/', function (req: Request, res: Response) {
res.render('user', { title: 'Register' });