var { admin } = require("./server/firebase/firebase-handler");

const uidToMakeAdmin = "fIaZcVQQfUR12Fu14I2fyA5vXbp1";

admin
  .auth()
  .getUser(uidToMakeAdmin)
  .then((user) => {
    admin
      .auth()
      .setCustomUserClaims(uidToMakeAdmin, {
        ...user.customClaims,
        "https://hasura.io/jwt/claims": {
          "x-hasura-default-role": "admin",
          "x-hasura-allowed-roles": ["admin"],
          "x-hasura-user-id": uidToMakeAdmin
        },
        ioadmin: true
      })
      .then(() => console.log("Success."))
      .catch((error) => console.log("Error updating claims.", error));
  })
  .catch((error) => console.log("Error fetching user.", error));
