From 6dbb59ba94dc5e68938475b08cce0fe87fcb1e71 Mon Sep 17 00:00:00 2001 From: frab1t <33671357+frab1t@users.noreply.github.com> Date: Thu, 4 Jul 2019 08:50:47 +0200 Subject: [PATCH] feat(database): add tickets model --- src/models/tickets.js | 66 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 src/models/tickets.js diff --git a/src/models/tickets.js b/src/models/tickets.js new file mode 100644 index 0000000..0affa4e --- /dev/null +++ b/src/models/tickets.js @@ -0,0 +1,66 @@ +const mongoose = require('mongoose'); +const mongoosePaginate = require('mongoose-paginate-v2'); + +// Define a schema +const { Schema } = mongoose; + +const TicketSchema = new Schema({ + ticketId: { + type: String, + required: true, + }, + status: { + type: String, + trim: true, + required: true, + }, + created: { + type: Date, + trim: true, + required: true, + }, + updated: { + type: Date, + trim: true, + required: true, + }, + firstName: { + type: String, + trim: true, + required: true, + }, + lastName: { + type: String, + trim: true, + required: true, + }, + email: { + type: String, + trim: true, + required: true, + }, + type: { + type: String, + trim: true, + required: true, + }, + subject: { + type: String, + trim: true, + required: true, + }, + message: { + type: String, + trim: true, + required: true, + }, + note: { + type: String, + trim: true, + }, +}); + +TicketSchema.plugin(mongoosePaginate); + + +export default mongoose.model('Ticket', TicketSchema);