Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
2debca8
#4207 Core Infrastructure, User Tested
Santiordon May 21, 2026
ed40237
Merge from Develop
Santiordon May 31, 2026
f4b79f0
Yarn install
Santiordon May 31, 2026
b487ab3
#4207 Structure Changes
Santiordon May 31, 2026
8dd95bc
Create dummy orgs & finish car process
Santiordon Jun 2, 2026
73f62a4
Fix users and work on orgs
Santiordon Jun 2, 2026
9b13d4e
Create factories and fix general bugs
Santiordon Jun 3, 2026
86e0a1b
#4207 Finish general structure
Santiordon Jun 3, 2026
0a61462
#4207 Fix File Structure
Santiordon Jun 3, 2026
3e70627
outline
Steph375 Jun 3, 2026
2ded59a
Finish realistic variables
Santiordon Jun 3, 2026
fe00e14
#4207 Fix faker checksum in lockfile
Santiordon Jun 3, 2026
c8c0240
4207 Prettier
Santiordon Jun 3, 2026
459ef0c
September does not have 31 days
Santiordon Jun 3, 2026
f4e531e
#4207 Path simplicity
Santiordon Jun 3, 2026
a2a2043
#4207 Grammar
Santiordon Jun 3, 2026
5c0803d
Comments
Santiordon Jun 3, 2026
1f5fb17
Restore SeedRunner Prisma guard
Copilot Jun 3, 2026
2f9e6aa
#4207 Fix faker checksum in lockfile
Santiordon Jun 3, 2026
00c81cf
Merge pull request #4261 from Northeastern-Electric-Racing/#4207-core…
wavehassman Jun 4, 2026
40231a3
Merge branch 'feature/seed-data-revamp' into #4208-generate-organizat…
Steph375 Jun 7, 2026
492325a
#4208-fix
Steph375 Jun 7, 2026
d7c79b6
#4208 tsc-check fix
Steph375 Jun 7, 2026
d02ddb6
#4239 config data
Steph375 Jun 7, 2026
f632e82
#4239 linting fix
Steph375 Jun 7, 2026
df5a0fe
add back car process
Steph375 Jun 8, 2026
99cb18e
#4208 fix
Steph375 Jun 8, 2026
cc0f9d8
Merge pull request #4266 from Northeastern-Electric-Racing/#4208-gene…
wavehassman Jun 8, 2026
34e5e5c
#4239-fixes
Steph375 Jun 8, 2026
d0c8d1d
Merge branch 'feature/seed-data-revamp' into #4239-generate-config-data
Steph375 Jun 8, 2026
a1e6549
Merge pull request #4267 from Northeastern-Electric-Racing/#4239-gene…
wavehassman Jun 9, 2026
ea3f6f3
fixing for merge to develop
Steph375 Jun 9, 2026
22956a8
Merge branch 'develop' into feature/seed-data-revamp
Steph375 Jun 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"@types/react-dom": "17.0.1"
},
"dependencies": {
"@faker-js/faker": "^10.4.0",
"@microsoft/clarity": "^1.0.0",
"@types/multer": "^1.4.12",
"canvas-confetti": "^1.9.3",
Expand Down
3 changes: 2 additions & 1 deletion src/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"test": "vitest",
"build": "NODE_OPTIONS='--max-old-space-size=8192' tsc --noEmit false",
"start": "node -r dotenv/config dist/backend/index.js",
"prisma:manual": "tsx --import dotenv/config ./src/prisma/manual.ts"
"prisma:manual": "tsx --import dotenv/config ./src/prisma/manual.ts",
"prisma:dev-seed": "tsx --import dotenv/config ./src/prisma/dev-seed.ts"
},
"dependencies": {
"@prisma/client": "^6.2.1",
Expand Down
76 changes: 76 additions & 0 deletions src/backend/src/prisma/context.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import {
Account_Code,
Description_Bullet_Type,
Index_Code,
Link_Type,
Manufacturer,
Material_Type,
Organization,
Prisma,
Reimbursement_Product_Other_Reason,
Role,
Team_Type,
Unit,
Vendor
} from '@prisma/client';
import { RoleEnum } from 'shared';
import { getUserQueryArgs } from '../prisma-query-args/user.query-args.js';

// Organization Context
export type OrganizationContext = {
organization: Organization;
bootstrapUserId: string;
};

// User Context
export type FullUser = Prisma.UserGetPayload<ReturnType<typeof getUserQueryArgs>>;

export type UsersContext = {
appAdmins: FullUser[];
admins: FullUser[];
heads: FullUser[];
leadership: FullUser[];
members: FullUser[];
guests: FullUser[];
all: FullUser[];
};

// Role Context
export type RoleContext = {
roles: Role[];
rolesByType: Record<RoleEnum, Role[]>;
};

// Config Data Context
export type ConfigDataContext = {
teamTypes: Team_Type[];
linkTypes: Link_Type[];
descriptionBulletTypes: Description_Bullet_Type[];
materialTypes: Material_Type[];
manufacturers: Manufacturer[];
units: Unit[];
accountCodes: Account_Code[];
indexCodes: Index_Code[];
vendors: Vendor[];
reimbursementProductOtherReasons: Reimbursement_Product_Other_Reason[];
};

// Main Seed Context
export type SeedContext = OrganizationContext & UsersContext & RoleContext & CarOutput & ConfigDataContext;

// Car Context
export type DateRange = {
start: Date;
end: Date;
};

export type CarContext = {
car: Prisma.CarGetPayload<{ include: { wbsElement: true } }>;
year: number;
dateRange: DateRange;
};

export type CarOutput = {
cars: CarContext[];
currentYearCar: CarContext;
};
16 changes: 16 additions & 0 deletions src/backend/src/prisma/dates.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Faker } from '@faker-js/faker';
/*
https://fakerjs.dev/api/date.html
*/

