first
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import { faker } from "@faker-js/faker"; // Use faker for generating random data
|
||||
|
||||
import { StatusEnum } from "../../common/enums/status.enum";
|
||||
import { Logger } from "../../core/logging/logger";
|
||||
import { WarrantyModel } from "../../modules/warranty/models/warranty.model";
|
||||
|
||||
const warrantyNames = [
|
||||
"Iran Warranty Co.",
|
||||
"Pars Guarantee",
|
||||
"Tehran Warranty Services",
|
||||
"Safir Warranty",
|
||||
"Farda Warranty Solutions",
|
||||
"Aryan Protection",
|
||||
"Mehr Warranty",
|
||||
"Saman Warranty Group",
|
||||
"Persian Warranty Solutions",
|
||||
"Shahab After Sales",
|
||||
"Payam Warranty",
|
||||
"Kavir Protection",
|
||||
"Tajrish Warranty",
|
||||
"Sina Warranty",
|
||||
"Atlas Warranty Services",
|
||||
"Sepahan Warranty",
|
||||
"Kish Warranty Group",
|
||||
"Navid Warranty Solutions",
|
||||
"Alborz Protection Services",
|
||||
"Raha Warranty Solutions",
|
||||
];
|
||||
|
||||
export const seedWarranty = async (logger: Logger) => {
|
||||
try {
|
||||
logger.info("Warranty seeding started");
|
||||
|
||||
for (const name of warrantyNames) {
|
||||
await WarrantyModel.create({
|
||||
name,
|
||||
status: StatusEnum.Approved,
|
||||
duration: faker.datatype.number({ min: 1, max: 36 }) + " months",
|
||||
logoUrl: faker.image.business(),
|
||||
});
|
||||
}
|
||||
|
||||
logger.info("Warranty seeding complete!");
|
||||
} catch (error) {
|
||||
logger.error("Error seeding warranties:", error);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user