pt.model.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. 'PT',
  8. new Schema(
  9. {
  10. no_laporan: { type: String, unique: true },
  11. user: { type: Types.ObjectId, ref: user },
  12. pt: Object,
  13. keterangan: String,
  14. pelanggaran: [{ type: Types.ObjectId, ref: pelanggaran }],
  15. role_data: {
  16. type: String,
  17. enum: ['dikti', 'lldikti'],
  18. default: 'dikti',
  19. },
  20. status: String,
  21. aktif: { type: Boolean, default: true },
  22. dokumen: [
  23. {
  24. type: Types.ObjectId,
  25. ref: dokumen,
  26. },
  27. ],
  28. jadwal: {
  29. judul: String,
  30. dari_tanggal: Date,
  31. sampai_tanggal: Date,
  32. warna: String,
  33. },
  34. evaluasi: [
  35. new Schema(
  36. {
  37. tanggal: Date,
  38. judul: String,
  39. dokumen: [
  40. {
  41. type: Types.ObjectId,
  42. ref: dokumen,
  43. },
  44. ],
  45. },
  46. {
  47. timestamps: true,
  48. }
  49. ),
  50. ],
  51. },
  52. {
  53. timestamps: true,
  54. }
  55. ),
  56. 'pt'
  57. )