interface WithFaker {
faker: Faker;
}

export function generateRandomDate({ faker }: WithFaker, from?: Date, to?: Date) {
return faker.date.between({ from: from ?? '2000-01-01', to: to ?? Date.now() });
}

export function generateRandomDateAround({ faker }: WithFaker, date: Date) {
return faker.date.recent({ days: 5, refDate: date });
}
5,211 changes: 5,211 additions & 0 deletions src/backend/src/prisma/dev-seed.ts

Large diffs are not rendered by default.

Empty file.
48 changes: 48 additions & 0 deletions src/backend/src/prisma/factories/car.factory.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { Prisma } from '@prisma/client';
import { base, en, Faker } from '@faker-js/faker';
import { DateRange } from '../context.js';

const CURRENT_YEAR = new Date().getFullYear();
const CAR_COUNT = 5;

const FROM_MONTH = 3; // April
const FROM_DAY = 1;
const TO_MONTH = 8; // September
const TO_DAY = 30;

export const CAR_CONFIGS = Array.from({ length: CAR_COUNT }, (_, i) => {
const carYear = CURRENT_YEAR - (CAR_COUNT - 1) + i;
const shortYear = String(carYear).slice(2);

const carFaker = new Faker({ locale: [en, base] });
carFaker.seed(carYear);

const start = carFaker.date.between({
from: new Date(carYear - 1, FROM_MONTH, FROM_DAY),
to: new Date(carYear - 1, TO_MONTH, TO_DAY)
});

const end = carFaker.date.between({
from: new Date(carYear, FROM_MONTH, FROM_DAY),
to: new Date(carYear, TO_MONTH, TO_DAY)
});

return {
name: `NER-${shortYear}`,
carNumber: carYear - 2000,
year: carYear,
dateRange: { start, end } as DateRange
};
});

export const carCreateInput = (name: string, carNumber: number, organizationId: string): Prisma.CarCreateInput => ({
wbsElement: {
create: {
name,
carNumber,
projectNumber: 0,
workPackageNumber: 0,
organizationId
}
}
});
Loading
Loading