mirror of
https://github.com/filecoin-project/slate.git
synced 2024-12-18 06:22:25 +03:00
25 lines
540 B
JavaScript
25 lines
540 B
JavaScript
import { runQuery } from "~/node_common/data/utilities";
|
|
|
|
export default async ({ data, owner_user_id }) => {
|
|
return await runQuery({
|
|
label: "CREATE_PENDING_DATA",
|
|
queryFn: async (DB) => {
|
|
const query = await DB.insert({
|
|
data,
|
|
owner_user_id,
|
|
})
|
|
.into("pending")
|
|
.returning("*");
|
|
|
|
const index = query ? query.pop() : null;
|
|
return index;
|
|
},
|
|
errorFn: async (e) => {
|
|
return {
|
|
error: true,
|
|
decorator: "CREATE_PENDING_DATA",
|
|
};
|
|
},
|
|
});
|
|
};
|