post.model.ts 461 Bytes
Newer Older
Lee Soobeom's avatar
Lee Soobeom committed
1
2
import { model, Schema, Types } from "mongoose";
import { PostingType } from "./posting.model";
Kim, MinGyu's avatar
Kim, MinGyu committed
3

Lee Soobeom's avatar
.    
Lee Soobeom committed
4
5
6
7
8
9
export interface PostType extends PostingType {
  date?: string;
  counts: number;
  id?: string;
}

Lee Soobeom's avatar
Lee Soobeom committed
10
const postSchema = new Schema<PostType>({
Lee Soobeom's avatar
.    
Lee Soobeom committed
11
12
13
14
  title: { type: String },
  theme: { type: String },
  city: { type: String },
  username: { type: String },
Lee Soobeom's avatar
Lee Soobeom committed
15
16
  date: { type: String },
  counts: { type: Number },
Kim, MinGyu's avatar
Kim, MinGyu committed
17
18
});

Lee Soobeom's avatar
Lee Soobeom committed
19
export default model<PostType>("Post", postSchema);