Dilan1991

Untitled

Mar 21st, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. //Model untuk pengguna sebagai siswa
  2. var mongoose = require('mongoose');
  3.  
  4. var connection = require('../../database/connection')
  5.  
  6. var Schema = mongoose.Schema;
  7.  
  8. var UserSchema = Schema({
  9. email: {type: String, min: 1, max: 100, required: true},
  10. sandi: {type: String, min: 1, max: 100, required: true},
  11. peran: {type: Number, required: true},
  12. mengajar: [
  13. {
  14. kelas:{type: Schema.ObjectId, ref: 'kelas'},
  15. mapel:{type: Schema.ObjectId, ref: 'mapel'}
  16. }
  17. ],
  18.  
  19. RFID_card : {
  20. serial_number : {type : String,default : "-"},
  21. status : {type : String, default : "Non Aktif"}
  22. },
  23. Class_data : {
  24. kelas : [{type: mongoose.Schema.Types.ObjectId, ref: 'kelas', default: '-'}],
  25. tahun_ajaran :{type : String , require : true}
  26. },
  27. Sekolah_data : {
  28. sekolah_id : {type : String,require : true},
  29. tahun_ajaran : {type : String,require : true}
  30. },
  31. profil : {
  32. username: {type: String, min: 1, max: 100, required: true},
  33. nama_lengkap: {type: String, min: 1, max: 100, required: true},
  34. jenis_kelamin: {type: String, min: 1, max: 100, required: true},
  35. foto: {type: String, min: 1, max: 100, default: 'http://filehosting.pptik.id/TESISS2ITB/Vidyanusa/default-profile-picture.png'},
  36. bio: {type: String, min: 1, max: 100, default: '-'}
  37. }
  38. },{collection: 'pengguna'});
  39.  
  40. module.exports = connection.sekolah_vidyanusa().model('pengguna', UserSchema);
Advertisement
Add Comment
Please, Sign In to add comment