Skip to content

Commit 8e85316

Browse files
committed
Make verifyProjectMembership a function for consistency
1 parent 209242f commit 8e85316

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

apps/webapp/app/routes/resources.$projectId.deployments.$deploymentShortCode.cancel.ts

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,30 @@ export const action: ActionFunction = async ({ request, params }) => {
2828
return json(submission);
2929
}
3030

31-
const verifyProjectMembership = fromPromise(
32-
prisma.project.findFirst({
33-
where: {
34-
id: projectId,
35-
organization: {
36-
members: {
37-
some: {
38-
userId,
31+
const verifyProjectMembership = () =>
32+
fromPromise(
33+
prisma.project.findFirst({
34+
where: {
35+
id: projectId,
36+
organization: {
37+
members: {
38+
some: {
39+
userId,
40+
},
3941
},
4042
},
4143
},
42-
},
43-
select: {
44-
id: true,
45-
},
46-
}),
47-
(error) => ({ type: "other" as const, cause: error })
48-
).andThen((project) => {
49-
if (!project) {
50-
return errAsync({ type: "project_not_found" as const });
51-
}
52-
return okAsync(project);
53-
});
44+
select: {
45+
id: true,
46+
},
47+
}),
48+
(error) => ({ type: "other" as const, cause: error })
49+
).andThen((project) => {
50+
if (!project) {
51+
return errAsync({ type: "project_not_found" as const });
52+
}
53+
return okAsync(project);
54+
});
5455

5556
const findDeploymentFriendlyId = ({ id }: { id: string }) =>
5657
fromPromise(
@@ -75,7 +76,7 @@ export const action: ActionFunction = async ({ request, params }) => {
7576
});
7677

7778
const deploymentService = new DeploymentService();
78-
const result = await verifyProjectMembership
79+
const result = await verifyProjectMembership()
7980
.andThen(findDeploymentFriendlyId)
8081
.andThen((deployment) =>
8182
deploymentService.cancelDeployment({ projectId: deployment.projectId }, deployment.friendlyId)

0 commit comments

Comments
 (0)