Commit e08a5006 authored by Ermolaev Timur's avatar Ermolaev Timur

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

parent 9d00e81b
...@@ -3,8 +3,7 @@ import { User, UserRole } from "./models/User"; ...@@ -3,8 +3,7 @@ import { User, UserRole } from "./models/User";
import { faker } from '@faker-js/faker'; import { faker } from '@faker-js/faker';
import { Task } from "./models/Task"; import { Task } from "./models/Task";
import { Project } from "./models/Project";
function randomIntFromInterval(min:number, max:number) { function randomIntFromInterval(min:number, max:number) {
return Math.floor(Math.random() * (max - min + 1) + min) return Math.floor(Math.random() * (max - min + 1) + min)
...@@ -14,13 +13,13 @@ const loadFixtures = async () => { ...@@ -14,13 +13,13 @@ const loadFixtures = async () => {
myDataSource myDataSource
.initialize() .initialize()
.then(async () => { .then(async () => {
console.log(` const repositoryTask = myDataSource.getRepository(Task);
========================== await repositoryTask.delete({});
const repositoryUser = myDataSource.getRepository(User);
Data Source has been initialized! 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 userRoles = [{role: UserRole.DIRECTOR}, {role: UserRole.SUPERUSER}, {role: UserRole.USER}, {role: UserRole.USER}];
const users = [] const users = []
...@@ -72,13 +71,7 @@ Data Source has been initialized! ...@@ -72,13 +71,7 @@ Data Source has been initialized!
tasks.push(newTask) tasks.push(newTask)
} }
} }
console.log(` console.log('========================== ' + '\n' + 'Fixtures done!' +'\n' + '==========================')
==========================
Fixtures done!
==========================
`)
}) })
......
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