Some progress
This commit is contained in:
@@ -1,43 +0,0 @@
|
||||
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);
|
||||
12
server/src/models/product.js
Normal file
12
server/src/models/product.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import mongoose from 'mongoose';
|
||||
const Schema = mongoose.Schema;
|
||||
const ProductSchema = new Schema({
|
||||
title: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
qty: {
|
||||
type: Number
|
||||
}
|
||||
});
|
||||
export default mongoose.model('product', ProductSchema);
|
||||
@@ -1,45 +0,0 @@
|
||||
import mongoose from 'mongoose';
|
||||
import timestamps from 'mongoose-timestamp';
|
||||
import { composeWithMongoose } from 'graphql-compose-mongoose';
|
||||
|
||||
export const UserSchema = new mongoose.Schema(
|
||||
{
|
||||
firstName: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
|
||||
lastName: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
|
||||
password: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
|
||||
email: {
|
||||
type: String,
|
||||
lowercase: true,
|
||||
unique: true,
|
||||
required: true,
|
||||
},
|
||||
|
||||
isActive: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
default: 1
|
||||
},
|
||||
},
|
||||
{
|
||||
collection: 'users',
|
||||
}
|
||||
);
|
||||
|
||||
UserSchema.plugin(timestamps);
|
||||
|
||||
UserSchema.index({ createdAt: 1, updatedAt: 1 });
|
||||
|
||||
export const User = mongoose.model('User', UserSchema);
|
||||
export const UserTC = composeWithMongoose(User);
|
||||
Reference in New Issue
Block a user