Add Marketplace Migration

(and warning banner for corrupt experimentsStore)
This commit is contained in:
Troplo 2020-11-17 18:28:05 +11:00
parent 4f765619ba
commit 7aa67e74f8
2 changed files with 120 additions and 0 deletions

View File

@ -696,6 +696,15 @@ blockquote {
</div>
</div>
</section>
<section v-if="settings.experiments.corrupt" class="hero is-danger">
<div class="hero-body" style="padding: 1rem 1rem !important;">
<div class="mobile-container">
<div class="container">
<p style="text-align: center;">It has been detected that your Kaverti Experiments options have been corrupted, this may lead to issues when browsing Kaverti. <a @click="resetExperimentsStore()" style="color: #FFFFFF;">Reset experiment options</a></p>
</div>
</div>
</div>
</section>
<section v-if='$store.state.meta.bannerText && !$store.state.username' class="hero is-info">
<div class="hero-body" style="padding: 1rem 1rem !important;">
<div class="mobile-container">
@ -943,6 +952,7 @@ export default {
marketplace: false,
teams: false,
newsettings: true,
corrupt: false,
local: []
},
account: {
@ -1073,6 +1083,19 @@ export default {
}
},
methods: {
experimentCheck() {
try {
JSON.parse(localStorage.getItem('experimentsStore'))
} catch (e) {
this.settings.experiments.corrupt = true
console.log("Corrupted experimentsStore, Please reset experimentsStore localStorage")
}
},
resetExperimentsStore() {
localStorage.removeItem('experimentsStore')
this.localExperiments()
this.setExperimentsStore()
},
doBoth() {
this.saveExperiments()
this.localExperiments()
@ -1832,6 +1855,7 @@ export default {
}
},
mounted () {
this.experimentCheck()
console.log('%cStop!', 'color: red; font-size: 60px; font-weight: bold;');
console.log('%cIf you have been told to enter something in here, its most likely malicious! Someone might be trying to gain access to your ' + this.name + ' account! Please do not enter anything in here unless you know what you\'re doing', 'font-size: 16px; font-weight: bold;');
console.log('%cStop!', 'color: red; font-size: 60px; font-weight: bold;');

View File

@ -0,0 +1,96 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('items', {
id: {
type: Sequelize.BIGINT,
primaryKey: true,
autoIncrement: true
},
type: {
type: Sequelize.STRING,
defaultValue: "shirt",
default: "shirt",
allowNull: false
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
},
name: {
type: Sequelize.TEXT,
allowNull: false,
},
UserId: {
type: Sequelize.BIGINT,
},
sourceFile: {
type: Sequelize.TEXT,
},
previewFile: {
type: Sequelize.TEXT
},
limited: {
type: Sequelize.BOOLEAN,
defaultValue: 0,
default: 0
},
salePrice: {
type: Sequelize.BIGINT
},
saleEnabled: {
type: Sequelize.BOOLEAN,
defaultValue: 0,
default: 0
},
price: {
type: Sequelize.BOOLEAN
},
quantityAllowed: {
type: Sequelize.BIGINT,
default: 0,
defaultValue: 0
},
offSale: {
type: Sequelize.BOOLEAN,
default: 0,
defaultValue: 0
}
});
return queryInterface.createTable('inventory', {
id: {
type: Sequelize.BIGINT,
primaryKey: true,
autoIncrement: true
},
UserId: {
type: Sequelize.BIGINT
},
purchasePrice: {
type: Sequelize.BIGINT
},
isReselling: {
type: Sequelize.BOOLEAN,
default: 0,
defaultValue: 0
},
isResellingPrice: {
type: Sequelize.BIGINT
},
ItemId: {
type: Sequelize.BIGINT
},
boughtFrom: {
type: Sequelize.BIGINT
}
});
},
down: (queryInterface, Sequelize) => {
return queryInterface.dropTable('inventory');
return queryInterface.dropTable('items');
}
};