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