mirror of
https://github.com/wekan/wekan.git
synced 2025-06-28 09:27:54 -04:00
🐛 fix updating fields
This commit is contained in:
parent
586473aaa7
commit
db666eec65
1 changed files with 15 additions and 38 deletions
|
@ -385,74 +385,51 @@ if (Meteor.isServer) {
|
||||||
JsonRoutes.add(
|
JsonRoutes.add(
|
||||||
'PUT',
|
'PUT',
|
||||||
'/api/boards/:boardId/custom-fields/:customFieldId',
|
'/api/boards/:boardId/custom-fields/:customFieldId',
|
||||||
function(req, res) {
|
(req, res) => {
|
||||||
Authentication.checkUserId(req.userId);
|
Authentication.checkUserId(req.userId);
|
||||||
|
|
||||||
const paramFieldId = req.params.customFieldId;
|
const paramFieldId = req.params.customFieldId;
|
||||||
const paramBoardId = req.params.boardId;
|
|
||||||
|
|
||||||
if (req.body.hasOwnProperty('name')) {
|
if (req.body.hasOwnProperty('name')) {
|
||||||
CustomFields.direct.update(
|
CustomFields.direct.update(
|
||||||
{
|
{ _id: paramFieldId },
|
||||||
_id: paramFieldId,
|
{ $set: { name: req.body.name } },
|
||||||
boardId: paramBoardId,
|
|
||||||
},
|
|
||||||
{ $set: { title: req.body.name } },
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (req.body.hasOwnProperty('type')) {
|
if (req.body.hasOwnProperty('type')) {
|
||||||
CustomFields.direct.update(
|
CustomFields.direct.update(
|
||||||
{
|
{ _id: paramFieldId },
|
||||||
_id: paramFieldId,
|
{ $set: { type: req.body.type } },
|
||||||
boardId: paramBoardId,
|
|
||||||
},
|
|
||||||
{ $set: { title: req.body.type } },
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (req.body.hasOwnProperty('settings')) {
|
if (req.body.hasOwnProperty('settings')) {
|
||||||
CustomFields.direct.update(
|
CustomFields.direct.update(
|
||||||
{
|
{ _id: paramFieldId },
|
||||||
_id: paramFieldId,
|
{ $set: { settings: req.body.settings } },
|
||||||
boardId: paramBoardId,
|
|
||||||
},
|
|
||||||
// TODO: should I just wholesale set the settings obj?
|
|
||||||
{ $set: { title: req.body.settings } },
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (req.body.hasOwnProperty('showOnCard')) {
|
if (req.body.hasOwnProperty('showOnCard')) {
|
||||||
CustomFields.direct.update(
|
CustomFields.direct.update(
|
||||||
{
|
{ _id: paramFieldId },
|
||||||
_id: paramFieldId,
|
{ $set: { showOnCard: req.body.showOnCard } },
|
||||||
boardId: paramBoardId,
|
|
||||||
},
|
|
||||||
{ $set: { title: req.body.showOnCard } },
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (req.body.hasOwnProperty('automaticallyOnCard')) {
|
if (req.body.hasOwnProperty('automaticallyOnCard')) {
|
||||||
CustomFields.direct.update(
|
CustomFields.direct.update(
|
||||||
{
|
{ _id: paramFieldId },
|
||||||
_id: paramFieldId,
|
{ $set: { automaticallyOnCard: req.body.automaticallyOnCard } },
|
||||||
boardId: paramBoardId,
|
|
||||||
},
|
|
||||||
{ $set: { title: req.body.automaticallyOnCard } },
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (req.body.hasOwnProperty('alwaysOnCard')) {
|
if (req.body.hasOwnProperty('alwaysOnCard')) {
|
||||||
CustomFields.direct.update(
|
CustomFields.direct.update(
|
||||||
{
|
{ _id: paramFieldId },
|
||||||
_id: paramFieldId,
|
{ $set: { alwaysOnCard: req.body.alwaysOnCard } },
|
||||||
boardId: paramBoardId,
|
|
||||||
},
|
|
||||||
{ $set: { title: req.body.alwaysOnCard } },
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (req.body.hasOwnProperty('showLabelOnMiniCard')) {
|
if (req.body.hasOwnProperty('showLabelOnMiniCard')) {
|
||||||
CustomFields.direct.update(
|
CustomFields.direct.update(
|
||||||
{
|
{ _id: paramFieldId },
|
||||||
_id: paramFieldId,
|
{ $set: { showLabelOnMiniCard: req.body.showLabelOnMiniCard } },
|
||||||
boardId: paramBoardId,
|
|
||||||
},
|
|
||||||
{ $set: { title: req.body.showLabelOnMiniCard } },
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue