Skip to content

Commit

Permalink
fix nodemon issue. remove unused user fields
Browse files Browse the repository at this point in the history
  • Loading branch information
TrillCyborg committed Jun 4, 2019
1 parent 37ed114 commit b8c6028
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 34 deletions.
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"start": "ts-node src/index.ts",
"watch": "nodemon -e ts -w ./src -x npm run watch:serve",
"watch:serve": "ts-node --inspect src/index.ts"
"watch:serve": "ts-node src/index.ts"
},
"devDependencies": {
"@babel/preset-env": "^7.4.5",
Expand Down
13 changes: 6 additions & 7 deletions server/schema.gql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ The javascript `Date` as string. Type represents date and time as the ISO Date s
"""
scalar DateTime

type Profile {
firstName: String!
lastName: String!
}

type Query {
me: User!
getUser(userId: ID!): User!
Expand All @@ -20,14 +25,8 @@ enum Role {

type User {
_id: ID!
sessionId: String!
profile: Profile!
roles: [Role!]!
phoneNumber: String!
username: String
ethAddress: String
smsToken: String
isBlocked: Boolean
isPhoneVerified: Boolean
isOnboarded: Boolean
createdAt: DateTime!
updatedAt: DateTime!
Expand Down
40 changes: 14 additions & 26 deletions server/src/modules/user/UserEntity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,32 @@ import { prop, Typegoose } from 'typegoose'
import { ObjectType, Field, ID } from 'type-graphql'
import { ObjectId } from 'mongodb'
import { Role } from './consts'
import { PromiseProvider } from 'mongoose'

@ObjectType()
class Profile {
@prop()
@Field()
firstName: string

@prop()
@Field()
lastName: string
}

@ObjectType()
export class User extends Typegoose {
@Field(type => ID)
readonly _id: ObjectId

@prop()
@Field()
sessionId?: string
@Field(type => Profile)
profile: Profile

@prop({ required: true, enum: Role })
@Field(type => Role)
roles: Role[]

@prop({ required: true })
@Field()
phoneNumber: string

@prop({ lowercase: true })
@Field({ nullable: true })
username?: string

@prop({ lowercase: true })
@Field({ nullable: true })
ethAddress?: string

@prop()
@Field({ nullable: true })
smsToken?: string

@prop()
@Field({ nullable: true })
isBlocked?: boolean

@prop()
@Field({ nullable: true })
isPhoneVerified?: boolean

@prop()
@Field({ nullable: true })
isOnboarded?: boolean
Expand Down

0 comments on commit b8c6028

Please sign in to comment.