Compare commits
2 Commits
a9ad5e8f87
...
123684da13
Author | SHA1 | Date | |
---|---|---|---|
123684da13 | |||
137428ffa7 |
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -8,3 +8,5 @@ dist/
|
|||
logs/
|
||||
node_modules/
|
||||
public/
|
||||
coverage/
|
||||
testResults/
|
||||
|
|
5
jest.config.js
Normal file
5
jest.config.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
|
||||
module.exports = {
|
||||
preset: 'ts-jest',
|
||||
testEnvironment: 'node',
|
||||
};
|
8951
package-lock.json
generated
8951
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
|
@ -7,7 +7,7 @@
|
|||
"start": "tsc && node ./dist/app.js",
|
||||
"build": "tsc",
|
||||
"debug": "export DEBUG=* && npm run start",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"test": "jest --coverage --testResultsProcessor ./node_modules/jest-sonar-reporter/index.js"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
|
@ -32,12 +32,22 @@
|
|||
"@types/bcrypt": "^3.0.1",
|
||||
"@types/debug": "^4.1.5",
|
||||
"@types/express": "^4.17.11",
|
||||
"@types/jest": "^28.1.3",
|
||||
"@types/random-words": "^1.1.2",
|
||||
"@types/swagger-jsdoc": "^6.0.1",
|
||||
"@types/swagger-ui-express": "^4.1.3",
|
||||
"@types/winston": "^2.4.4",
|
||||
"jest": "^28.1.1",
|
||||
"jest-sonar-reporter": "^2.0.0",
|
||||
"source-map-support": "^0.5.19",
|
||||
"ts-jest": "^28.0.5",
|
||||
"tslint": "^6.1.3",
|
||||
"typescript": "^4.1.5"
|
||||
},
|
||||
"jestSonar": {
|
||||
"sonar56x": true,
|
||||
"reportPath": "testResults",
|
||||
"reportFile": "sonar-report.xml",
|
||||
"indent": 4
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1,6 @@
|
|||
sonar.projectKey=pd-api
|
||||
sonar.sources=src
|
||||
sonar.tests=test
|
||||
sonar.language=ts
|
||||
sonar.javascript.lcov.reportPaths=coverage/lcov.info
|
||||
sonar.testExecutionReportPaths=testResults/sonar-report.xml
|
||||
|
|
|
@ -35,7 +35,7 @@ betterzonRouter.use('/crawlingstatus', crawlingstatusRouter);
|
|||
betterzonRouter.get('/', async (req: Request, res: Response) => {
|
||||
try {
|
||||
res.status(200).send('Pluto Development Betterzon API Endpoint');
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
let errorGuid = Guid.create().toString();
|
||||
logger.error('Error handling a request: ' + e.message, {reference: errorGuid});
|
||||
res.status(500).send({
|
||||
|
|
|
@ -25,7 +25,7 @@ categoriesRouter.get('/', async (req: Request, res: Response) => {
|
|||
const categories: Categories = await CategoryService.findAll();
|
||||
|
||||
res.status(200).send(categories);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ categoriesRouter.get('/:id', async (req: Request, res: Response) => {
|
|||
const category: Category = await CategoryService.find(id);
|
||||
|
||||
res.status(200).send(category);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ categoriesRouter.get('/search/:term', async (req: Request, res: Response) => {
|
|||
const categories: Categories = await CategoryService.findBySearchTerm(term);
|
||||
|
||||
res.status(200).send(categories);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import * as ContactPersonService from './contact_persons.service';
|
|||
import {Contact_Person} from './contact_person.interface';
|
||||
import {Contact_Persons} from './contact_persons.interface';
|
||||
import * as UserService from '../users/users.service';
|
||||
import * as PriceService from '../prices/prices.service';
|
||||
|
||||
|
||||
/**
|
||||
|
@ -27,7 +26,7 @@ contactpersonsRouter.get('/', async (req: Request, res: Response) => {
|
|||
const contacts: Contact_Persons = await ContactPersonService.findAll();
|
||||
|
||||
res.status(200).send(contacts);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
@ -46,7 +45,7 @@ contactpersonsRouter.get('/:id', async (req: Request, res: Response) => {
|
|||
const contact: Contact_Person = await ContactPersonService.find(id);
|
||||
|
||||
res.status(200).send(contact);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
@ -65,7 +64,7 @@ contactpersonsRouter.get('/byvendor/:id', async (req: Request, res: Response) =>
|
|||
const contacts: Contact_Persons = await ContactPersonService.findByVendor(id);
|
||||
|
||||
res.status(200).send(contacts);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
@ -95,7 +94,7 @@ contactpersonsRouter.post('/', async (req: Request, res: Response) => {
|
|||
} else {
|
||||
res.status(500).send({});
|
||||
}
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
@ -126,7 +125,7 @@ contactpersonsRouter.put('/:id', async (req: Request, res: Response) => {
|
|||
} else {
|
||||
res.status(500).send({});
|
||||
}
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
import express, {Request, Response} from 'express';
|
||||
import * as CrawlingStatusService from './crawling_status.service';
|
||||
import {Crawling_Status} from './crawling_status.interface';
|
||||
import {Crawling_Statuses} from './crawling_statuses.interface';
|
||||
import * as UserService from '../users/users.service';
|
||||
|
||||
|
||||
|
@ -37,7 +36,7 @@ crawlingstatusRouter.get('/', async (req: Request, res: Response) => {
|
|||
const status: Crawling_Status = await CrawlingStatusService.getCurrent();
|
||||
|
||||
res.status(200).send(status);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
import express, {Request, Response} from 'express';
|
||||
import * as FavoriteShopsService from './favoriteshops.service';
|
||||
import {FavoriteShop} from './favoriteshop.interface';
|
||||
import {FavoriteShops} from './favoriteshops.interface';
|
||||
import * as UserService from '../users/users.service';
|
||||
|
||||
|
||||
|
@ -31,7 +29,7 @@ favoriteshopsRouter.get('/', async (req: Request, res: Response) => {
|
|||
const priceAlarms = await FavoriteShopsService.getFavoriteShops(user.user_id);
|
||||
|
||||
res.status(200).send(priceAlarms);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
@ -65,7 +63,7 @@ favoriteshopsRouter.post('/', async (req: Request, res: Response) => {
|
|||
res.status(500).send(JSON.stringify({success: false}));
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
@ -99,7 +97,7 @@ favoriteshopsRouter.delete('/:id', async (req: Request, res: Response) => {
|
|||
res.status(500).send(JSON.stringify({success: false}));
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ manufacturersRouter.get('/', async (req: Request, res: Response) => {
|
|||
const manufacturers: Manufacturers = await ManufacturerService.findAll();
|
||||
|
||||
res.status(200).send(manufacturers);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ manufacturersRouter.get('/:id', async (req: Request, res: Response) => {
|
|||
const manufacturer: Manufacturer = await ManufacturerService.find(id);
|
||||
|
||||
res.status(200).send(manufacturer);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ manufacturersRouter.get('/search/:term', async (req: Request, res: Response) =>
|
|||
const manufacturer: Manufacturers = await ManufacturerService.findBySearchTerm(term);
|
||||
|
||||
res.status(200).send(manufacturer);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
import express, {Request, Response} from 'express';
|
||||
import * as PriceAlarmsService from './pricealarms.service';
|
||||
import {PriceAlarm} from './pricealarm.interface';
|
||||
import {PriceAlarms} from './pricealarms.interface';
|
||||
import * as UserService from '../users/users.service';
|
||||
|
||||
|
||||
|
@ -31,7 +29,7 @@ pricealarmsRouter.get('/', async (req: Request, res: Response) => {
|
|||
const priceAlarms = await PriceAlarmsService.getPriceAlarms(user.user_id);
|
||||
|
||||
res.status(200).send(priceAlarms);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
@ -66,7 +64,7 @@ pricealarmsRouter.post('/', async (req: Request, res: Response) => {
|
|||
res.status(500).send(JSON.stringify({success: false}));
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
@ -101,7 +99,7 @@ pricealarmsRouter.put('/', async (req: Request, res: Response) => {
|
|||
res.status(500).send(JSON.stringify({success: false}));
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
@ -127,7 +125,7 @@ pricealarmsRouter.delete('/:id', async (req, res) => {
|
|||
res.status(500).send(JSON.stringify({success: false}));
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ pricesRouter.get('/', async (req: Request, res: Response) => {
|
|||
}
|
||||
|
||||
res.status(200).send(prices);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ pricesRouter.get('/:id', async (req: Request, res: Response) => {
|
|||
const price: Price = await PriceService.find(id);
|
||||
|
||||
res.status(200).send(price);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ pricesRouter.get('/bestDeals/:amount', async (req: Request, res: Response) => {
|
|||
const prices: Prices = await PriceService.getBestDeals(amount);
|
||||
|
||||
res.status(200).send(prices);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ pricesRouter.get('/byProduct/list/:ids', async (req: Request, res: Response) =>
|
|||
const prices: Prices = await PriceService.findListByProducts(productIds);
|
||||
|
||||
res.status(200).send(prices);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ pricesRouter.post('/', async (req: Request, res: Response) => {
|
|||
} else {
|
||||
res.status(500).send({});
|
||||
}
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ productsRouter.get('/', async (req: Request, res: Response) => {
|
|||
const products: Products = await ProductService.findAll();
|
||||
|
||||
res.status(200).send(products);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ productsRouter.get('/:id', async (req: Request, res: Response) => {
|
|||
const product: Product = await ProductService.find(id);
|
||||
|
||||
res.status(200).send(product);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ productsRouter.get('/search/:term', async (req: Request, res: Response) => {
|
|||
const products: Products = await ProductService.findBySearchTerm(term);
|
||||
|
||||
res.status(200).send(products);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ productsRouter.get('/list/:ids', async (req: Request, res: Response) => {
|
|||
const products: Products = await ProductService.findList(ids);
|
||||
|
||||
res.status(200).send(products);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ productsRouter.get('/vendor/:id', async (req: Request, res: Response) => {
|
|||
const products: Products = await ProductService.findByVendor(id);
|
||||
|
||||
res.status(200).send(products);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ productsRouter.post('/', async (req: Request, res: Response) => {
|
|||
} else {
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
import express, {Request, Response} from 'express';
|
||||
import * as UserService from './users.service';
|
||||
import {User} from './user.interface';
|
||||
import {Users} from './users.interface';
|
||||
import {Session} from './session.interface';
|
||||
|
||||
|
||||
|
@ -51,7 +50,7 @@ usersRouter.post('/register', async (req: Request, res: Response) => {
|
|||
session_id: session.session_id,
|
||||
session_key: session.session_key
|
||||
});
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
@ -84,7 +83,7 @@ usersRouter.post('/login', async (req: Request, res: Response) => {
|
|||
session_id: session.session_id,
|
||||
session_key: session.session_key
|
||||
});
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
@ -114,7 +113,7 @@ usersRouter.post('/checkSessionValid', async (req: Request, res: Response) => {
|
|||
|
||||
// Send the session details back to the user
|
||||
res.status(200).send(user);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
|
14
src/models/betterzon/vendors/vendors.router.ts
vendored
14
src/models/betterzon/vendors/vendors.router.ts
vendored
|
@ -26,7 +26,7 @@ vendorsRouter.get('/', async (req: Request, res: Response) => {
|
|||
const vendors: Vendors = await VendorService.findAll();
|
||||
|
||||
res.status(200).send(vendors);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ vendorsRouter.get('/managed', async (req: Request, res: Response) => {
|
|||
const vendors = await VendorService.getManagedShops(user.user_id);
|
||||
|
||||
res.status(200).send(vendors);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ vendorsRouter.get('/:id', async (req: Request, res: Response) => {
|
|||
const vendor: Vendor = await VendorService.find(id);
|
||||
|
||||
res.status(200).send(vendor);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ vendorsRouter.get('/search/:term', async (req: Request, res: Response) => {
|
|||
const vendors: Vendors = await VendorService.findBySearchTerm(term);
|
||||
|
||||
res.status(200).send(vendors);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ vendorsRouter.put('/manage/deactivatelisting', async (req: Request, res: Respons
|
|||
} else {
|
||||
res.status(500).send({});
|
||||
}
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ vendorsRouter.put('/manage/shop/deactivate/:id', async (req: Request, res: Respo
|
|||
} else {
|
||||
res.status(500).send({});
|
||||
}
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ vendorsRouter.put('/manage/shop/activate/:id', async (req: Request, res: Respons
|
|||
} else {
|
||||
res.status(500).send({});
|
||||
}
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.log('Error handling a request: ' + e.message);
|
||||
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ crrRouter.use('/ratings', routeRatingsRouter);
|
|||
crrRouter.get('/', async (req: Request, res: Response) => {
|
||||
try {
|
||||
res.status(200).send('Pluto Development Climbing Route Rating API Endpoint');
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
let errorGuid = Guid.create().toString();
|
||||
logger.error('Error handling a request: ' + e.message, {reference: errorGuid});
|
||||
res.status(500).send({
|
||||
|
|
|
@ -55,7 +55,7 @@ climbingGymRouter.get('/', async (req: Request, res: Response) => {
|
|||
const gyms: ClimbingGym[] = await GymService.findAll();
|
||||
|
||||
res.status(200).send(gyms);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
let errorGuid = Guid.create().toString();
|
||||
logger.error('Error handling a request: ' + e.message, {reference: errorGuid});
|
||||
res.status(500).send({
|
||||
|
@ -140,7 +140,7 @@ climbingGymRouter.post('/', async (req: Request, res: Response) => {
|
|||
} else {
|
||||
res.status(500).send({});
|
||||
}
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
let errorGuid = Guid.create().toString();
|
||||
logger.error('Error handling a request: ' + e.message, {reference: errorGuid});
|
||||
res.status(500).send({
|
||||
|
|
|
@ -59,7 +59,7 @@ climbingRoutesRouter.get('/', async (req: Request, res: Response) => {
|
|||
const routes: ClimbingRoute[] = await RouteService.findAll();
|
||||
|
||||
res.status(200).send(routes);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
let errorGuid = Guid.create().toString();
|
||||
logger.error('Error handling a request: ' + e.message, {reference: errorGuid});
|
||||
res.status(500).send({
|
||||
|
@ -126,7 +126,7 @@ climbingRoutesRouter.get('/:id', async (req: Request, res: Response) => {
|
|||
const route: ClimbingRoute = await RouteService.findById(route_id);
|
||||
|
||||
res.status(200).send(route);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
let errorGuid = Guid.create().toString();
|
||||
logger.error('Error handling a request: ' + e.message, {reference: errorGuid});
|
||||
res.status(500).send({
|
||||
|
@ -214,7 +214,7 @@ climbingRoutesRouter.post('/', async (req: Request, res: Response) => {
|
|||
let route_id = await RouteService.createRoute(gym_id, name, difficulty);
|
||||
|
||||
res.status(201).send({'route_id': route_id});
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
let errorGuid = Guid.create().toString();
|
||||
logger.error('Error handling a request: ' + e.message, {reference: errorGuid});
|
||||
res.status(500).send({
|
||||
|
|
|
@ -59,7 +59,7 @@ routeCommentsRouter.get('/by/route/:id', async (req: Request, res: Response) =>
|
|||
const comments: RouteComment[] = await CommentService.findByRoute(route_id);
|
||||
|
||||
res.status(200).send(comments);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
let errorGuid = Guid.create().toString();
|
||||
logger.error('Error handling a request: ' + e.message, {reference: errorGuid});
|
||||
res.status(500).send({
|
||||
|
@ -143,7 +143,7 @@ routeCommentsRouter.post('/', async (req: Request, res: Response) => {
|
|||
} else {
|
||||
res.status(500).send({});
|
||||
}
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
let errorGuid = Guid.create().toString();
|
||||
logger.error('Error handling a request: ' + e.message, {reference: errorGuid});
|
||||
res.status(500).send({
|
||||
|
|
|
@ -44,7 +44,7 @@ routeRatingsRouter.get('/by/route/:id', async (req: Request, res: Response) => {
|
|||
let rating = await RatingService.getStarsForRoute(route_id);
|
||||
|
||||
res.status(200).send({'rating': rating});
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
let errorGuid = Guid.create().toString();
|
||||
logger.error('Error handling a request: ' + e.message, {reference: errorGuid});
|
||||
res.status(500).send({
|
||||
|
@ -128,7 +128,7 @@ routeRatingsRouter.post('/', async (req: Request, res: Response) => {
|
|||
} else {
|
||||
res.status(500).send({});
|
||||
}
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
let errorGuid = Guid.create().toString();
|
||||
logger.error('Error handling a request: ' + e.message, {reference: errorGuid});
|
||||
res.status(500).send({
|
||||
|
|
|
@ -18,7 +18,7 @@ dhbwRaPlaChangesRouter.get('/', async (req: Request, res: Response) => {
|
|||
let changes = await ChangeService.getChanges('TINF19B4', week);
|
||||
|
||||
res.status(200).send(changes);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
let errorGuid = Guid.create().toString();
|
||||
logger.error('Error handling a request: ' + e.message, {reference: errorGuid});
|
||||
res.status(500).send({
|
||||
|
@ -36,7 +36,7 @@ dhbwRaPlaChangesRouter.get('/:id', async (req: Request, res: Response) => {
|
|||
let changes = await ChangeService.getEventById('TINF19B4', id);
|
||||
|
||||
res.status(200).send(changes);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
let errorGuid = Guid.create().toString();
|
||||
logger.error('Error handling a request: ' + e.message, {reference: errorGuid});
|
||||
res.status(500).send({
|
||||
|
|
|
@ -17,7 +17,7 @@ dhbwServiceRouter.use('/generalInfo', generalInfoRouter);
|
|||
dhbwServiceRouter.get('/', async (req: Request, res: Response) => {
|
||||
try {
|
||||
res.status(200).send('Pluto Development DHBW Service App API Endpoint');
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
let errorGuid = Guid.create().toString();
|
||||
logger.error('Error handling a request: ' + e.message, {reference: errorGuid});
|
||||
res.status(500).send({
|
||||
|
|
|
@ -13,7 +13,7 @@ export const generalInfoRouter = express.Router();
|
|||
generalInfoRouter.get('/', async (req: Request, res: Response) => {
|
||||
try {
|
||||
res.status(200).send('GET generalInfo v2.1');
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
let errorGuid = Guid.create().toString();
|
||||
logger.error('Error handling a request: ' + e.message, {reference: errorGuid});
|
||||
res.status(500).send({
|
||||
|
@ -27,7 +27,7 @@ generalInfoRouter.get('/', async (req: Request, res: Response) => {
|
|||
generalInfoRouter.post('/', async (req: Request, res: Response) => {
|
||||
try {
|
||||
res.status(200).send('POST generalInfo v2.1');
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
let errorGuid = Guid.create().toString();
|
||||
logger.error('Error handling a request: ' + e.message, {reference: errorGuid});
|
||||
res.status(500).send({
|
||||
|
|
|
@ -29,7 +29,7 @@ partyPlanerRouter.use('/user', userRouter);
|
|||
partyPlanerRouter.get('/', async (req: Request, res: Response) => {
|
||||
try {
|
||||
res.status(200).send('Pluto Development PartyPlaner API Endpoint V2');
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
let errorGuid = Guid.create().toString();
|
||||
logger.error('Error handling a request: ' + e.message, {reference: errorGuid});
|
||||
res.status(500).send({
|
||||
|
|
|
@ -39,7 +39,7 @@ eventRouter.get('/:isDevCall', async (req: Request, res: Response) => {
|
|||
let data = await EventService.getEventData(useDev, userId);
|
||||
|
||||
res.status(200).send(data);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
let errorGuid = Guid.create().toString();
|
||||
logger.error('Error handling a request: ' + e.message, {reference: errorGuid});
|
||||
res.status(500).send({
|
||||
|
|
|
@ -38,7 +38,7 @@ friendshipRouter.get('/:isDevCall', async (req: Request, res: Response) => {
|
|||
let data = await FriendshipService.getFriendshipData(useDev, userId);
|
||||
|
||||
res.status(200).send(data);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
let errorGuid = Guid.create().toString();
|
||||
logger.error('Error handling a request: ' + e.message, {reference: errorGuid});
|
||||
res.status(500).send({
|
||||
|
|
|
@ -38,7 +38,7 @@ inviteRouter.get('/:isDevCall', async (req: Request, res: Response) => {
|
|||
let data = await InviteService.getInvitesData(useDev, userId);
|
||||
|
||||
res.status(200).send(data);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
let errorGuid = Guid.create().toString();
|
||||
logger.error('Error handling a request: ' + e.message, {reference: errorGuid});
|
||||
res.status(500).send({
|
||||
|
|
|
@ -58,7 +58,7 @@ loginRouter.post('/:isDevCall', async (req: Request, res: Response) => {
|
|||
let session = await UserService.loginUser(useDev, username, email, password, userIP, deviceInfo);
|
||||
|
||||
res.status(200).send(session);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
let errorGuid = Guid.create().toString();
|
||||
logger.error('Error handling a request: ' + e.message, {reference: errorGuid});
|
||||
res.status(500).send({
|
||||
|
|
|
@ -77,7 +77,7 @@ registerRouter.post('/:isDevCall', async (req: Request, res: Response) => {
|
|||
let session = await UserService.registerUser(useDev, username, email, firstName, lastName, password, userIP, deviceInfo);
|
||||
|
||||
res.status(201).send(session);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
let errorGuid = Guid.create().toString();
|
||||
logger.error('Error handling a request: ' + e.message, {reference: errorGuid});
|
||||
res.status(500).send({
|
||||
|
|
|
@ -38,7 +38,7 @@ sessionRouter.get('/:isDevCall', async (req: Request, res: Response) => {
|
|||
let data = await SessionService.getSessionData(useDev, userId);
|
||||
|
||||
res.status(200).send(data);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
let errorGuid = Guid.create().toString();
|
||||
logger.error('Error handling a request: ' + e.message, {reference: errorGuid});
|
||||
res.status(500).send({
|
||||
|
|
|
@ -37,7 +37,7 @@ userRouter.get('/:isDevCall', async (req: Request, res: Response) => {
|
|||
let data = await UserService.getUserData(useDev, userId);
|
||||
|
||||
res.status(200).send(data);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
let errorGuid = Guid.create().toString();
|
||||
logger.error('Error handling a request: ' + e.message, {reference: errorGuid});
|
||||
res.status(500).send({
|
||||
|
|
|
@ -86,7 +86,7 @@ raPlaMiddlewareRouter.get('/', async (req: Request, res: Response) => {
|
|||
|
||||
res.set({'Content-Disposition': 'attachment; filename=' + file + '.ics'});
|
||||
res.status(200).send(resultingFile);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
let errorGuid = Guid.create().toString();
|
||||
logger.error('Error handling a request: ' + e.message, {reference: errorGuid});
|
||||
res.status(500).send({
|
||||
|
|
|
@ -16,7 +16,7 @@ highlightMarkerRouter.use('/addHighlight', addHighlightRouter);
|
|||
highlightMarkerRouter.get('/', async (req: Request, res: Response) => {
|
||||
try {
|
||||
res.status(200).send('Pluto Development Twitch Highlight Marker API Endpoint');
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
let errorGuid = Guid.create().toString();
|
||||
logger.error('Error handling a request: ' + e.message, {reference: errorGuid});
|
||||
res.status(500).send({
|
||||
|
|
|
@ -14,7 +14,7 @@ export const addHighlightRouter = express.Router();
|
|||
addHighlightRouter.get('/', (req: Request, res: Response) => {
|
||||
try {
|
||||
res.status(200).send('GET endpoint not defined.');
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
let errorGuid = Guid.create().toString();
|
||||
logger.error('Error handling a request: ' + e.message, {reference: errorGuid});
|
||||
res.status(500).send({
|
||||
|
@ -45,7 +45,7 @@ addHighlightRouter.post('/', (req: Request, res: Response) => {
|
|||
res.type('application/json');
|
||||
res.status(200).send({'status': 'success', 'description': ''});
|
||||
}
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
let errorGuid = Guid.create().toString();
|
||||
logger.error('Error handling a request: ' + e.message, {reference: errorGuid});
|
||||
res.status(500).send({
|
||||
|
|
3
test/template.test.ts
Normal file
3
test/template.test.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
test('Test template', async () => {
|
||||
expect(true).toBe(true);
|
||||
});
|
Loading…
Reference in New Issue
Block a user