Skip to content

Commit 1a9e5ae

Browse files
committed
#4212-fix
1 parent 3f316ba commit 1a9e5ae

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/backend/src/prisma/seed/team.process.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,17 @@ export class TeamProcess extends SeedProcess<TeamInput, TeamOutput> {
112112

113113
const teams = await Promise.all(teamCreateInputs.map((data) => this.prisma.team.create({ data })));
114114

115+
116+
115117
const teamsByName = teams.reduce<Record<string, Team>>((acc, team) => {
116118
acc[team.teamName] = team;
117119
return acc;
118120
}, {});
119121

120-
const financeTeam = teamsByName.Finance;
122+
const financeTeam = teams.find((_, index) => seedTeamConfigs[index]?.financeTeam);
121123

122124
if (!financeTeam) {
123-
throw new Error('TeamProcess expected a Finance team to be generated.');
125+
throw new Error('TeamProcess expected one team config to be marked as the finance team.');
124126
}
125127

126128
return { teams, financeTeam, teamsByName };

0 commit comments

Comments
 (0)