laporan.model.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. const mongoose = require('mongoose')
  2. const { Schema, Types } = mongoose
  3. const user = require('./user.model')
  4. const dokumen = require('./dokumen.model')
  5. const pelanggaran = require('./pelanggaran.model')
  6. module.exports = mongoose.model(
  7. 'Laporan',
  8. new Schema(
  9. {
  10. no_laporan: { type: String, unique: true },
  11. user: { type: Types.ObjectId, ref: user },
  12. sanksi: { type: Types.ObjectId },
  13. pt: Object,
  14. keterangan: String,
  15. pelanggaran: [{ type: Types.ObjectId, ref: pelanggaran }],
  16. role_data: {
  17. type: String,
  18. enum: ['dikti', 'lldikti'],
  19. default: 'dikti',
  20. },
  21. // status: String,
  22. aktif: { type: Boolean, default: true },
  23. dokumen: [
  24. {
  25. type: Types.ObjectId,
  26. ref: dokumen,
  27. },
  28. ],
  29. jadwal: {
  30. judul: String,
  31. dari_tanggal: Date,
  32. sampai_tanggal: Date,
  33. warna: String,
  34. },
  35. evaluasi: [
  36. new Schema(
  37. {
  38. judul: String,
  39. tanggal: Date,
  40. dokumen: [
  41. {
  42. type: Types.ObjectId,
  43. ref: dokumen,
  44. },
  45. ],
  46. },
  47. {
  48. timestamps: true,
  49. }
  50. ),
  51. ],
  52. },
  53. {
  54. timestamps: true,
  55. }
  56. ),
  57. 'laporan'
  58. )