Trade: Add tradehistories table

and create rows at the end of each trade.
Both users traded cards are logged.
This commit is contained in:
2023-01-12 14:43:06 +01:00
parent 2ef1dfe7a7
commit 692904d462
3 changed files with 72 additions and 2 deletions

26
models/tradehistories.js Normal file
View File

@@ -0,0 +1,26 @@
'use strict';
const {
Model
} = require('sequelize');
module.exports = (sequelize, DataTypes) => {
class TradeHistory extends Model {
/**
* Helper method for defining associations.
* This method is not a part of Sequelize lifecycle.
* The `models/index` file will call this method automatically.
*/
static associate(models) {
// define association here
}
}
TradeHistory.init({
userAId: DataTypes.INTEGER,
userBId: DataTypes.INTEGER,
userATraded: DataTypes.JSON,
userBTraded: DataTypes.JSON
}, {
sequelize,
modelName: 'TradeHistory',
});
return TradeHistory;
};