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 { export default interface IPost extends Document {
_id: ObjectId _id: ObjectId;
title: string title: string;
description: string description: string;
image: File | undefined | string image: File | undefined | string;
datetime: Date datetime: Date;
} user: ObjectId;
\ No newline at end of file }
import mongoose, { Schema } from "mongoose"; import mongoose, {Schema} from 'mongoose';
import IPost from "../interfaces/IPost"; import IPost from '../interfaces/IPost';
const PostsSchema: Schema = new Schema<IPost>({ const PostsSchema: Schema = new Schema<IPost>(
title: { {
type: String, title: {
required: true type: String,
}, required: true,
description: { },
type: String, description: {
required: false type: String,
}, },
image: String, image: {
datetime: { type: String,
type: Date, },
default: Date.now() datetime: {
} type: Date,
}, { default: Date.now,
versionKey: false required: true,
}) },
user: {
type: Schema.Types.ObjectId,
required: true,
},
},
{
versionKey: false,
}
);
export const Post = mongoose.model<IPost>('Post', PostsSchema) export const Post = mongoose.model<IPost>('Post', PostsSchema);
\ No newline at end of file
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