Some changes
This commit is contained in:
43
server/src/models/appointment.js
Normal file
43
server/src/models/appointment.js
Normal 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);
|
||||
@@ -1,33 +0,0 @@
|
||||
import mongoose from 'mongoose';
|
||||
import timestamps from 'mongoose-timestamp';
|
||||
import { composeWithMongoose } from 'graphql-compose-mongoose';
|
||||
|
||||
export const TaskSchema = new mongoose.Schema(
|
||||
{
|
||||
user: {
|
||||
type: mongoose.Schema.Types.ObjectId,
|
||||
ref: 'User',
|
||||
required: true,
|
||||
},
|
||||
task: {
|
||||
type: String,
|
||||
trim: true,
|
||||
required: true,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
trim: true,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
collection: 'tasks',
|
||||
}
|
||||
);
|
||||
|
||||
TaskSchema.plugin(timestamps);
|
||||
|
||||
TaskSchema.index({ createdAt: 1, updatedAt: 1 });
|
||||
|
||||
export const Task = mongoose.model('Task', TaskSchema);
|
||||
export const TaskTC = composeWithMongoose(Task);
|
||||
@@ -4,18 +4,33 @@ import { composeWithMongoose } from 'graphql-compose-mongoose';
|
||||
|
||||
export const UserSchema = new mongoose.Schema(
|
||||
{
|
||||
name: {
|
||||
firstName: {
|
||||
type: String,
|
||||
trim: true,
|
||||
required: true,
|
||||
},
|
||||
|
||||
lastName: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
|
||||
password: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
|
||||
email: {
|
||||
type: String,
|
||||
lowercase: true,
|
||||
trim: true,
|
||||
unique: true,
|
||||
required: true,
|
||||
},
|
||||
|
||||
isActive: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
default: 1
|
||||
},
|
||||
},
|
||||
{
|
||||
collection: 'users',
|
||||
|
||||
Reference in New Issue
Block a user