travomate / travomate-backend

this is the TravoMate App backend part
0 stars 0 forks source link

User Registration #9

Open nindaba opened 7 months ago

nindaba commented 7 months ago

User Registration: Users can sign up by providing their personal details. User Schema should look like this:

UserSchema


  firstName:{ 
    type:String ,
    required: true,
  },  
  lastName:{ 
    type:String ,
    required: true,
  }, 
  Title: {
    type: String,
    enum: ['Mister','Miss'],
    // make it required
  }, 
  email: { 
    type: String,
    unique: true,
    required: true,
  },
  isEmailVerified: {
    type: Boolean,
    default: false,
  },
  password: {
    type: String,
    required: true,
  }, 
  profilePhoto: {
    type:String
  }, 
  identityDocPhoto: {
    type: String,
  },
  identityDocType: {
    type: String,
    enum: ['ID card','Passport']
  },
  isIdentityDocVerified: {
    type: Boolean,
    default: false
  },
  phoneNumber: {
    type: String,
  },
  isPhoneNumberVerified: {
    type: Boolean,
    default: false
  },
  faceBookAccount: {
    type: String,
  },
  isFaceBookAccountVerified: {
    type: Boolean,
    default: false
  },
  addresss:{ 
    type:String
  },
  gender: {
    type: String,
    enum: ['male','female']
  },
  birthDate:{ 
    type:Date
  },
  nationality:{ 
    type:String
  },
  preferredCurrency:{ 
    type:String,
    default: 'USD'
  },
  isVerified: {
    type: Boolean,
    default: false,
  },
  isVerifiedTicket: {
    type: Boolean,
    default: true,
  },
  memberSince: {
    type: Date,
    default: Date.now,
  },

  trips: [{
    type: mongoose.Types.ObjectId,
    ref: 'Flight',
    required: true
  }],
  bookings: [
    {
      type: mongoose.Types.ObjectId,
      ref: "User",
    },
  ],

  tokens:[{type: Object}]

} 
nindaba commented 7 months ago

@fredrukundo wandebeye, ibikenewe ahangaha, washiramwo nka example ya schema uriko uratanga for user registration

fredrukundo commented 7 months ago

kanze mbikore and i will see if i can provide some screenshots too

travomate commented 7 months ago

example of a user trying to register: User Registration:



    "firstName": "amine",
  "lastName": "amin",
  "Title": "Mister",
  "email": "amine@gmail.com",
  "password": "12345678",
  "repeatPassword": "12345678",
  "profilePhoto": "photo.jpg",
  "identityDocPhoto": "pssport.jpg",
  "identityDocType": "Passport",
  "phoneNumber": "1234567890",
  "faceBookAccount": "https://www.facebook.com/john.doe",
  "addresss": "123 Main Street",
  "gender": "male",
  "birthDate": "1990-08-15",
  "nationality": "Rwanda",
  "preferredCurrency": "USD",
  "isVerified": false,
  "isVerifiedTicket": true

}