2020-08-28 07:34:50 +03:00
|
|
|
import * as Serializers from "~/node_common/serializers";
|
2020-08-28 01:05:20 +03:00
|
|
|
|
|
|
|
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) => {
|
2020-09-01 02:47:53 +03:00
|
|
|
console.log({
|
2020-09-13 01:08:36 +03:00
|
|
|
error: true,
|
|
|
|
decorator: "GET_EVERY_USER",
|
2020-09-01 02:47:53 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
return [];
|
2020-08-28 01:05:20 +03:00
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|