Skip to content
This repository has been archived by the owner on Nov 29, 2021. It is now read-only.

Commit

Permalink
feat: update @field(() => String)
Browse files Browse the repository at this point in the history
  • Loading branch information
YanceyOfficial committed Mar 28, 2020
1 parent 94f3f01 commit f846b6b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion schema.gql
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ type Mutation {
register(input: RegisterInput!): UserModel!
createTOTP(userId: ID!): TOTPModel!
validateTOTP(input: ValidateTOTPInput!): UserModel!
createRecoveryCodes(input: ValidateTOTPInput!): UserModel!
createRecoveryCodes(userId: ID!): RecoveryCodeModel!
validateRecoveryCode(input: ValidateTOTPInput!): UserModel!
createAnnouncement(input: CreateAnnouncementInput!): AnnouncementModel!
updateAnnouncementById(input: UpdateAnnouncementInput!): AnnouncementModel!
Expand Down Expand Up @@ -196,6 +196,10 @@ type Query {
getAgenda: [AgendaModel!]!
}

type RecoveryCodeModel {
recoveryCodes: String!
}

input RegisterInput {
email: String!
username: String!
Expand Down Expand Up @@ -347,6 +351,7 @@ type UserModel {
phoneNumber: String!
isTOTP: Boolean!
twoFactorSecret: String!
recoveryCodes: String!
createdAt: DateTime!
updatedAt: DateTime!
}
Expand Down
2 changes: 1 addition & 1 deletion src/auth/models/recovery-code.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { IsArray } from 'class-validator'

@ObjectType()
export class RecoveryCodeModel {
@Field()
@Field(() => String)
@IsArray()
public readonly recoveryCodes: string[]
}
2 changes: 1 addition & 1 deletion src/users/models/User.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class UserModel {
@Field()
public readonly twoFactorSecret: string

@Field()
@Field(() => String)
public readonly recoveryCodes: string[]

@Field()
Expand Down
2 changes: 1 addition & 1 deletion src/users/schemas/users.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const UserSchema = new mongoose.Schema(
required: false,
},
recoveryCodes: {
type: String,
type: Array,
required: false,
},
},
Expand Down

0 comments on commit f846b6b

Please sign in to comment.