chore: compelete danak category service

This commit is contained in:
mahyargdz
2025-01-26 16:10:12 +03:30
parent e4425a07d6
commit bdd8ec06b4
17 changed files with 367 additions and 16 deletions
+4 -1
View File
@@ -1,4 +1,5 @@
import { Logger } from "@nestjs/common";
import { hash } from "bcrypt";
import { DataSource, DeepPartial } from "typeorm";
import { Role } from "../../src/modules/users/entities/role.entity";
@@ -23,7 +24,9 @@ export const seedAdmin = async (dataSource: DataSource, logger: Logger) => {
const adminRole = await roleRepo.findOneBy({ name: RoleEnum.ADMIN });
if (!adminRole) throw new Error("Role not found");
const admin = userRepo.create({ ...defaultAdmin, role: adminRole });
const hashedPassword = await hash(defaultAdmin.password!, 10);
const admin = userRepo.create({ ...defaultAdmin, password: hashedPassword, role: adminRole });
await userRepo.save(admin);
logger.log("admin created successfully");
} catch (error) {