From d1ba0c30b79746392e4591bec4171d9073c6a315 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=A9o=20M=C3=A9vollon?= <38255502+Matmut7@users.noreply.github.com> Date: Wed, 9 Feb 2022 18:54:56 +0100 Subject: [PATCH] fix: generate id for matomo users (#50) * fix: generate id for matomo users * refactor: the trendy way --- src/services/data-fetchers.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/services/data-fetchers.ts b/src/services/data-fetchers.ts index f4b40b95..0cfc5f81 100644 --- a/src/services/data-fetchers.ts +++ b/src/services/data-fetchers.ts @@ -13,6 +13,7 @@ import { } from "@/utils/env" import fetcher from "@/utils/fetcher" import { getJwt } from "@/utils/jwt" +import { randomUUID } from "crypto" import { gql } from "graphql-request" import pMap from "p-map" import { setTimeout } from "timers/promises" @@ -94,7 +95,11 @@ export const matomo = async (): Promise => { body: `module=API&method=UsersManager.getUsers&format=json&token_auth=${MATOMO_API_TOKEN}`, } ) - return response.json() + const users: Record[] = await response.json() + return users.map((user) => ({ + ...user, + id: randomUUID(), + })) } const fetchNextcloudUser = async (login: string) => {