Skip to content

Commit 57b8dc0

Browse files
committed
#4212-prettier-fix-again
1 parent 5760a45 commit 57b8dc0

2 files changed

Lines changed: 20 additions & 66 deletions

File tree

src/backend/src/prisma/factories/teams.factory.ts

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ export const seedTeamConfigs: SeedTeamConfig[] = [
4444
},
4545
{
4646
teamName: 'Battery',
47-
description:
48-
'Designs and validates the battery pack and accumulator systems.',
47+
description: 'Designs and validates the battery pack and accumulator systems.',
4948
teamTypeName: 'Electrical'
5049
},
5150
{
@@ -85,8 +84,7 @@ export const seedTeamConfigs: SeedTeamConfig[] = [
8584
},
8685
{
8786
teamName: 'Finance',
88-
description:
89-
'Manages purchasing, reimbursements, budgeting, and sponsor funds.',
87+
description: 'Manages purchasing, reimbursements, budgeting, and sponsor funds.',
9088
teamTypeName: 'Business',
9189
financeTeam: true
9290
},
@@ -117,21 +115,15 @@ export const seedTeamConfigs: SeedTeamConfig[] = [
117115
}
118116
];
119117

120-
const connectUsers = (users: FullUser[]) =>
121-
users.map((user) => ({ userId: user.userId }));
118+
const connectUsers = (users: FullUser[]) => users.map((user) => ({ userId: user.userId }));
122119

123120
const slackIdForTeam = (faker: Faker, teamName: string): string => {
124121
const slug = teamName.toLowerCase().replaceAll(' ', '-').replaceAll('/', '-');
125122

126-
return `seed-${slug}-${faker.string
127-
.alphanumeric(SLACK_ID_RANDOM_LENGTH)
128-
.toLowerCase()}`;
123+
return `seed-${slug}-${faker.string.alphanumeric(SLACK_ID_RANDOM_LENGTH).toLowerCase()}`;
129124
};
130125

131-
const findTeamType = (
132-
teamTypesByName: Record<string, Team_Type>,
133-
teamTypeName: string
134-
): Team_Type => {
126+
const findTeamType = (teamTypesByName: Record<string, Team_Type>, teamTypeName: string): Team_Type => {
135127
const teamType = teamTypesByName[teamTypeName];
136128

137129
if (!teamType) {
@@ -175,4 +167,4 @@ export const teamCreateInput = (
175167
},
176168
...overrides
177169
};
178-
};
170+
};
Lines changed: 14 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
11
import { Team, Team_Type } from '@prisma/client';
2-
import {
3-
ConfigDataOutput,
4-
ConfigDataProcess
5-
} from './config-data.process.js';
6-
import {
7-
OrganizationOutput,
8-
OrganizationProcess
9-
} from './organization.process.js';
2+
import { ConfigDataOutput, ConfigDataProcess } from './config-data.process.js';
3+
import { OrganizationOutput, OrganizationProcess } from './organization.process.js';
104
import { UsersOutput, UsersProcess } from './user.process.js';
11-
import {
12-
seedTeamConfigs,
13-
teamCreateInput
14-
} from '../factories/teams.factory.js';
5+
import { seedTeamConfigs, teamCreateInput } from '../factories/teams.factory.js';
156
import { SeedProcess } from '../processes/seed-process.js';
167

178
const EXPECTED_TEAM_COUNT = 20;
@@ -33,29 +24,13 @@ export class TeamProcess extends SeedProcess<TeamInput, TeamOutput> {
3324
return [OrganizationProcess, UsersProcess, ConfigDataProcess];
3425
}
3526

36-
async run({
37-
organization,
38-
admins,
39-
heads,
40-
leadership,
41-
members,
42-
teamTypes
43-
}: TeamInput): Promise<TeamOutput> {
27+
async run({ organization, admins, heads, leadership, members, teamTypes }: TeamInput): Promise<TeamOutput> {
4428
if (seedTeamConfigs.length !== EXPECTED_TEAM_COUNT) {
45-
throw new Error(
46-
`TeamProcess expected ${EXPECTED_TEAM_COUNT} teams but found ${seedTeamConfigs.length}.`
47-
);
29+
throw new Error(`TeamProcess expected ${EXPECTED_TEAM_COUNT} teams but found ${seedTeamConfigs.length}.`);
4830
}
4931

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-
);
32+
if (admins.length === 0 || heads.length === 0 || leadership.length === 0 || members.length === 0) {
33+
throw new Error('TeamProcess requires admins, heads, leadership, and members to create teams.');
5934
}
6035

6136
const teamNames = seedTeamConfigs.map((team) => team.teamName);
@@ -64,13 +39,10 @@ export class TeamProcess extends SeedProcess<TeamInput, TeamOutput> {
6439
throw new Error('TeamProcess cannot generate duplicate team names.');
6540
}
6641

67-
const teamTypesByName = teamTypes.reduce<Record<string, Team_Type>>(
68-
(acc, teamType) => {
69-
acc[teamType.name] = teamType;
70-
return acc;
71-
},
72-
{}
73-
);
42+
const teamTypesByName = teamTypes.reduce<Record<string, Team_Type>>((acc, teamType) => {
43+
acc[teamType.name] = teamType;
44+
return acc;
45+
}, {});
7446

7547
const possibleHeads = [...heads, ...admins, ...leadership];
7648
const possibleLeads = [...leadership, ...heads, ...admins];
@@ -83,9 +55,7 @@ export class TeamProcess extends SeedProcess<TeamInput, TeamOutput> {
8355
throw new Error('TeamProcess could not find a head for a team.');
8456
}
8557

86-
const leadPool = possibleLeads.filter(
87-
(user) => user.userId !== head.userId
88-
);
58+
const leadPool = possibleLeads.filter((user) => user.userId !== head.userId);
8959

9060
const leads = this.faker.helpers.arrayElements(
9161
leadPool,
@@ -104,15 +74,7 @@ export class TeamProcess extends SeedProcess<TeamInput, TeamOutput> {
10474
);
10575

10676
return this.prisma.team.create({
107-
data: teamCreateInput(
108-
this.faker,
109-
organization.organizationId,
110-
head,
111-
leads,
112-
teamMembers,
113-
teamTypesByName,
114-
config
115-
)
77+
data: teamCreateInput(this.faker, organization.organizationId, head, leads, teamMembers, teamTypesByName, config)
11678
});
11779
})
11880
);
@@ -130,4 +92,4 @@ export class TeamProcess extends SeedProcess<TeamInput, TeamOutput> {
13092

13193
return { teams, financeTeam, teamsByName };
13294
}
133-
}
95+
}

0 commit comments

Comments
 (0)