Skip to content

Commit

Permalink
update integration_mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
FancMa01 committed Mar 1, 2024
1 parent 9cf6154 commit a0343d3
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions server/models/integration_mapping.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
"use strict";
module.exports = (sequelize, DataTypes) => {
const IntegrationMapping = sequelize.define(
"integration_mapping",
{
id: {
type: DataTypes.UUID,
primaryKey: true,
defaultValue: DataTypes.UUIDV4,
allowNull: false,
},
integration_id: {
type: DataTypes.UUID,
references: {
model: "integrations",
key: "id",
},
onUpdate: "CASCADE",
onDelete: "CASCADE",
},
application_id: {
type: DataTypes.UUID,
references: {
model: "application",
key: "id",
},
onUpdate: "CASCADE",
onDelete: "CASCADE",
},
metaData: {
type: DataTypes.JSON,
allowNull: true,
},
createdAt: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
},
updatedAt: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
},
},
{ freezeTableName: true }
);

IntegrationMapping.associate = (models) => {
IntegrationMapping.belongsTo(models.integrations, {
foreignKey: "integration_id",
});
IntegrationMapping.belongsTo(models.application, {
foreignKey: "application_id",
});
};

return IntegrationMapping;
};

0 comments on commit a0343d3

Please sign in to comment.