mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
invite codes: fixed typo, createdAt and ID is required
This commit is contained in:
parent
a98170487b
commit
f34f66fe82
@ -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(
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user