2020-08-26 00:23:45 +03:00
|
|
|
import { runQuery } from "~/node_common/data/utilities";
|
|
|
|
|
|
|
|
export default async ({ userId }) => {
|
|
|
|
return await runQuery({
|
|
|
|
label: "GET_TRUSTED_RELATIONSHIPS_BY_USER_ID",
|
|
|
|
queryFn: async (DB) => {
|
|
|
|
const query = await DB.select("*")
|
|
|
|
.from("trusted")
|
|
|
|
.where({ owner_user_id: userId });
|
|
|
|
|
|
|
|
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-09-13 01:08:36 +03:00
|
|
|
error: true,
|
|
|
|
decorator: "GET_TRUSTED_RELATIONSHIPS_BY_USER_ID",
|
2020-09-01 02:47:53 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
return [];
|
2020-08-26 00:23:45 +03:00
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|