Skip to content

Instantly share code, notes, and snippets.

@nparsons08 nparsons08/task.js Secret
Last active Nov 3, 2019

Embed
What would you like to do?
import mongoose, { Schema } from 'mongoose';
import timestamps from 'mongoose-timestamp';
import { composeWithMongoose } from 'graphql-compose-mongoose';
export const TaskSchema = new Schema(
{
user: {
type: 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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.