I have a feathers api set up using feathers-sequelize to persist to a MySQL database.
I've got the datamodel set up and can see the relevant tables are created.
const Sequelize = require('sequelize');
module.exports = function (app) {
const sequelizeClient = app.get('sequelizeClient');
const orders = sequelizeClient.define('orders', {
id: {
type: Sequelize.UUID,
primaryKey: true,
defaultValue: Sequelize.UUIDV4
}, {
classMethods: {
associate (models) {
this.belongsToMany(models.users, {through: "offers", foreignKey: "orderId", otherKey: "userId"});
}
}
});
return orders;
};
How do I actually create an association of offers
? I've tried something like this:
const orders = hook.app.service("orders");
order.offers.push(user.id);
orders.patch(order.id, order);
but it doesn't seem to have any effect