Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store service data in lowercase in rules collection #525

Open
fgalan opened this issue Apr 29, 2021 · 0 comments
Open

Store service data in lowercase in rules collection #525

fgalan opened this issue Apr 29, 2021 · 0 comments
Labels

Comments

@fgalan
Copy link
Member

fgalan commented Apr 29, 2021

According to documentation (https://thinking-cities.readthedocs.io/en/latest/multitenancy/index.html) with regards to service

If uppercase characters are used, they are converted to lowercase.

Thus, the following code should be adapted:

Save: function Save(r, callback) {
var db = appContext.Db();
stringifyPostAxnParams(r);
async.waterfall(
[
db.collection.bind(db, rulesCollectionName, { strict: true }),
function(col, cb) {
col.save(r, cb);
}
],

And maybe also this one:

Update: function Update(id, r, callback) {
var db = appContext.Db();
stringifyPostAxnParams(r);
async.waterfall(
[
db.collection.bind(db, rulesCollectionName, { strict: true }),
function(col, cb) {
col.findOneAndUpdate(
{ name: id },
{ $set: r },
{
upsert: false,
returnOriginal: false
},
function(err, result) {
if (result && result.lastErrorObject && result.lastErrorObject.updatedExisting === false) {
return cb(new errors.NotFoundRule(id), null);
}
parsePostAxnParams(r);
logger.debug('rulesStore.findOneAndUpdate %s', myutils.firstChars(r));
return cb(err, r);
}
);
}
],

This is not a big issue as the interaction with CB are already using service in lowercase correctly (see #146 (comment)) but it is needed to avoid that for instance GET /rules - fiware-service: SSS and GET /rules - fiware-service: sss result in different set of rules.

@mrutid mrutid added the P1 label Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants