renamed keys in json websocket send on synchronization
This commit is contained in:
parent
66bfba3b8e
commit
c4f0d65f4f
|
@ -4,6 +4,7 @@ services:
|
|||
|
||||
ports:
|
||||
- 8012:8080
|
||||
- 8282:8282
|
||||
depends_on:
|
||||
- database
|
||||
restart: on-failure
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"debug": true,
|
||||
"port": "8081",
|
||||
"wsport": "8082",
|
||||
"wsport": "8282",
|
||||
"dbuser": "bsfe",
|
||||
"dbhost": "localhost",
|
||||
"dbport": "5432",
|
||||
|
|
|
@ -32,7 +32,7 @@ class AbstractProductController {
|
|||
await AbstractProductService.create(groupId, localId, barcode, name, net_weight, image_filename, category, unit);
|
||||
|
||||
notify(req.headers.authorization.split(' ')[1], groupId, 'create', 'abstractproduct', {
|
||||
localId, barcode, name, net_weight, image_filename, category, unit
|
||||
local_id: localId, barcode, name, net_weight, image_filename, category, unit
|
||||
});
|
||||
|
||||
return res.status(200).send(translate(req.headers["accept-language"], responseCodes.responses.general.ok));
|
||||
|
@ -64,12 +64,7 @@ class AbstractProductController {
|
|||
|
||||
if (unit) await AbstractProductService.updateUnit(groupId, localId, unit);
|
||||
|
||||
let data = { localId }
|
||||
if (barcode) data.barcode = barcode
|
||||
if (name) data.name = name
|
||||
if (net_weight) data.net_weight = net_weight
|
||||
if (category) data.category = category
|
||||
if (unit) data.unit = unit
|
||||
let data = await AbstractProductService.getByLocalId(groupId, localId)
|
||||
|
||||
notify(req.headers.authorization.split(' ')[1], groupId, 'update', 'abstractproduct', data);
|
||||
|
||||
|
@ -100,7 +95,7 @@ class AbstractProductController {
|
|||
|
||||
await AbstractProductService.delete(groupId, localId)
|
||||
|
||||
notify(req.headers.authorization.split(' ')[1], groupId, 'delete', 'abstractproduct', { localId });
|
||||
notify(req.headers.authorization.split(' ')[1], groupId, 'delete', 'abstractproduct', { local_id: localId });
|
||||
|
||||
return res.status(200).send(translate(req.headers["accept-language"], responseCodes.responses.general.ok))
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ class CategoryController {
|
|||
await CategoryService.create(groupId, localId, categoryName);
|
||||
|
||||
notify(req.headers.authorization.split(' ')[1], groupId, 'create', 'category', {
|
||||
localId, categoryName
|
||||
local_id: localId, name: categoryName
|
||||
});
|
||||
|
||||
return res.status(200).send(translate(req.headers["accept-language"], responseCodes.responses.general.ok));
|
||||
|
@ -23,8 +23,7 @@ class CategoryController {
|
|||
|
||||
await CategoryService.update(groupId, localId, categoryName);
|
||||
|
||||
let data = { localId }
|
||||
if (categoryName) data.categoryName = categoryName
|
||||
let data = await CategoryService.getById(groupId, localId)
|
||||
|
||||
notify(req.headers.authorization.split(' ')[1], groupId, 'update', 'category', data);
|
||||
|
||||
|
@ -44,7 +43,7 @@ class CategoryController {
|
|||
|
||||
await CategoryService.delete(groupId, localId);
|
||||
|
||||
notify(req.headers.authorization.split(' ')[1], groupId, 'delete', 'category', { localId });
|
||||
notify(req.headers.authorization.split(' ')[1], groupId, 'delete', 'category', { local_id: localId });
|
||||
|
||||
return res.status(200).send(translate(req.headers["accept-language"], responseCodes.responses.general.ok))
|
||||
}
|
||||
|
|
|
@ -10,9 +10,9 @@ class AbstractProductController {
|
|||
|
||||
await ProductService.create(groupId, localId, abstract_product_id, amount, date_of_production, expiry_date);
|
||||
|
||||
notify(req.headers.authorization.split(' ')[1], groupId, 'create', 'product', {
|
||||
localId, abstract_product_id, amount, date_of_production, expiry_date
|
||||
});
|
||||
let data = await ProductService.getByLocalId(groupId, localId)
|
||||
|
||||
notify(req.headers.authorization.split(' ')[1], groupId, 'create', 'product', data);
|
||||
|
||||
return res.status(200).send(translate(req.headers["accept-language"], responseCodes.responses.general.ok));
|
||||
}
|
||||
|
@ -28,11 +28,7 @@ class AbstractProductController {
|
|||
|
||||
if (expiry_date) await ProductService.updateExpiryDate(groupId, localId, expiry_date);
|
||||
|
||||
let data = { localId };
|
||||
if (abstract_product_id) data.abstract_product_id = abstract_product_id
|
||||
if (amount) data.amount = amount
|
||||
if (date_of_production) data.date_of_production = date_of_production
|
||||
if (expiry_date) data.expiry_date = expiry_date
|
||||
let data = await ProductService.getByLocalId(groupId, localId)
|
||||
|
||||
notify(req.headers.authorization.split(' ')[1], groupId, 'update', 'product', data);
|
||||
|
||||
|
@ -54,7 +50,7 @@ class AbstractProductController {
|
|||
|
||||
await ProductService.delete(id)
|
||||
|
||||
notify(req.headers.authorization.split(' ')[1], groupId, 'delete', 'product', { localId });
|
||||
notify(req.headers.authorization.split(' ')[1], groupId, 'delete', 'product', { local_id: localId });
|
||||
|
||||
return res.status(200).send(translate(req.headers["accept-language"], responseCodes.responses.general.ok));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue