Skip to content

Commit

Permalink
Merge pull request #77 from yalla-coop/remove-edit-salessession
Browse files Browse the repository at this point in the history
Remove the ability to edit a sales session as we dont support it on the producer
  • Loading branch information
dupreesi authored Jul 30, 2024
2 parents c7b5aaf + 0cee723 commit a591c35
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 134 deletions.
50 changes: 0 additions & 50 deletions web/frontend/pages/SalesSession.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,22 +90,6 @@ export default function SalesSession() {
},
});

const {
mutateAsync: editCurrentSalesSession,
isLoading: editCurrentSalesSessionIsLoading,
error: editCurrentSalesSessionError,
} = useAppMutation({
reactQueryOptions: {
onSuccess: async () => {
await queryClient.invalidateQueries("/api/sales-session");
setShowSuccessAlert({
show: true,
type: "updated",
});
},
},
});

const {
mutateAsync: completeCurrentSalesSession,
isLoading: completeCurrentSalesSessionIsLoading,
Expand Down Expand Up @@ -134,22 +118,6 @@ export default function SalesSession() {
},
});

const handleOnEditCurrentSalesSessionClick = async () => {
await editCurrentSalesSession({
url: "/api/sales-session/current",
fetchInit: {
method: "PATCH",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
startDate: startDate.toISOString(),
sessionDurationInDays: Number(sessionDurationInDays),
}),
},
});
};

const handleOnFinishCurrentSalesSessionClick = async () => {
await completeCurrentSalesSession({
url: "/api/sales-session/current/complete",
Expand Down Expand Up @@ -314,20 +282,6 @@ export default function SalesSession() {
{createSalesSessionIsLoading ? "Loading..." : "Create Sales Session"}
</Button>

<Button
variant="contained"
type="button"
onClick={handleOnEditCurrentSalesSessionClick}
disabled={
editCurrentSalesSessionIsLoading ||
!currentSalesSessionData?.currentSalesSession?.isActive
}
>
{editCurrentSalesSessionIsLoading
? "Loading..."
: "Edit Current Sales Session"}
</Button>

<Button
variant="contained"
type="button"
Expand All @@ -346,10 +300,6 @@ export default function SalesSession() {
<Alert severity="error">{createSalesSessionError.message}</Alert>
)}

{editCurrentSalesSessionError && (
<Alert severity="error">{editCurrentSalesSessionError.message}</Alert>
)}

{completeCurrentSalesSessionError && (
<Alert severity="error">
{completeCurrentSalesSessionError.message}
Expand Down

This file was deleted.

2 changes: 0 additions & 2 deletions web/modules/sales-session/controllers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Router } from 'express';

import createSalesSession from './create-sales-session.js';
import getCurrentSalesSession from './get-current-sales-session.js';
import editCurrentSalesSession from './edit-current-sales-session.js';
import deleteCurrentSalesSession from './delete-current-sales-session.js';
import completeCurrentSalesSession from './complete-current-sales-session.js';

Expand All @@ -11,7 +10,6 @@ const salesSessionRouter = Router();
salesSessionRouter.post('/', createSalesSession);
salesSessionRouter.get('/', getCurrentSalesSession);
salesSessionRouter.delete('/current', deleteCurrentSalesSession);
salesSessionRouter.patch('/current', editCurrentSalesSession);
salesSessionRouter.patch('/current/complete', completeCurrentSalesSession);

export default salesSessionRouter;
30 changes: 0 additions & 30 deletions web/modules/sales-session/use-cases/edit-current-sales-session.js

This file was deleted.

2 changes: 1 addition & 1 deletion web/oidc-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ oidcRouter.get('/success', async (req, res) => {
res
.status(200)
.set('Content-Type', 'text/html')
.send(readFileSync(join(STATIC_PATH, 'success.html')))
.send(readFileSync(join(STATIC_PATH, 'success.html')));
});

oidcRouter.get(
Expand Down
7 changes: 1 addition & 6 deletions web/utils/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as qs from 'qs';

export const convertShopifyGraphQLIdToNumber = (id) => {
if (!id) return null;
Expand All @@ -7,11 +6,7 @@ export const convertShopifyGraphQLIdToNumber = (id) => {
};

export function throwError(message, errorObj) {
if (errorObj) {
throw errorObj;
} else {
throw new Error(message);
}
throw new Error(message, errorObj ? {cause: errorObj} : null);
}

export function getTargetStringFromSemanticId(url, key) {
Expand Down

0 comments on commit a591c35

Please sign in to comment.