Deprecate old add* methods
This commit is contained in:
parent
d643e5842c
commit
f06b21dfee
@ -1,5 +1,6 @@
|
|||||||
const Record = require('./record');
|
const Record = require('./record');
|
||||||
const ContributionSerializer = require('../serializers/contribution');
|
const ContributionSerializer = require('../serializers/contribution');
|
||||||
|
const deprecate = require('./utils/deprecate');
|
||||||
|
|
||||||
class Contribution extends Record {
|
class Contribution extends Record {
|
||||||
get count () {
|
get count () {
|
||||||
@ -34,7 +35,7 @@ class Contribution extends Record {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async addContribution (contributionAttr, callOptions = {}) {
|
async add (contributionAttr, callOptions = {}) {
|
||||||
const contribution = new ContributionSerializer(contributionAttr);
|
const contribution = new ContributionSerializer(contributionAttr);
|
||||||
|
|
||||||
try { await contribution.validate(); }
|
try { await contribution.validate(); }
|
||||||
@ -56,6 +57,11 @@ class Contribution extends Record {
|
|||||||
return this.functions.add(...contribution, callOptions);
|
return this.functions.add(...contribution, callOptions);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addContribution () {
|
||||||
|
deprecate('The method: `addContribution` is deprecated use `add` instead');
|
||||||
|
this.add(...arguments);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Contribution;
|
module.exports = Contribution;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
const Record = require('./record');
|
const Record = require('./record');
|
||||||
const ContributionSerializer = require('../serializers/contribution');
|
const ContributionSerializer = require('../serializers/contribution');
|
||||||
|
const deprecate = require('./utils/deprecate');
|
||||||
|
|
||||||
class Proposal extends Record {
|
class Proposal extends Record {
|
||||||
get count () {
|
get count () {
|
||||||
@ -13,7 +14,7 @@ class Proposal extends Record {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async addProposal (proposalAttr, callOptions = {}) {
|
async add (proposalAttr, callOptions = {}) {
|
||||||
const contribution = new ContributionSerializer(proposalAttr);
|
const contribution = new ContributionSerializer(proposalAttr);
|
||||||
|
|
||||||
try { await contribution.validate(); }
|
try { await contribution.validate(); }
|
||||||
@ -35,6 +36,11 @@ class Proposal extends Record {
|
|||||||
return this.functions.addProposal(...proposal, callOptions);
|
return this.functions.addProposal(...proposal, callOptions);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addProposal () {
|
||||||
|
deprecate('The method: `addProposal` is deprecated use `add` instead');
|
||||||
|
this.add(...arguments);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Proposal;
|
module.exports = Proposal;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user