slate/node_common/data/methods/delete-subscription-by-id.js
2020-08-25 13:26:15 -07:00

21 lines
441 B
JavaScript

import { runQuery } from "~/node_common/data/utilities";
export default async ({ id }) => {
return await runQuery({
label: "DELETE_SUBSCRIPTION_BY_ID",
queryFn: async (DB) => {
const data = await DB.from("subscriptions")
.where({ id })
.del();
return 1 === data;
},
errorFn: async (e) => {
return {
error: "DELETE_SUBSCRIPTION_BY_ID",
source: e,
};
},
});
};