@nina-protocol/nina-db 0.0.42 → 0.0.44
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.
|
@@ -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('posts', table => {
|
|
7
|
+
table.string('version').notNullable().defaultTo('0.0.0');
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* @param { import("knex").Knex } knex
|
|
12
|
+
* @returns { Promise<void> }
|
|
13
|
+
*/
|
|
14
|
+
export const down = function (knex) {
|
|
15
|
+
};
|
package/dist/models/Release.js
CHANGED
|
@@ -115,9 +115,9 @@ export default class Release extends Model {
|
|
|
115
115
|
.replace('-', '') // remove hyphens
|
|
116
116
|
.replace(/ +/g, ' ') // remove spaces
|
|
117
117
|
.replace(/ /g, '-') // replace spaces with hyphens
|
|
118
|
-
.replace(/[^a-zA-Z0-9-]/g, '') //
|
|
119
|
-
.replace(
|
|
120
|
-
.replace(/-$/, '');
|
|
118
|
+
.replace(/[^a-zA-Z0-9-]/g, '-') // replace non-alphanumeric characters with hyphens
|
|
119
|
+
.replace(/-+/g, '-') // replace multiple hyphens with single hyphen
|
|
120
|
+
.replace(/-$/, ''); // remove trailing hyphens
|
|
121
121
|
const existingRelease = await Release.query().findOne({ slug });
|
|
122
122
|
if (existingRelease) {
|
|
123
123
|
return `${slug}-${randomStringGenerator()}`;
|
package/dist/utils/index.js
CHANGED
|
@@ -25,7 +25,7 @@ export const tweetNewRelease = async (metadata, publisherId) => {
|
|
|
25
25
|
accessToken: process.env.TWITTER_ACCESS_TOKEN,
|
|
26
26
|
accessSecret: process.env.TWITTER_ACCESS_TOKEN_SECRET,
|
|
27
27
|
});
|
|
28
|
-
let text = (`${metadata.properties.artist} -
|
|
28
|
+
let text = (`${metadata.properties.artist ? `${metadata.properties.artist} - ` : ''}${metadata.properties.title}`).substr(0, 250);
|
|
29
29
|
const publisher = await Account.query().findById(publisherId);
|
|
30
30
|
if (publisher) {
|
|
31
31
|
const twitterVerification = (await publisher.$relatedQuery('verifications').where('type', 'twitter').andWhere('active', true))[0];
|
package/package.json
CHANGED
package/src/models/Release.js
CHANGED
|
@@ -126,9 +126,9 @@ export default class Release extends Model {
|
|
|
126
126
|
.replace('-', '') // remove hyphens
|
|
127
127
|
.replace(/ +/g, ' ') // remove spaces
|
|
128
128
|
.replace(/ /g, '-') // replace spaces with hyphens
|
|
129
|
-
.replace(/[^a-zA-Z0-9-]/g, '') //
|
|
130
|
-
.replace(
|
|
131
|
-
.replace(/-$/, '')
|
|
129
|
+
.replace(/[^a-zA-Z0-9-]/g, '-') // replace non-alphanumeric characters with hyphens
|
|
130
|
+
.replace(/-+/g,'-') // replace multiple hyphens with single hyphen
|
|
131
|
+
.replace(/-$/, '') // remove trailing hyphens
|
|
132
132
|
|
|
133
133
|
const existingRelease = await Release.query().findOne({ slug });
|
|
134
134
|
if (existingRelease) {
|
package/src/utils/index.js
CHANGED
|
@@ -29,7 +29,7 @@ export const tweetNewRelease = async (metadata, publisherId) => {
|
|
|
29
29
|
accessToken: process.env.TWITTER_ACCESS_TOKEN,
|
|
30
30
|
accessSecret: process.env.TWITTER_ACCESS_TOKEN_SECRET,
|
|
31
31
|
});
|
|
32
|
-
let text = (`${metadata.properties.artist} -
|
|
32
|
+
let text = (`${metadata.properties.artist ? `${metadata.properties.artist} - ` : ''}${metadata.properties.title}`).substr(0, 250)
|
|
33
33
|
const publisher = await Account.query().findById(publisherId);
|
|
34
34
|
if (publisher) {
|
|
35
35
|
const twitterVerification = (await publisher.$relatedQuery('verifications').where('type', 'twitter').andWhere('active', true))[0]
|