mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-30 22:13:47 +03:00
25 lines
564 B
JavaScript
25 lines
564 B
JavaScript
import { runQuery } from "~/node_common/data/utilities";
|
|
|
|
export default async ({ userId }) => {
|
|
return await runQuery({
|
|
label: "GET_SUBSCRIPTIONS_TO_USER_ID",
|
|
queryFn: async (DB) => {
|
|
const query = await DB.select("*")
|
|
.from("subscriptions")
|
|
.where({ target_user_id: userId });
|
|
|
|
if (!query || query.error) {
|
|
return [];
|
|
}
|
|
|
|
return JSON.parse(JSON.stringify(query));
|
|
},
|
|
errorFn: async (e) => {
|
|
return {
|
|
error: "GET_SUBSCRIPTIONS_TO_USER_ID",
|
|
source: e,
|
|
};
|
|
},
|
|
});
|
|
};
|