Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 2 additions & 18 deletions server/app/model/tags/tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,27 +46,11 @@ var TagSchema = new Schema({
},
catalystEntityType: {
type: String,
enum: ['project', 'environment','bgName'],
enum: ['project', 'environment', 'businessGroup'],
trim: true,
required: false
},
catalystEntityMapping: [{
catalystEntityId: {
type: String,
trim: true,
required: false
},
catalystEntityName: {
type: String,
trim: true,
required: false
},
tagValue: {
type: String,
trim: true,
required: false
}
}],
catalystEntityMapping: Schema.Types.Mixed,
isDeleted: {
type: Boolean,
required: true,
Expand Down
61 changes: 29 additions & 32 deletions server/app/routes/v1.0/routes_providercommon.js
Original file line number Diff line number Diff line change
Expand Up @@ -1238,21 +1238,18 @@ module.exports.setRoutes = function (app, sessionVerificationFunc) {
* @apiParam {Number} providerId Provider ID
* @apiParam {Object[]} tagMappings Tag mappings
* @apiParam {String} tagMappings.tagName Tag name
* @apiParam {String[]} tagMappings.tagValues Tag values
* @apiSuccess {Object[]} tagMappings.catalystEntityType Catalyst entity type
* @apiSuccess {String} tagNameMapping.catalystEntityMapping.catalystEntityId Catalyst entity id
* @apiSuccess {String} tagNameMapping.catalystEntityMapping.tagValue Tag value
* @apiParamExample {json} Request-Example:
* {
* "project": {
* "tagName": "application",
* "tagValues": [],
* "tagName": "application"
* "catalystEntityType": "project",
* "catalystEntityMapping": {}
* },
* "environment": {
* "tagName": "env",
* "tagValues": [],
* "catalystEntityType": "environment",
* "catalystEntityMapping": {}
* }
Expand Down Expand Up @@ -1525,7 +1522,7 @@ module.exports.setRoutes = function (app, sessionVerificationFunc) {
app.patch('/providers/:providerId/unassigned-instances',
validate(instanceValidator.get), bulkUpdateUnassignedInstances);

function getTagsList(req, res, next) {
function getTagsList(req, res, callback) {
async.waterfall(
[

Expand All @@ -1537,15 +1534,15 @@ module.exports.setRoutes = function (app, sessionVerificationFunc) {
],
function (err, results) {
if (err) {
next(err);
callback(err);
} else {
return res.status(200).send(results);
}
}
);
}

function getUnassignedInstancesList(req, res, next) {
function getUnassignedInstancesList(req, res, callback) {
var reqData = {};
async.waterfall(
[
Expand All @@ -1571,7 +1568,7 @@ module.exports.setRoutes = function (app, sessionVerificationFunc) {
],
function (err, results) {
if (err)
next(err);
callback(err);
else
return res.status(200).send(results);
});
Expand All @@ -1580,7 +1577,7 @@ module.exports.setRoutes = function (app, sessionVerificationFunc) {



function getTag(req, res, next) {
function getTag(req, res, callback) {
async.waterfall(
[

Expand All @@ -1594,7 +1591,7 @@ module.exports.setRoutes = function (app, sessionVerificationFunc) {
],
function (err, results) {
if (err) {
next(err);
callback(err);
} else {
return res.status(200).send(results);
}
Expand All @@ -1605,7 +1602,7 @@ module.exports.setRoutes = function (app, sessionVerificationFunc) {
// @TODO to be implemented
function createTags(req, res, next) {}

function updateTag(req, res, next) {
function updateTag(req, res, callback) {
async.waterfall(
[

Expand All @@ -1623,15 +1620,15 @@ module.exports.setRoutes = function (app, sessionVerificationFunc) {
],
function (err, results) {
if (err) {
next(err);
callback(err);
} else {
return res.status(200).send(results);
}
}
);
}

function deleteTag(req, res, next) {
function deleteTag(req, res, callback) {
async.waterfall(
[

Expand All @@ -1644,15 +1641,15 @@ module.exports.setRoutes = function (app, sessionVerificationFunc) {
],
function (err, results) {
if (err) {
next(err);
callback(err);
} else {
return res.status(200).send(results);
}
}
);
}

function getTagMappingsList(req, res, next) {
function getTagMappingsList(req, res, callback) {
async.waterfall(
[

Expand All @@ -1664,15 +1661,15 @@ module.exports.setRoutes = function (app, sessionVerificationFunc) {
],
function (err, results) {
if (err) {
next(err);
callback(err);
} else {
return res.status(200).send(results);
}
}
);
}

function getTagMapping(req, res, next) {
function getTagMapping(req, res, callback) {
async.waterfall(
[

Expand All @@ -1687,15 +1684,15 @@ module.exports.setRoutes = function (app, sessionVerificationFunc) {
],
function (err, results) {
if (err) {
next(err);
callback(err);
} else {
return res.status(200).send(results);
}
}
);
}

function addTagMappings(req, res, next) {
function addTagMappings(req, res, callback) {
async.waterfall(
[

Expand All @@ -1709,7 +1706,7 @@ module.exports.setRoutes = function (app, sessionVerificationFunc) {
],
function (err, results) {
if (err) {
next(err);
callback(err);
} else {
return res.status(201).send(results);
}
Expand All @@ -1718,7 +1715,7 @@ module.exports.setRoutes = function (app, sessionVerificationFunc) {

}

function updateTagMapping(req, res, next) {
function updateTagMapping(req, res, callback) {
async.waterfall(
[
function (next) {
Expand All @@ -1731,22 +1728,22 @@ module.exports.setRoutes = function (app, sessionVerificationFunc) {
function (tag, next) {
providerService.updateTagMapping(tag, req.body, next);
},
function (tag, next) {
/*function (tag, next) {
providerService.getTagByNameAndProvider(req.params.providerId, tag.name, next);
},
},*/
providerService.createTagMappingObject
],
function (err, results) {
if (err) {
next(err);
callback(err);
} else {
return res.status(200).send(results);
}
}
);
}

function deleteTagMapping(req, res, next) {
function deleteTagMapping(req, res, callback) {
async.waterfall(
[

Expand All @@ -1759,15 +1756,15 @@ module.exports.setRoutes = function (app, sessionVerificationFunc) {
],
function (err, results) {
if (err) {
next(err);
callback(err);
} else {
return res.status(200).send(results);
}
}
);
}

function getCatalystEntityMapping(req, res, next) {
function getCatalystEntityMapping(req, res, callback) {
async.waterfall(
[

Expand All @@ -1784,15 +1781,15 @@ module.exports.setRoutes = function (app, sessionVerificationFunc) {
],
function (err, results) {
if (err) {
next(err);
callback(err);
} else {
return res.status(200).send(results);
}
}
);
}

function updateUnassignedInstanceTags(req, res, next) {
function updateUnassignedInstanceTags(req, res, callback) {
async.waterfall(
[
function (next) {
Expand All @@ -1819,15 +1816,15 @@ module.exports.setRoutes = function (app, sessionVerificationFunc) {
],
function (err, results) {
if (err) {
next(err);
callback(err);
} else {
return res.status(200).send(results);
}
}
);
}

function bulkUpdateUnassignedInstances(req, res, next) {
function bulkUpdateUnassignedInstances(req, res, callback) {
async.waterfall(
[
function (next) {
Expand All @@ -1848,7 +1845,7 @@ module.exports.setRoutes = function (app, sessionVerificationFunc) {
],
function (err, results) {
if (err) {
next(err);
callback(err);
} else {
return res.status(200).send(results);
}
Expand Down
Loading