@nina-protocol/nina-db 0.0.92 → 0.0.94
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/index.js +30 -0
- package/dist/knexfile.js +78 -0
- package/dist/migrations/20220815134115_initial_migration.js +211 -0
- package/dist/migrations/20220930214430_add_subscriptions.js +23 -0
- package/dist/migrations/20221010170539_add_hub_data_uri.js +15 -0
- package/dist/migrations/20221010185734_add_transactions.js +58 -0
- package/dist/migrations/20221012230835_add_verifications.js +31 -0
- package/dist/migrations/20221201221013_add_hub_releases_visible.js +15 -0
- package/dist/migrations/20221206184748_add_gate.js +29 -0
- package/dist/migrations/20230104184351_add_verification_active.js +15 -0
- package/dist/migrations/20230306215838_add_hub_updated_at.js +15 -0
- package/dist/migrations/20231011163511_add_release_slug.js +15 -0
- package/dist/migrations/20231031200532_add_profile.js +18 -0
- package/dist/migrations/20231112031914_post_version.js +15 -0
- package/dist/migrations/20231116215117_add_tags.js +40 -0
- package/dist/migrations/20240131143626_release_price.js +16 -0
- package/dist/migrations/20240304143626_fix_tags_content.js +31 -0
- package/dist/migrations/20240321155034_hide_release.js +15 -0
- package/dist/migrations/20240821155034_release_hidden_to_archived.js +18 -0
- package/dist/migrations/20241121155034_subscription_public_key_nullable.js +15 -0
- package/dist/migrations/20250120215722_add_ref_columns.js +18 -0
- package/dist/migrations/20250423215722_hubs_collaborators_permissions.js +20 -0
- package/dist/migrations/20250424215722_hubs_collaborators_added_by.js +18 -0
- package/dist/migrations/20250425215722_hubs_collaborators_rename_collaborators.js +18 -0
- package/dist/models/Account.js +122 -0
- package/dist/models/Exchange.js +62 -0
- package/dist/models/Hub.js +86 -0
- package/dist/models/Post.js +84 -0
- package/dist/models/Release.js +282 -0
- package/dist/models/Subscription.js +57 -0
- package/dist/models/Tag.js +39 -0
- package/dist/models/TagsReleases.js +17 -0
- package/dist/models/Transaction.js +148 -0
- package/dist/models/Verification.js +50 -0
- package/dist/models/index.js +21 -0
- package/dist/seeds/1_accounts_profile.js +22 -0
- package/dist/utils/index.js +45 -0
- package/package.json +1 -1
- package/src/migrations/20250425215722_hubs_collaborators_rename_collaborators.js +19 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param { import("knex").Knex } knex
|
|
3
|
+
* @returns { Promise<void> }
|
|
4
|
+
*/
|
|
5
|
+
export const up = function (knex) {
|
|
6
|
+
return knex.schema.table('releases', table => {
|
|
7
|
+
table.boolean('hidden').notNullable().defaultTo(false);
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* @param { import("knex").Knex } knex
|
|
12
|
+
* @returns { Promise<void> }
|
|
13
|
+
*/
|
|
14
|
+
export const down = function (knex) {
|
|
15
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param { import("knex").Knex } knex
|
|
3
|
+
* @returns { Promise<void> }
|
|
4
|
+
*/
|
|
5
|
+
export const up = function (knex) {
|
|
6
|
+
return knex.schema.table('releases', table => {
|
|
7
|
+
table.renameColumn('hidden', 'archived');
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* @param { import("knex").Knex } knex
|
|
12
|
+
* @returns { Promise<void> }
|
|
13
|
+
*/
|
|
14
|
+
export const down = function (knex) {
|
|
15
|
+
return knex.schema.table('releases', table => {
|
|
16
|
+
table.renameColumn('archived', 'hidden');
|
|
17
|
+
});
|
|
18
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param { import("knex").Knex } knex
|
|
3
|
+
* @returns { Promise<void> }
|
|
4
|
+
*/
|
|
5
|
+
export const up = function (knex) {
|
|
6
|
+
return knex.schema.alterTable('subscriptions', table => {
|
|
7
|
+
table.dropColumn('publicKey');
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* @param { import("knex").Knex } knex
|
|
12
|
+
* @returns { Promise<void> }
|
|
13
|
+
*/
|
|
14
|
+
export const down = function (knex) {
|
|
15
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param { import("knex").Knex } knex
|
|
3
|
+
* @returns { Promise<void> }
|
|
4
|
+
*/
|
|
5
|
+
export const up = function (knex) {
|
|
6
|
+
return knex.schema.table('subscriptions', table => {
|
|
7
|
+
table.string('ref').nullable();
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* @param { import("knex").Knex } knex
|
|
12
|
+
* @returns { Promise<void> }
|
|
13
|
+
*/
|
|
14
|
+
export const down = function (knex) {
|
|
15
|
+
return knex.schema.table('subscriptions', table => {
|
|
16
|
+
table.dropColumn('ref');
|
|
17
|
+
});
|
|
18
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param { import("knex").Knex } knex
|
|
3
|
+
* @returns { Promise<void> }
|
|
4
|
+
*/
|
|
5
|
+
export const up = function (knex) {
|
|
6
|
+
return knex.schema.table('hubs_collaborators', table => {
|
|
7
|
+
table.boolean('can_add_content').defaultTo(true);
|
|
8
|
+
table.boolean('can_add_collaborators').defaultTo(true);
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* @param { import("knex").Knex } knex
|
|
13
|
+
* @returns { Promise<void> }
|
|
14
|
+
*/
|
|
15
|
+
export const down = function (knex) {
|
|
16
|
+
return knex.schema.table('hubs_collaborators', table => {
|
|
17
|
+
table.dropColumn('can_add_content');
|
|
18
|
+
table.dropColumn('can_add_collaborators');
|
|
19
|
+
});
|
|
20
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param { import("knex").Knex } knex
|
|
3
|
+
* @returns { Promise<void> }
|
|
4
|
+
*/
|
|
5
|
+
export const up = function (knex) {
|
|
6
|
+
return knex.schema.table('hubs_collaborators', table => {
|
|
7
|
+
table.string('added_by');
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* @param { import("knex").Knex } knex
|
|
12
|
+
* @returns { Promise<void> }
|
|
13
|
+
*/
|
|
14
|
+
export const down = function (knex) {
|
|
15
|
+
return knex.schema.table('hubs_collaborators', table => {
|
|
16
|
+
table.dropColumn('added_by');
|
|
17
|
+
});
|
|
18
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param { import("knex").Knex } knex
|
|
3
|
+
* @returns { Promise<void> }
|
|
4
|
+
*/
|
|
5
|
+
export const up = function (knex) {
|
|
6
|
+
return knex.schema.table('hubs_collaborators', table => {
|
|
7
|
+
table.renameColumn('collaborators', 'collaborator');
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* @param { import("knex").Knex } knex
|
|
12
|
+
* @returns { Promise<void> }
|
|
13
|
+
*/
|
|
14
|
+
export const down = function (knex) {
|
|
15
|
+
return knex.schema.table('hubs_collaborators', table => {
|
|
16
|
+
table.renameColumn('collaborator', 'collaborators');
|
|
17
|
+
});
|
|
18
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { Model } from 'objection';
|
|
2
|
+
import Exchange from './Exchange.js';
|
|
3
|
+
import Hub from './Hub.js';
|
|
4
|
+
import Post from './Post.js';
|
|
5
|
+
import Release from './Release.js';
|
|
6
|
+
import Verification from './Verification.js';
|
|
7
|
+
import Subscription from './Subscription.js';
|
|
8
|
+
export default class Account extends Model {
|
|
9
|
+
static tableName = 'accounts';
|
|
10
|
+
static idColumn = 'id';
|
|
11
|
+
static jsonSchema = {
|
|
12
|
+
type: 'object',
|
|
13
|
+
required: ['publicKey'],
|
|
14
|
+
properties: {
|
|
15
|
+
publicKey: { type: 'string' },
|
|
16
|
+
image: { type: 'string' },
|
|
17
|
+
description: { type: 'string' },
|
|
18
|
+
displayName: { type: 'string' },
|
|
19
|
+
handle: { type: 'string' },
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
static findOrCreate = async (publicKey) => {
|
|
23
|
+
let account = await Account.query().findOne({ publicKey });
|
|
24
|
+
if (account) {
|
|
25
|
+
return account;
|
|
26
|
+
}
|
|
27
|
+
account = await Account.query().insert({ publicKey });
|
|
28
|
+
console.log('Inserted Account: ', publicKey);
|
|
29
|
+
return account;
|
|
30
|
+
};
|
|
31
|
+
format = async () => {
|
|
32
|
+
const verifications = await this.$relatedQuery('verifications').where('active', true);
|
|
33
|
+
if (verifications) {
|
|
34
|
+
for await (let verification of verifications) {
|
|
35
|
+
await verification.format();
|
|
36
|
+
}
|
|
37
|
+
this.verifications = verifications;
|
|
38
|
+
}
|
|
39
|
+
delete this.id;
|
|
40
|
+
const followers = await Subscription.query().where('to', this.publicKey).range(0, 0);
|
|
41
|
+
this.followers = followers.total;
|
|
42
|
+
};
|
|
43
|
+
static relationMappings = () => ({
|
|
44
|
+
published: {
|
|
45
|
+
relation: Model.HasManyRelation,
|
|
46
|
+
modelClass: Release,
|
|
47
|
+
join: {
|
|
48
|
+
from: 'accounts.id',
|
|
49
|
+
to: 'releases.publisherId'
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
collected: {
|
|
53
|
+
relation: Model.ManyToManyRelation,
|
|
54
|
+
modelClass: Release,
|
|
55
|
+
join: {
|
|
56
|
+
from: 'accounts.id',
|
|
57
|
+
through: {
|
|
58
|
+
from: 'releases_collected.accountId',
|
|
59
|
+
to: 'releases_collected.releaseId',
|
|
60
|
+
},
|
|
61
|
+
to: 'releases.id'
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
exchangesInitialized: {
|
|
65
|
+
relation: Model.HasManyRelation,
|
|
66
|
+
modelClass: Exchange,
|
|
67
|
+
join: {
|
|
68
|
+
from: 'accounts.id',
|
|
69
|
+
to: 'exchanges.initializerId',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
exchangesCompleted: {
|
|
73
|
+
relation: Model.HasManyRelation,
|
|
74
|
+
modelClass: Exchange,
|
|
75
|
+
join: {
|
|
76
|
+
from: 'accounts.id',
|
|
77
|
+
to: 'exchanges.completedById',
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
hubs: {
|
|
81
|
+
relation: Model.ManyToManyRelation,
|
|
82
|
+
modelClass: Hub,
|
|
83
|
+
join: {
|
|
84
|
+
from: 'accounts.id',
|
|
85
|
+
through: {
|
|
86
|
+
from: 'hubs_collaborators.accountId',
|
|
87
|
+
to: 'hubs_collaborators.hubId',
|
|
88
|
+
extra: ['hubCollaboratorPublicKey'],
|
|
89
|
+
},
|
|
90
|
+
to: 'hubs.id',
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
posts: {
|
|
94
|
+
relation: Model.HasManyRelation,
|
|
95
|
+
modelClass: Post,
|
|
96
|
+
join: {
|
|
97
|
+
from: 'accounts.id',
|
|
98
|
+
to: 'posts.publisherId',
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
revenueShares: {
|
|
102
|
+
relation: Model.ManyToManyRelation,
|
|
103
|
+
modelClass: Release,
|
|
104
|
+
join: {
|
|
105
|
+
from: 'accounts.id',
|
|
106
|
+
through: {
|
|
107
|
+
from: 'releases_revenue_share.accountId',
|
|
108
|
+
to: 'releases_revenue_share.releaseId',
|
|
109
|
+
},
|
|
110
|
+
to: 'releases.id',
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
verifications: {
|
|
114
|
+
relation: Model.HasManyRelation,
|
|
115
|
+
modelClass: Verification,
|
|
116
|
+
join: {
|
|
117
|
+
from: 'accounts.id',
|
|
118
|
+
to: 'verifications.accountId',
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Model } from 'objection';
|
|
2
|
+
import Account from './Account.js';
|
|
3
|
+
import Release from './Release.js';
|
|
4
|
+
export default class Exchange extends Model {
|
|
5
|
+
static tableName = 'exchanges';
|
|
6
|
+
static idColum = 'id';
|
|
7
|
+
static jsonSchema = {
|
|
8
|
+
type: 'object',
|
|
9
|
+
required: ['publicKey', 'isSale', 'initializerAmount', 'expectedAmount', 'cancelled', 'createdAt'],
|
|
10
|
+
properties: {
|
|
11
|
+
publicKey: { type: 'string' },
|
|
12
|
+
isSale: { type: 'boolean' },
|
|
13
|
+
initializerAmount: { type: 'number' },
|
|
14
|
+
expectedAmount: { type: 'number' },
|
|
15
|
+
cancelled: { type: 'boolean' },
|
|
16
|
+
createdAt: { type: 'string' },
|
|
17
|
+
updatedAt: { type: 'string' },
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
format = async () => {
|
|
21
|
+
const initializer = await this.$relatedQuery('initializer');
|
|
22
|
+
const completedBy = await this.$relatedQuery('completedBy');
|
|
23
|
+
const release = await this.$relatedQuery('release').select('publicKey');
|
|
24
|
+
if (completedBy) {
|
|
25
|
+
await completedBy.format();
|
|
26
|
+
this.completedBy = completedBy;
|
|
27
|
+
}
|
|
28
|
+
this.release = release.publicKey;
|
|
29
|
+
await initializer.format();
|
|
30
|
+
this.initializer = initializer;
|
|
31
|
+
delete this.id;
|
|
32
|
+
delete this.initializerId;
|
|
33
|
+
delete this.completedById;
|
|
34
|
+
delete this.releaseId;
|
|
35
|
+
};
|
|
36
|
+
static relationMappings = () => ({
|
|
37
|
+
initializer: {
|
|
38
|
+
relation: Model.HasOneRelation,
|
|
39
|
+
modelClass: Account,
|
|
40
|
+
join: {
|
|
41
|
+
from: 'exchanges.initializerId',
|
|
42
|
+
to: 'accounts.id',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
completedBy: {
|
|
46
|
+
relation: Model.HasOneRelation,
|
|
47
|
+
modelClass: Account,
|
|
48
|
+
join: {
|
|
49
|
+
from: 'exchanges.completedById',
|
|
50
|
+
to: 'accounts.id',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
release: {
|
|
54
|
+
relation: Model.HasOneRelation,
|
|
55
|
+
modelClass: Release,
|
|
56
|
+
join: {
|
|
57
|
+
from: 'exchanges.releaseId',
|
|
58
|
+
to: 'releases.id',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Model } from 'objection';
|
|
2
|
+
import { stripHtmlIfNeeded } from '../utils/index.js';
|
|
3
|
+
import Account from './Account.js';
|
|
4
|
+
import Release from './Release.js';
|
|
5
|
+
import Post from './Post.js';
|
|
6
|
+
import Subscription from './Subscription.js';
|
|
7
|
+
export default class Hub extends Model {
|
|
8
|
+
static get tableName() {
|
|
9
|
+
return 'hubs';
|
|
10
|
+
}
|
|
11
|
+
static get idColumn() {
|
|
12
|
+
return 'id';
|
|
13
|
+
}
|
|
14
|
+
static get jsonSchema() {
|
|
15
|
+
return {
|
|
16
|
+
type: 'object',
|
|
17
|
+
required: ['publicKey', 'handle', 'data', 'dataUri', 'datetime'],
|
|
18
|
+
properties: {
|
|
19
|
+
publicKey: { type: 'string' },
|
|
20
|
+
handle: { type: 'string' },
|
|
21
|
+
data: { type: 'object' },
|
|
22
|
+
dataUri: { type: 'string' },
|
|
23
|
+
datetime: { type: 'string' },
|
|
24
|
+
updatedAt: { type: 'string' },
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
async format() {
|
|
29
|
+
const authority = await this.$relatedQuery('authority').select('publicKey');
|
|
30
|
+
this.authority = authority.publicKey;
|
|
31
|
+
delete this.authorityId;
|
|
32
|
+
delete this.id;
|
|
33
|
+
stripHtmlIfNeeded(this.data, 'description');
|
|
34
|
+
const followers = await Subscription.query().where('to', this.publicKey).range(0, 0);
|
|
35
|
+
this.followers = followers.total;
|
|
36
|
+
}
|
|
37
|
+
static relationMappings = () => ({
|
|
38
|
+
authority: {
|
|
39
|
+
relation: Model.HasOneRelation,
|
|
40
|
+
modelClass: Account,
|
|
41
|
+
join: {
|
|
42
|
+
from: 'hubs.authorityId',
|
|
43
|
+
to: 'accounts.id',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
collaborators: {
|
|
47
|
+
relation: Model.ManyToManyRelation,
|
|
48
|
+
modelClass: Account,
|
|
49
|
+
join: {
|
|
50
|
+
from: 'hubs.id',
|
|
51
|
+
through: {
|
|
52
|
+
from: 'hubs_collaborators.hubId',
|
|
53
|
+
to: 'hubs_collaborators.accountId',
|
|
54
|
+
extra: ['hubCollaboratorPublicKey'],
|
|
55
|
+
},
|
|
56
|
+
to: 'accounts.id',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
posts: {
|
|
60
|
+
relation: Model.ManyToManyRelation,
|
|
61
|
+
modelClass: Post,
|
|
62
|
+
join: {
|
|
63
|
+
from: 'hubs.id',
|
|
64
|
+
through: {
|
|
65
|
+
from: 'hubs_posts.hubId',
|
|
66
|
+
to: 'hubs_posts.postId',
|
|
67
|
+
extra: ['hubPostPublicKey'],
|
|
68
|
+
},
|
|
69
|
+
to: 'posts.id',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
releases: {
|
|
73
|
+
relation: Model.ManyToManyRelation,
|
|
74
|
+
modelClass: Release,
|
|
75
|
+
join: {
|
|
76
|
+
from: 'hubs.id',
|
|
77
|
+
through: {
|
|
78
|
+
from: 'hubs_releases.hubId',
|
|
79
|
+
to: 'hubs_releases.releaseId',
|
|
80
|
+
extra: ['hubReleasePublicKey', 'visible'],
|
|
81
|
+
},
|
|
82
|
+
to: 'releases.id',
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Model } from 'objection';
|
|
2
|
+
import { stripHtmlIfNeeded } from '../utils/index.js';
|
|
3
|
+
import Account from './Account.js';
|
|
4
|
+
import Hub from './Hub.js';
|
|
5
|
+
import Release from './Release.js';
|
|
6
|
+
class Post extends Model {
|
|
7
|
+
static get tableName() {
|
|
8
|
+
return 'posts';
|
|
9
|
+
}
|
|
10
|
+
static get idColumn() {
|
|
11
|
+
return 'id';
|
|
12
|
+
}
|
|
13
|
+
static get jsonSchema() {
|
|
14
|
+
return {
|
|
15
|
+
type: 'object',
|
|
16
|
+
required: ['publicKey', 'data', 'datetime', 'version'],
|
|
17
|
+
properties: {
|
|
18
|
+
publicKey: { type: 'string' },
|
|
19
|
+
data: { type: 'object' },
|
|
20
|
+
datetime: { type: 'string' },
|
|
21
|
+
version: { type: 'string' },
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
async format() {
|
|
26
|
+
const publisher = await this.$relatedQuery('publisher').select('publicKey');
|
|
27
|
+
const publishedThroughHub = await this.$relatedQuery('publishedThroughHub');
|
|
28
|
+
this.publisher = publisher.publicKey;
|
|
29
|
+
if (publishedThroughHub) {
|
|
30
|
+
this.publishedThroughHub = publishedThroughHub.publicKey;
|
|
31
|
+
this.hub = publishedThroughHub;
|
|
32
|
+
delete this.hub.id;
|
|
33
|
+
delete this.hub.authorityId;
|
|
34
|
+
}
|
|
35
|
+
delete this.publisherId;
|
|
36
|
+
delete this.id;
|
|
37
|
+
delete this.hubId;
|
|
38
|
+
stripHtmlIfNeeded(this.data, 'body');
|
|
39
|
+
}
|
|
40
|
+
static relationMappings = () => ({
|
|
41
|
+
publishedThroughHub: {
|
|
42
|
+
relation: Model.BelongsToOneRelation,
|
|
43
|
+
modelClass: Hub,
|
|
44
|
+
join: {
|
|
45
|
+
from: 'posts.hubId',
|
|
46
|
+
to: 'hubs.id',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
publisher: {
|
|
50
|
+
relation: Model.HasOneRelation,
|
|
51
|
+
modelClass: Account,
|
|
52
|
+
join: {
|
|
53
|
+
from: 'posts.publisherId',
|
|
54
|
+
to: 'accounts.id',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
hubs: {
|
|
58
|
+
relation: Model.ManyToManyRelation,
|
|
59
|
+
modelClass: Hub,
|
|
60
|
+
join: {
|
|
61
|
+
from: 'posts.id',
|
|
62
|
+
through: {
|
|
63
|
+
from: 'hubs_posts.postId',
|
|
64
|
+
to: 'hubs_posts.hubId',
|
|
65
|
+
extra: ['hubPostPublicKey'],
|
|
66
|
+
},
|
|
67
|
+
to: 'hubs.id',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
releases: {
|
|
71
|
+
relation: Model.ManyToManyRelation,
|
|
72
|
+
modelClass: Release,
|
|
73
|
+
join: {
|
|
74
|
+
from: 'posts.id',
|
|
75
|
+
through: {
|
|
76
|
+
from: 'posts_releases.postId',
|
|
77
|
+
to: 'posts_releases.releaseId',
|
|
78
|
+
},
|
|
79
|
+
to: 'releases.id',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
export default Post;
|