@nina-protocol/nina-db 0.0.61 → 0.0.62
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.
- package/dist/models/Release.js +2 -0
- package/package.json +1 -1
- package/src/models/Release.js +2 -0
package/dist/models/Release.js
CHANGED
|
@@ -100,12 +100,14 @@ 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);
|
|
103
104
|
const royaltyRecipients = releaseData.account?.royaltyRecipients || releaseData.royaltyRecipients;
|
|
104
105
|
for await (let recipient of royaltyRecipients) {
|
|
105
106
|
try {
|
|
106
107
|
if (recipient.recipientAuthority.toBase58() !== "11111111111111111111111111111111") {
|
|
107
108
|
const recipientAccount = await Account.findOrCreate(recipient.recipientAuthority.toBase58());
|
|
108
109
|
const revenueShares = (await recipientAccount.$relatedQuery('revenueShares')).map(revenueShare => revenueShare.id);
|
|
110
|
+
console.log('recipient', recipient);
|
|
109
111
|
if (!revenueShares.includes(releaseRecord.id) && recipient.percentShares > 0) {
|
|
110
112
|
await Account.relatedQuery('revenueShares').for(recipientAccount.id).relate(releaseRecord.id);
|
|
111
113
|
}
|
package/package.json
CHANGED
package/src/models/Release.js
CHANGED
|
@@ -112,12 +112,14 @@ export default class Release extends Model {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
static processRevenueShares = async (releaseData, releaseRecord) => {
|
|
115
|
+
console.log('processRevenueShares', releaseData, releaseRecord)
|
|
115
116
|
const royaltyRecipients = releaseData.account?.royaltyRecipients || releaseData.royaltyRecipients
|
|
116
117
|
for await (let recipient of royaltyRecipients) {
|
|
117
118
|
try {
|
|
118
119
|
if (recipient.recipientAuthority.toBase58() !== "11111111111111111111111111111111") {
|
|
119
120
|
const recipientAccount = await Account.findOrCreate(recipient.recipientAuthority.toBase58());
|
|
120
121
|
const revenueShares = (await recipientAccount.$relatedQuery('revenueShares')).map(revenueShare => revenueShare.id);
|
|
122
|
+
console.log('recipient', recipient)
|
|
121
123
|
if (!revenueShares.includes(releaseRecord.id) && recipient.percentShares > 0) {
|
|
122
124
|
await Account.relatedQuery('revenueShares').for(recipientAccount.id).relate(releaseRecord.id);
|
|
123
125
|
} else if (revenueShares.includes(releaseRecord.id) && recipient.percentShares === 0) {
|