11import { Team , Team_Type } from '@prisma/client' ;
2- import { ConfigDataOutput , ConfigDataProcess } from './config-data.process.js' ;
3- import { OrganizationOutput , OrganizationProcess } from './organization.process.js' ;
2+ import {
3+ ConfigDataOutput ,
4+ ConfigDataProcess
5+ } from './config-data.process.js' ;
6+ import {
7+ OrganizationOutput ,
8+ OrganizationProcess
9+ } from './organization.process.js' ;
410import { UsersOutput , UsersProcess } from './user.process.js' ;
5- import { seedTeamConfigs , teamCreateInput } from '../factories/teams.factory.js' ;
11+ import {
12+ seedTeamConfigs ,
13+ teamCreateInput
14+ } from '../factories/teams.factory.js' ;
615import { SeedProcess } from '../processes/seed-process.js' ;
716
817const EXPECTED_TEAM_COUNT = 20 ;
@@ -24,15 +33,29 @@ export class TeamProcess extends SeedProcess<TeamInput, TeamOutput> {
2433 return [ OrganizationProcess , UsersProcess , ConfigDataProcess ] ;
2534 }
2635
27- async run ( { organization, admins, heads, leadership, members, teamTypes } : TeamInput ) : Promise < TeamOutput > {
36+ async run ( {
37+ organization,
38+ admins,
39+ heads,
40+ leadership,
41+ members,
42+ teamTypes
43+ } : TeamInput ) : Promise < TeamOutput > {
2844 if ( seedTeamConfigs . length !== EXPECTED_TEAM_COUNT ) {
2945 throw new Error (
3046 `TeamProcess expected ${ EXPECTED_TEAM_COUNT } teams but found ${ seedTeamConfigs . length } .`
3147 ) ;
3248 }
3349
34- if ( admins . length === 0 || heads . length === 0 || leadership . length === 0 || members . length === 0 ) {
35- throw new Error ( 'TeamProcess requires admins, heads, leadership, and members to create teams.' ) ;
50+ if (
51+ admins . length === 0 ||
52+ heads . length === 0 ||
53+ leadership . length === 0 ||
54+ members . length === 0
55+ ) {
56+ throw new Error (
57+ 'TeamProcess requires admins, heads, leadership, and members to create teams.'
58+ ) ;
3659 }
3760
3861 const teamNames = seedTeamConfigs . map ( ( team ) => team . teamName ) ;
@@ -41,10 +64,13 @@ export class TeamProcess extends SeedProcess<TeamInput, TeamOutput> {
4164 throw new Error ( 'TeamProcess cannot generate duplicate team names.' ) ;
4265 }
4366
44- const teamTypesByName = teamTypes . reduce < Record < string , Team_Type > > ( ( acc , teamType ) => {
45- acc [ teamType . name ] = teamType ;
46- return acc ;
47- } , { } ) ;
67+ const teamTypesByName = teamTypes . reduce < Record < string , Team_Type > > (
68+ ( acc , teamType ) => {
69+ acc [ teamType . name ] = teamType ;
70+ return acc ;
71+ } ,
72+ { }
73+ ) ;
4874
4975 const possibleHeads = [ ...heads , ...admins , ...leadership ] ;
5076 const possibleLeads = [ ...leadership , ...heads , ...admins ] ;
@@ -57,7 +83,9 @@ export class TeamProcess extends SeedProcess<TeamInput, TeamOutput> {
5783 throw new Error ( 'TeamProcess could not find a head for a team.' ) ;
5884 }
5985
60- const leadPool = possibleLeads . filter ( ( user ) => user . userId !== head . userId ) ;
86+ const leadPool = possibleLeads . filter (
87+ ( user ) => user . userId !== head . userId
88+ ) ;
6189
6290 const leads = this . faker . helpers . arrayElements (
6391 leadPool ,
0 commit comments