tududi/backend/models/action.js
antanst e58ea08b7b Introduce RBAC scaffolding (roles, permissions, actions) and admin/shares endpoints.
Adds initial models, migrations, and services to support role-based access and sharing; wires routes to prepare for permission-driven features.
2025-09-22 15:20:46 +03:00

47 lines
929 B
JavaScript

const { DataTypes } = require('sequelize');
module.exports = (sequelize) => {
const Action = sequelize.define(
'Action',
{
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
actor_user_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
verb: {
type: DataTypes.STRING,
allowNull: false,
},
resource_type: {
type: DataTypes.STRING,
allowNull: false,
},
resource_uid: {
type: DataTypes.STRING,
allowNull: false,
},
target_user_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
access_level: {
type: DataTypes.STRING,
allowNull: true,
},
metadata: {
type: DataTypes.JSON,
allowNull: true,
},
},
{
tableName: 'actions',
}
);
return Action;
};