Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const mongoose = require('mongoose');
- const Schema = mongoose.Schema;
- const CategoryScheme = new Schema({
- name: {
- type: String,
- default: '',
- required: true,
- },
- slug: {
- type: String,
- default: '',
- required: true,
- unique: true,
- },
- });
- const Category = mongoose.model('category', CategoryScheme);
- module.exports.Category = Category;
- module.exports.Schema = CategoryScheme;
- const mongoose = require('mongoose');
- const Schema = mongoose.Schema;
- const TagScheme = new Schema({
- name: {
- type: String,
- default: '',
- required: true,
- },
- slug: {
- type: String,
- default: '',
- required: true,
- unique: true,
- },
- });
- const Tag = mongoose.model('tag', TagScheme);
- module.exports.Tag = Tag;
- module.exports.Schema = TagScheme;
- const mongoose = require('mongoose');
- const Schema = mongoose.Schema;
- const JobSchema = new Schema({
- title: {
- type: String,
- default: '',
- required: true,
- },
- description: {
- type: String,
- default: '',
- required: true,
- },
- tags: {
- type: Schema.ObjectId,
- ref: 'tag',
- required: true,
- default: [],
- },
- category: {
- type: Schema.ObjectId,
- ref: 'category',
- required: true,
- },
- experienceLevel: {
- type: String,
- required: true,
- enum: ['Entry level', 'Intermediate', 'Expert']
- },
- createdAt: {
- type: Date,
- default: Date.now
- },
- updateAt: {
- type: Date,
- default: Date.now
- }
- });
- const Job = mongoose.model('job', JobSchema);
- module.exports.Job = Job;
- module.exports.Schema = JobSchema;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement