30 lines
537 B
TypeScript
30 lines
537 B
TypeScript
import { v4 as uuid } from 'uuid';
|
|
import { Student } from './student.service';
|
|
|
|
const courses = [
|
|
'Mathematics',
|
|
'Physics',
|
|
'Chemistry',
|
|
'History',
|
|
'Literature',
|
|
];
|
|
|
|
function generateRandom() {
|
|
const mockData: Student[] = [];
|
|
|
|
for (let i = 0; i < 100; i++) {
|
|
const student: Student = {
|
|
id: uuid(),
|
|
name: `Student ${i}`,
|
|
email: `student${i}@gmail.com`,
|
|
courses: courses.slice(0, Math.floor(Math.random() * courses.length) + 1),
|
|
};
|
|
mockData.push(student);
|
|
}
|
|
|
|
return mockData;
|
|
}
|
|
|
|
export default generateRandom;
|
|
|