Merge branch 'develop' into BETTERZON-144

This commit is contained in:
Patrick 2021-06-15 10:20:17 +02:00 committed by GitHub
commit 4a0ba40da6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 16 deletions

View File

@ -89,9 +89,9 @@ contactpersonsRouter.post('/', async (req: Request, res: Response) => {
const success = await ContactPersonService.createContactEntry(user.user_id, vendor_id, first_name, last_name, gender, email, phone); const success = await ContactPersonService.createContactEntry(user.user_id, vendor_id, first_name, last_name, gender, email, phone);
if (success) { if (success) {
res.sendStatus(201); res.status(201).send({});
} else { } else {
res.sendStatus(500); res.status(500).send({});
} }
} catch (e) { } catch (e) {
console.log('Error handling a request: ' + e.message); console.log('Error handling a request: ' + e.message);
@ -118,9 +118,9 @@ contactpersonsRouter.put('/:id', async (req: Request, res: Response) => {
const success = await ContactPersonService.updateContactEntry(user.user_id, contact_person_id, vendor_id, first_name, last_name, gender, email, phone); const success = await ContactPersonService.updateContactEntry(user.user_id, contact_person_id, vendor_id, first_name, last_name, gender, email, phone);
if (success) { if (success) {
res.sendStatus(200); res.status(200).send({});
} else { } else {
res.sendStatus(500); res.status(500).send({});
} }
} catch (e) { } catch (e) {
console.log('Error handling a request: ' + e.message); console.log('Error handling a request: ' + e.message);

View File

@ -28,7 +28,7 @@ crawlingstatusRouter.get('/', async (req: Request, res: Response) => {
const user = await UserService.checkSessionWithCookie(req.cookies.betterauth, user_ip); const user = await UserService.checkSessionWithCookie(req.cookies.betterauth, user_ip);
if (!user.is_admin) { if (!user.is_admin) {
res.sendStatus(403); res.status(403).send({});
return; return;
} }

View File

@ -117,9 +117,9 @@ pricesRouter.post('/', async (req: Request, res: Response) => {
const success = await PriceService.createPriceEntry(user.user_id, vendor_id, product_id, price_in_cents); const success = await PriceService.createPriceEntry(user.user_id, vendor_id, product_id, price_in_cents);
if (success) { if (success) {
res.sendStatus(201); res.status(201).send({});
} else { } else {
res.sendStatus(500); res.status(500).send({});
} }
} catch (e) { } catch (e) {
console.log('Error handling a request: ' + e.message); console.log('Error handling a request: ' + e.message);

View File

@ -120,7 +120,7 @@ productsRouter.post('/', async (req: Request, res: Response) => {
const result: boolean = await ProductService.addNewProduct(asin); const result: boolean = await ProductService.addNewProduct(asin);
if (result) { if (result) {
res.sendStatus(201); res.status(201).send({});
} else { } else {
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'})); res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
} }

View File

@ -50,7 +50,7 @@ usersRouter.post('/register', async (req: Request, res: Response) => {
res.cookie('betterauth', JSON.stringify({ res.cookie('betterauth', JSON.stringify({
id: session.session_id, id: session.session_id,
key: session.session_key key: session.session_key
}), {expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 30)}).sendStatus(201); }), {expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 30)}).status(201).send({});
} catch (e) { } catch (e) {
console.log('Error handling a request: ' + e.message); console.log('Error handling a request: ' + e.message);
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'})); res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));
@ -83,7 +83,7 @@ usersRouter.post('/login', async (req: Request, res: Response) => {
res.cookie('betterauth', JSON.stringify({ res.cookie('betterauth', JSON.stringify({
id: session.session_id, id: session.session_id,
key: session.session_key key: session.session_key
}), {expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 30)}).sendStatus(200); }), {expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 30)}).status(200).send({});
} catch (e) { } catch (e) {
console.log('Error handling a request: ' + e.message); console.log('Error handling a request: ' + e.message);
res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'})); res.status(500).send(JSON.stringify({'message': 'Internal Server Error. Try again later.'}));

View File

@ -100,9 +100,9 @@ vendorsRouter.put('/manage/deactivatelisting', async (req: Request, res: Respons
const success = await VendorService.deactivateListing(user.user_id, vendor_id, product_id); const success = await VendorService.deactivateListing(user.user_id, vendor_id, product_id);
if (success) { if (success) {
res.sendStatus(200); res.status(200).send({});
} else { } else {
res.sendStatus(500); res.status(500).send({});
} }
} catch (e) { } catch (e) {
console.log('Error handling a request: ' + e.message); console.log('Error handling a request: ' + e.message);
@ -123,9 +123,9 @@ vendorsRouter.put('/manage/shop/deactivate/:id', async (req: Request, res: Respo
const success = await VendorService.setShopStatus(user.user_id, vendor_id, false); const success = await VendorService.setShopStatus(user.user_id, vendor_id, false);
if (success) { if (success) {
res.sendStatus(200); res.status(200).send({});
} else { } else {
res.sendStatus(500); res.status(500).send({});
} }
} catch (e) { } catch (e) {
console.log('Error handling a request: ' + e.message); console.log('Error handling a request: ' + e.message);
@ -146,9 +146,9 @@ vendorsRouter.put('/manage/shop/activate/:id', async (req: Request, res: Respons
const success = await VendorService.setShopStatus(user.user_id, vendor_id, true); const success = await VendorService.setShopStatus(user.user_id, vendor_id, true);
if (success) { if (success) {
res.sendStatus(200); res.status(200).send({});
} else { } else {
res.sendStatus(500); res.status(500).send({});
} }
} catch (e) { } catch (e) {
console.log('Error handling a request: ' + e.message); console.log('Error handling a request: ' + e.message);