mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-28 05:52:49 +03:00
23 lines
581 B
JavaScript
23 lines
581 B
JavaScript
import { runQuery } from "~/node_common/data/utilities";
|
|
|
|
export default async ({ id, data }) => {
|
|
return await runQuery({
|
|
label: "UPDATE_TRUSTED_RELATIONSHIP_BY_ID",
|
|
queryFn: async (DB) => {
|
|
const response = await DB.from("trusted")
|
|
.where("id", id)
|
|
.update({ data })
|
|
.returning("*");
|
|
|
|
const index = response ? response.pop() : null;
|
|
return JSON.parse(JSON.stringify(index));
|
|
},
|
|
errorFn: async (e) => {
|
|
return {
|
|
error: true,
|
|
decorator: "UPDATE_TRUSTED_RELATIONSHIP_BY_ID",
|
|
};
|
|
},
|
|
});
|
|
};
|