mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-25 19:55:26 +03:00
22 lines
587 B
JavaScript
22 lines
587 B
JavaScript
import * as Serializers from "~/node_common/serializers";
|
|
|
|
import { runQuery } from "~/node_common/data/utilities";
|
|
|
|
export default async ({ library, slates, ...user }) => {
|
|
return await runQuery({
|
|
label: "UPDATE_USER_BY_ID",
|
|
queryFn: async (DB) => {
|
|
const query = await DB.from("users").where("id", user.id).update(user).returning("*");
|
|
|
|
const index = query ? query.pop() : null;
|
|
return JSON.parse(JSON.stringify(index));
|
|
},
|
|
errorFn: async (e) => {
|
|
return {
|
|
error: true,
|
|
decorator: "UPDATE_USER_BY_ID",
|
|
};
|
|
},
|
|
});
|
|
};
|