invite codes: fixed typo, createdAt and ID is required

This commit is contained in:
Moriz Wahl 2021-01-19 17:15:28 +01:00
parent a98170487b
commit f34f66fe82
2 changed files with 5 additions and 5 deletions

View File

@ -1,4 +1,4 @@
import generateInvieCode from './helpers/generateInviteCode'
import generateInviteCode from './helpers/generateInviteCode'
import Resolver from './helpers/Resolver'
const uniqueInviteCode = async (session, code) => {
@ -66,9 +66,9 @@ export default {
user: { id: userId },
} = context
const session = context.driver.session()
let code = generateInvieCode()
let code = generateInviteCode()
while (!(await uniqueInviteCode(session, code))) {
code = generateInvieCode()
code = generateInviteCode()
}
const writeTxResultPromise = session.writeTransaction(async (txc) => {
const result = await txc.run(

View File

@ -1,6 +1,6 @@
type InviteCode {
code: ID!
createdAt: String
createdAt: String!
generatedBy: User @relation(name: "GENERATED", direction: "IN")
redeemedBy: [User] @relation(name: "REDEEMED", direction: "IN")
expiresAt: String
@ -13,5 +13,5 @@ type Mutation {
type Query {
MyInviteCodes: [InviteCode]
isValidInviteCode(code: ID): Boolean
isValidInviteCode(code: ID!): Boolean
}