Some changes

This commit is contained in:
Riccardo
2021-01-03 15:32:12 +01:00
parent 9641e4f7e3
commit 8dd59ae64b
6 changed files with 115 additions and 63 deletions

View File

@@ -0,0 +1,43 @@
import mongoose from 'mongoose';
import timestamps from 'mongoose-timestamp';
import { composeWithMongoose } from 'graphql-compose-mongoose';
export const AppointmentSchema = new mongoose.Schema(
{
user: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User',
required: true,
},
title: {
type: String,
required: true,
},
description: {
type: String,
required: true,
},
timeStart: {
type: Date,
required: true,
},
timeEnd: {
type: Date,
required: true,
},
},
{
collection: 'appointment',
}
);
AppointmentSchema.plugin(timestamps);
AppointmentSchema.index({ createdAt: 1, updatedAt: 1 });
export const Appointment = mongoose.model('Appointment', AppointmentSchema);
export const AppointmentTC = composeWithMongoose(Appointment);