2020-08-26 00:23:45 +03:00
|
|
|
import { runQuery } from "~/node_common/data/utilities";
|
|
|
|
|
|
|
|
export default async ({ id }) => {
|
|
|
|
return await runQuery({
|
|
|
|
label: "GET_TRUSTED_RELATIONSHIP_BY_ID",
|
|
|
|
queryFn: async (DB) => {
|
2020-09-13 01:08:36 +03:00
|
|
|
const query = await DB.select("*").from("trusted").where({ id }).first();
|
2020-08-26 00:23:45 +03:00
|
|
|
|
|
|
|
if (!query || query.error) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (query.id) {
|
|
|
|
return JSON.parse(JSON.stringify(query));
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
},
|
|
|
|
errorFn: async (e) => {
|
|
|
|
return {
|
2020-09-13 01:08:36 +03:00
|
|
|
error: true,
|
|
|
|
decorator: "GET_TRUSTED_RELATIONSHIP_BY_ID",
|
2020-08-26 00:23:45 +03:00
|
|
|
};
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|