I have been trying to implement Admin Bro with my existing mysql sequelized database. I get plain Admin panel and it works fine, however when i try to fetch db i get: There are no adapters supporting one of the resource you provided error. Please help.
UserModel
import {Sequelize} from "sequelize";
import db from "../config/database.js";
const {DataTypes} = Sequelize;
const Users = db.define('user', {
name: {
type: DataTypes.STRING
},
surname: {
type: DataTypes.STRING
},
email: {
type: DataTypes.STRING
},
password: {
type: DataTypes.STRING
},
refresh_token:{
type: DataTypes.TEXT
},
token:{
type: DataTypes.TEXT
}
}, {
freezeTableName: true,
timestamps:false
});
(async () => {
await db.sync()
})();
export default Users;
database
import { Sequelize } from "sequelize";
const db = new Sequelize('users', 'root', '*********', {
host: "localhost",
dialect: "mysql"
});
export default db;
adminBro
import AdminBro from "admin-bro";
import Users from '../models/UserModel.js'
const adminBro = new AdminBro({
rootPath: '/admin',
loginPath: '/admin/login',
databases:[Users],
branding: {
companyName: 'Admin',
softwareBrothers: false,
}
});
export default adminBro
To see your entire db within the AdminBro panel import the db file and use that
please use the below code:
If you want individual resource then follow this link: add resource and customize resource