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