Skip to content

Commit

Permalink
fix role table
Browse files Browse the repository at this point in the history
  • Loading branch information
ngoerlitz committed Mar 16, 2024
1 parent 3ad4ec5 commit 3749bff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions db/migrations/20221115171263-create-permission-tables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ export const ROLE_BELONGS_TO_USER_TABLE_ATTRIBUTES = {
export default {
async up(queryInterface: QueryInterface) {
await queryInterface.createTable(PERMISSION_TABLE_NAME, PERMISSION_TABLE_ATTRIBUTES);
await queryInterface.createTable(ROLE_BELONGS_TO_USER_TABLE_NAME, ROLE_TABLE_ATTRIBUTES);
await queryInterface.createTable(ROLE_TABLE_NAME, ROLE_TABLE_ATTRIBUTES);
await queryInterface.createTable(ROLE_HAS_PERMISSION_TABLE_NAME, ROLE_HAS_PERMISSION_TABLE_ATTRIBUTES);
await queryInterface.createTable(ROLE_BELONGS_TO_USER_TABLE_NAME, ROLE_BELONGS_TO_USER_TABLE_ATTRIBUTES);
},

async down(queryInterface: QueryInterface) {
await queryInterface.dropTable(PERMISSION_TABLE_NAME);
await queryInterface.dropTable(ROLE_BELONGS_TO_USER_TABLE_NAME);
await queryInterface.dropTable(ROLE_TABLE_NAME);
await queryInterface.dropTable(ROLE_HAS_PERMISSION_TABLE_NAME);
await queryInterface.dropTable(ROLE_BELONGS_TO_USER_TABLE_NAME);
},
Expand Down
8 changes: 6 additions & 2 deletions src/models/Role.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import { Association, CreationOptional, InferAttributes, InferCreationAttributes
import { sequelize } from "../core/Sequelize";
import { Permission } from "./Permission";
import { User } from "./User";
import { ROLE_BELONGS_TO_USER_TABLE_NAME, ROLE_TABLE_ATTRIBUTES } from "../../db/migrations/20221115171263-create-permission-tables";
import {
ROLE_BELONGS_TO_USER_TABLE_NAME,
ROLE_TABLE_ATTRIBUTES,
ROLE_TABLE_NAME
} from "../../db/migrations/20221115171263-create-permission-tables";

export class Role extends Model<InferAttributes<Role>, InferCreationAttributes<Role>> {
//
Expand Down Expand Up @@ -30,6 +34,6 @@ export class Role extends Model<InferAttributes<Role>, InferCreationAttributes<R
}

Role.init(ROLE_TABLE_ATTRIBUTES, {
tableName: ROLE_BELONGS_TO_USER_TABLE_NAME,
tableName: ROLE_TABLE_NAME,
sequelize: sequelize,
});

0 comments on commit 3749bff

Please sign in to comment.