@nina-protocol/nina-db 0.0.62 → 0.0.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -100,18 +100,16 @@ export default class Release extends Model {
100
100
  return release;
101
101
  };
102
102
  static processRevenueShares = async (releaseData, releaseRecord) => {
103
- console.log('processRevenueShares', releaseData, releaseRecord);
104
103
  const royaltyRecipients = releaseData.account?.royaltyRecipients || releaseData.royaltyRecipients;
105
104
  for await (let recipient of royaltyRecipients) {
106
105
  try {
107
106
  if (recipient.recipientAuthority.toBase58() !== "11111111111111111111111111111111") {
108
107
  const recipientAccount = await Account.findOrCreate(recipient.recipientAuthority.toBase58());
109
108
  const revenueShares = (await recipientAccount.$relatedQuery('revenueShares')).map(revenueShare => revenueShare.id);
110
- console.log('recipient', recipient);
111
- if (!revenueShares.includes(releaseRecord.id) && recipient.percentShares > 0) {
109
+ if (!revenueShares.includes(releaseRecord.id) && recipient.percentShare.toNumber() > 0) {
112
110
  await Account.relatedQuery('revenueShares').for(recipientAccount.id).relate(releaseRecord.id);
113
111
  }
114
- else if (revenueShares.includes(releaseRecord.id) && recipient.percentShares === 0) {
112
+ else if (revenueShares.includes(releaseRecord.id) && recipient.percentShare.toNumber() === 0) {
115
113
  await Account.relatedQuery('revenueShares').for(recipientAccount.id).unrelate().where('id', releaseRecord.id);
116
114
  }
117
115
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nina-protocol/nina-db",
3
- "version": "0.0.62",
3
+ "version": "0.0.63",
4
4
  "description": "",
5
5
  "source": "src/index.js",
6
6
  "main": "dist/index.js",
@@ -112,17 +112,15 @@ export default class Release extends Model {
112
112
  }
113
113
 
114
114
  static processRevenueShares = async (releaseData, releaseRecord) => {
115
- console.log('processRevenueShares', releaseData, releaseRecord)
116
115
  const royaltyRecipients = releaseData.account?.royaltyRecipients || releaseData.royaltyRecipients
117
116
  for await (let recipient of royaltyRecipients) {
118
117
  try {
119
118
  if (recipient.recipientAuthority.toBase58() !== "11111111111111111111111111111111") {
120
119
  const recipientAccount = await Account.findOrCreate(recipient.recipientAuthority.toBase58());
121
120
  const revenueShares = (await recipientAccount.$relatedQuery('revenueShares')).map(revenueShare => revenueShare.id);
122
- console.log('recipient', recipient)
123
- if (!revenueShares.includes(releaseRecord.id) && recipient.percentShares > 0) {
121
+ if (!revenueShares.includes(releaseRecord.id) && recipient.percentShare.toNumber() > 0) {
124
122
  await Account.relatedQuery('revenueShares').for(recipientAccount.id).relate(releaseRecord.id);
125
- } else if (revenueShares.includes(releaseRecord.id) && recipient.percentShares === 0) {
123
+ } else if (revenueShares.includes(releaseRecord.id) && recipient.percentShare.toNumber() === 0) {
126
124
  await Account.relatedQuery('revenueShares').for(recipientAccount.id).unrelate().where('id', releaseRecord.id);
127
125
  }
128
126
  }