To access the Admin section which includes the Event Create Menu, there would be a need to setup the Superprofile, currently we use FaunaDB for handling this.
Follow this link instructions to get the Fauna key, then paste it in the .env
as:
NEXT_PUBLIC_FAUNA_SECRET="your private key"
To get more familiar with Fauna here is a quick short workshop link
Or here is a quick guide to get started with Fauna:
- Head to dashboard.fauna.com, if you are logged in, click CREATE DATABASE, choose the US server.
UpsertUser function
Query(
Lambda(
["uid", "email", "displayName", "phoneNumber", "photoURL"],
Let(
{
user: Match(Index("getByEmail"), Var("email")),
upsert: If(
Exists(Var("user")),
Update(Select(["ref"], Get(Var("user"))), {
data: {
displayName: Var("displayName"),
phoneNumber: Var("phoneNumber"),
photoURL: Var("photoURL")
}
}),
Create(Collection("User"), {
data: {
uid: Var("uid"),
email: Var("email"),
displayName: Var("displayName"),
phoneNumber: Var("phoneNumber"),
photoURL: Var("photoURL")
}
})
)
},
Var("upsert")
)
)
)
- Under the Security tab click on NEW KEY no need to modify anything, go with defaults, then hit the SAVE, copy the KEY'S SECRET and paste it in the
.env
as:
NEXT_PUBLIC_FAUNA_SECRET="your key's secret"
NEXT_PUBLIC_FAUNA_DOMAIN="https://graphql.us.fauna.com/graphql"
- Create the first basic user using the GraphQL tab, following is the mutation schema of a GraphQL query to create a user
mutation {
createUser(data: {
displayName: "YOUR_NAME"
email: "NEXT_PUBLIC_EVENT_ADMIN_MAIL"
uid: "ANY_UNIQUE_NUMBER"
rc4conf: {
create: {
role: "Admin"
email: "NEXT_PUBLIC_EVENT_ADMIN_MAIL"
}
}
}) {
_id
displayName
}
}
- Congrats! and thank you! for reading this. With this you are all set, to access Admin menus.