mirror of
https://github.com/filecoin-project/slate.git
synced 2024-12-21 16:11:58 +03:00
26 lines
598 B
JavaScript
26 lines
598 B
JavaScript
import * as Serializers from "~/common/serializers";
|
|
|
|
import { runQuery } from "~/node_common/data/utilities";
|
|
|
|
export default async () => {
|
|
return await runQuery({
|
|
label: "GET_EVERY_USER",
|
|
queryFn: async (DB) => {
|
|
const r = await DB.select("id", "username", "data").from("users");
|
|
|
|
if (!r || r.error) {
|
|
return [];
|
|
}
|
|
|
|
const sanitized = r.map((each) => Serializers.user(each));
|
|
return JSON.parse(JSON.stringify(sanitized));
|
|
},
|
|
errorFn: async (e) => {
|
|
return {
|
|
error: "GET_EVERY_USER",
|
|
source: e,
|
|
};
|
|
},
|
|
});
|
|
};
|