19 lines
432 B
TypeScript
19 lines
432 B
TypeScript
import { permissions } from "../core/constants";
|
|
import Permission from "../models/Permission";
|
|
|
|
export async function seedPermissions() {
|
|
|
|
let createdCount = 0;
|
|
|
|
for (const name of permissions) {
|
|
const [perm, created] = await Permission.findOrCreate({
|
|
where: { name },
|
|
defaults: { name },
|
|
});
|
|
|
|
if (created) createdCount++;
|
|
}
|
|
|
|
console.log(`✅ Permissions Seeded. New created: ${createdCount}`);
|
|
}
|