text: "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.UserSchema = void 0;
  const mongoose = require("mongoose");
  const bcrypt = require("bcrypt");
  exports.UserSchema = new mongoose.Schema({
      username: String,
      password: String,
      plateNumber: String,
      technician: {
          type: Boolean,
          default: false
      },
      driver: {
          type: Boolean,
          default: false,
      },
      created: {
          type: Date,
          default: Date.now,
      }
  });
  exports.UserSchema.pre('save', async function (next) {
      try {
          if (!this.isModified('password')) {
              return next();
          }
          const hashed = await bcrypt.hash(this['password'], 10);
          this['password'] = hashed;
          return next();
      }
      catch (err) {
          return next(err);
      }
  });
  mongoose.model('User', exports.UserSchema);
  //# sourceMappingURL=user.schema.js.map