Commit e08a5006 authored by Ermolaev Timur's avatar Ermolaev Timur

#17 Реализовал очищение данных

parent 9d00e81b
......@@ -3,8 +3,7 @@ import { User, UserRole } from "./models/User";
import { faker } from '@faker-js/faker';
import { Task } from "./models/Task";
import { Project } from "./models/Project";
function randomIntFromInterval(min:number, max:number) {
return Math.floor(Math.random() * (max - min + 1) + min)
......@@ -14,13 +13,13 @@ const loadFixtures = async () => {
myDataSource
.initialize()
.then(async () => {
console.log(`
==========================
Data Source has been initialized!
==========================
`)
const repositoryTask = myDataSource.getRepository(Task);
await repositoryTask.delete({});
const repositoryUser = myDataSource.getRepository(User);
await repositoryUser.delete({});
const repositoryProject = myDataSource.getRepository(Project);
await repositoryProject.delete({});
console.log('========================== ' + '\n' + 'Data Source has been cleared!' +'\n' + '==========================')
const userRoles = [{role: UserRole.DIRECTOR}, {role: UserRole.SUPERUSER}, {role: UserRole.USER}, {role: UserRole.USER}];
const users = []
......@@ -72,13 +71,7 @@ Data Source has been initialized!
tasks.push(newTask)
}
}
console.log(`
==========================
Fixtures done!
==========================
`)
console.log('========================== ' + '\n' + 'Fixtures done!' +'\n' + '==========================')
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment