-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblog.schema.ts
More file actions
70 lines (68 loc) · 1.19 KB
/
blog.schema.ts
File metadata and controls
70 lines (68 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import { Schema } from "mongoose";
export interface IBlog {
_id: string;
id: number;
title: {
en: string;
fr: string;
};
excerpt: {
en: string;
fr: string;
};
content: {
en: string;
fr: string;
};
image: string;
date: string;
readTime: string;
category: string;
tags: string[];
color: string;
featured: boolean;
published: boolean;
createdAt: Date;
updatedAt: Date;
}
export const blogSchema = new Schema<IBlog>(
{
id: {
type: Number,
required: true,
unique: true,
},
title: {
en: { type: String, required: true },
fr: { type: String, required: true },
},
excerpt: {
en: { type: String, required: true },
fr: { type: String, required: true },
},
content: {
en: { type: String, required: true },
fr: { type: String, required: true },
},
image: {
type: String,
required: true,
},
date: String,
readTime: String,
category: String,
tags: [String],
color: String,
featured: {
type: Boolean,
default: false,
},
published: {
type: Boolean,
default: true,
},
},
{
timestamps: true,
}
);