label-print/sequelize/apps.model.mjs
2025-05-17 16:23:48 +02:00

34 lines
705 B
JavaScript

import {
DataTypes
} from 'sequelize';
import {
DBLogger,
LabelDB
} from './db_conn.mjs'
import {
Permission
} from "./perms.model.mjs";
export const App = LabelDB.define('app', {
id: {
type: DataTypes.UUID,
defaultValue: DataTypes.UUIDV4,
primaryKey: true
},
name: {
type: DataTypes.STRING,
allowNull: false
},
token: {
type: DataTypes.STRING,
allowNull: false
}
}, {
timestamps: false
});
App.belongsToMany(Permission, { through: 'app_permissions', timestamps: false, foreignKey: 'app' });
Permission.belongsToMany(App, { through: 'app_permissions', timestamps: false, foreignKey: 'permission' });