Skip to content

Commit

Permalink
Merge pull request #100 from gadget-inc/wishlist-pcs
Browse files Browse the repository at this point in the history
Adding pcsda
  • Loading branch information
DevAOC authored Oct 7, 2024
2 parents 25ee13d + 146871f commit 5bd7eb6
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
save,
ActionOptions,
CreateWishlistActionContext,
preventCrossShopDataAccess,
} from "gadget-server";
import { updateWishlistMetafield } from "../../../utilities";

Expand All @@ -11,6 +12,7 @@ import { updateWishlistMetafield } from "../../../utilities";
*/
export async function run({ params, record, logger, api, connections }) {
applyParams(params, record);
await preventCrossShopDataAccess(params, record);
await save(record);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import {
deleteRecord,
ActionOptions,
DeleteWishlistActionContext,
preventCrossShopDataAccess,
} from "gadget-server";
import { updateWishlistMetafield } from "../../../utilities";

/**
* @param { DeleteWishlistActionContext } context
*/
export async function run({ params, record, logger, api, connections }) {
await preventCrossShopDataAccess(params, record);
await deleteRecord(record);
}

Expand Down
15 changes: 11 additions & 4 deletions shopify/wishlist-template/api/models/wishlist/actions/update.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
import { applyParams, save, ActionOptions, UpdateWishlistActionContext } from "gadget-server";
import {
applyParams,
save,
ActionOptions,
UpdateWishlistActionContext,
preventCrossShopDataAccess,
} from "gadget-server";

/**
* @param { UpdateWishlistActionContext } context
*/
export async function run({ params, record, logger, api, connections }) {
applyParams(params, record);
await preventCrossShopDataAccess(params, record);
await save(record);
};
}

/**
* @param { UpdateWishlistActionContext } context
*/
export async function onSuccess({ params, record, logger, api, connections }) {
// Your logic goes here
};
}

/** @type { ActionOptions } */
export const options = {
actionType: "update"
actionType: "update",
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
save,
ActionOptions,
CreateWishlistItemActionContext,
preventCrossShopDataAccess,
} from "gadget-server";
import { updateWishlistMetafield } from "../../../utilities";

Expand All @@ -11,6 +12,7 @@ import { updateWishlistMetafield } from "../../../utilities";
*/
export async function run({ params, record, logger, api, connections }) {
applyParams(params, record);
await preventCrossShopDataAccess(params, record);
await save(record);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import {
deleteRecord,
ActionOptions,
DeleteWishlistItemActionContext,
preventCrossShopDataAccess,
} from "gadget-server";
import { updateWishlistMetafield } from "../../../utilities";

/**
* @param { DeleteWishlistItemActionContext } context
*/
export async function run({ params, record, logger, api, connections }) {
await preventCrossShopDataAccess(params, record);
await deleteRecord(record);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
save,
ActionOptions,
UpdateWishlistItemActionContext,
preventCrossShopDataAccess,
} from "gadget-server";
import { updateWishlistMetafield } from "../../../utilities";

Expand All @@ -11,6 +12,7 @@ import { updateWishlistMetafield } from "../../../utilities";
*/
export async function run({ params, record, logger, api, connections }) {
applyParams(params, record);
await preventCrossShopDataAccess(params, record);
await save(record);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export default ({ wishlists }) => {
defaultValues: {
wishlist: {
name: "",
shopId: shop?.id,
customerId: shop?.customers?.edges[0]?.node.id,
},
},
Expand Down

0 comments on commit 5bd7eb6

Please sign in to comment.