-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathselfDisaster.seed.ts
More file actions
28 lines (25 loc) · 975 Bytes
/
selfDisaster.seed.ts
File metadata and controls
28 lines (25 loc) · 975 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { DataSource } from "typeorm";
import { Seeder, SeederFactoryManager } from "typeorm-extension";
import { SelfDeclaredDisaster } from "../../entities/SelfDisaster";
import { seededCompanies } from "./company.seed";
export const seededSelfDisasters: Partial<SelfDeclaredDisaster>[] = [
{
id: "ba5735c4-fbd1-4f7d-97c1-bf5af2a3f533",
companyId: seededCompanies[0].id,
description: "Hello world",
startDate: new Date("01/01/2025"),
},
{
id: "bf2b32dd-c927-440b-8002-84906db3c783",
companyId: seededCompanies[0].id,
description: "Hello world",
startDate: new Date("06/20/2025"),
endDate: new Date("06/30/2025"),
},
];
export class SelfDisasterSeeder implements Seeder {
track = false;
public async run(dataSource: DataSource, _factoryManager: SeederFactoryManager): Promise<void> {
await dataSource.manager.insert(SelfDeclaredDisaster, seededSelfDisasters);
}
}