2020-08-26 00:23:45 +03:00
|
|
|
import { runQuery } from "~/node_common/data/utilities";
|
|
|
|
|
|
|
|
export default async ({ slateId }) => {
|
|
|
|
return await runQuery({
|
|
|
|
label: "GET_ACTIVITY_FOR_SLATE_ID",
|
|
|
|
queryFn: async (DB) => {
|
|
|
|
const query = await DB.select("*")
|
|
|
|
.from("activity")
|
|
|
|
.where({ owner_slate_id: slateId });
|
|
|
|
|
|
|
|
if (!query || query.error) {
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
|
|
|
|
return JSON.parse(JSON.stringify(query));
|
|
|
|
},
|
|
|
|
errorFn: async (e) => {
|
2020-09-01 02:47:53 +03:00
|
|
|
console.log({
|
2020-08-26 00:23:45 +03:00
|
|
|
error: "GET_ACTIVITY_FOR_SLATE_ID",
|
|
|
|
source: e,
|
2020-09-01 02:47:53 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
return [];
|
2020-08-26 00:23:45 +03:00
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|