post.model.ts 568 Bytes
Newer Older
Kim, MinGyu's avatar
Kim, MinGyu committed
1
2
import { model, Schema } from "mongoose";

Lee Soobeom's avatar
.    
Lee Soobeom committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
export interface PostType extends PostingType {
  date?: string;
  counts: number;
  id?: string;
}

export interface PostingType {
  title: string;
  text?: string;
  theme: string;
  city: string;
  username: string;
}

Kim, MinGyu's avatar
Kim, MinGyu committed
17
const schema = new Schema<PostType>({
Lee Soobeom's avatar
.    
Lee Soobeom committed
18
19
20
21
22
23
24
25
  id: { type: String },
  title: { type: String },
  date: { type: Date },
  text: { type: String },
  counts: { type: Number },
  theme: { type: String },
  city: { type: String },
  username: { type: String },
Kim, MinGyu's avatar
Kim, MinGyu committed
26
27
28
});

export default model<PostType>("Post", schema);