Skip to content

Commit

Permalink
Require invite limit
Browse files Browse the repository at this point in the history
  • Loading branch information
ekzyis committed Dec 23, 2024
1 parent fd58337 commit f27be13
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion api/typeDefs/invite.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default gql`
}
extend type Mutation {
createInvite(id: String, gift: Int!, limit: Int, description: String): Invite
createInvite(id: String, gift: Int!, limit: Int!, description: String): Invite
revokeInvite(id: ID!): Invite
}
Expand Down
2 changes: 1 addition & 1 deletion lib/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ export const bioSchema = object({

export const inviteSchema = object({
gift: intValidator.positive('must be greater than 0').required('required'),
limit: intValidator.positive('must be positive').nullable(),
limit: intValidator.positive('must be positive'),
description: string().trim().max(40, 'must be at most 40 characters'),
id: string().matches(/^[\w-_]+$/, 'only letters, numbers, underscores, and hyphens').min(8, 'must be at least 8 characters').max(32, 'must be at most 32 characters')
})
Expand Down
6 changes: 3 additions & 3 deletions pages/invites/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function InviteForm () {
const [createInvite] = useMutation(
gql`
${INVITE_FIELDS}
mutation createInvite($id: String, $gift: Int!, $limit: Int, $description: String) {
mutation createInvite($id: String, $gift: Int!, $limit: Int!, $description: String) {
createInvite(id: $id, gift: $gift, limit: $limit, description: $description) {
...InviteFields
}
Expand Down Expand Up @@ -57,7 +57,7 @@ function InviteForm () {
variables: {
id: id || undefined,
gift: Number(gift),
limit: limit ? Number(limit) : null,
limit: Number(limit),
description: description || undefined
}
})
Expand All @@ -72,7 +72,7 @@ function InviteForm () {
required
/>
<Input
label={<>invitee limit <small className='text-muted ms-2'>optional</small></>}
label='invitee limit'
name='limit'
/>
<AccordianItem
Expand Down

0 comments on commit f27be13

Please sign in to comment.