Commit 0701dfb0 authored by Болатов Ален's avatar Болатов Ален

Merge branch '21' into 'dev'

some changes

See merge request !22
parents 4ba578d4 6e0a4fa8
import { Document, ObjectId } from "mongoose";
import {Document, ObjectId} from 'mongoose';
export default interface IPost extends Document {
_id: ObjectId
title: string
description: string
image: File | undefined | string
datetime: Date
}
\ No newline at end of file
_id: ObjectId;
title: string;
description: string;
image: File | undefined | string;
datetime: Date;
user: ObjectId;
}
import mongoose, { Schema } from "mongoose";
import IPost from "../interfaces/IPost";
import mongoose, {Schema} from 'mongoose';
import IPost from '../interfaces/IPost';
const PostsSchema: Schema = new Schema<IPost>({
title: {
type: String,
required: true
},
description: {
type: String,
required: false
},
image: String,
datetime: {
type: Date,
default: Date.now()
}
}, {
versionKey: false
})
const PostsSchema: Schema = new Schema<IPost>(
{
title: {
type: String,
required: true,
},
description: {
type: String,
},
image: {
type: String,
},
datetime: {
type: Date,
default: Date.now,
required: true,
},
user: {
type: Schema.Types.ObjectId,
required: true,
},
},
{
versionKey: false,
}
);
export const Post = mongoose.model<IPost>('Post', PostsSchema)
\ No newline at end of file
export const Post = mongoose.model<IPost>('Post', PostsSchema);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment