/
SheetModel.ts
64 lines (59 loc) 路 1.22 KB
/
SheetModel.ts
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
import { Schema, model } from "mongoose";
import type { Document } from "mongoose";
type ISheet = {
title: string;
sheetId: string;
sheetUrl: string;
createdBy: string;
groupId: string;
isListening: boolean;
removedAt: Date;
};
export type SheetDocument = Document & ISheet;
const SheetSchema = new Schema<SheetDocument>(
{
title: {
type: String,
required: true,
index: true,
description: "Sheets title",
},
groupId: {
type: String,
required: true,
description: "Sheets groupId",
},
sheetId: {
type: String,
required: true,
description: "Sheets sheetsId",
},
sheetUrl: {
type: String,
required: true,
description: "Sheets sheetsUrl",
},
createdBy: {
type: String,
required: true,
description: "Sheets createdBy",
},
isListening: {
type: Boolean,
required: true,
default: true,
description: "Sheets isListening",
},
removedAt: {
type: Date,
index: true,
default: null,
},
},
{
collection: "Sheet",
timestamps: true,
}
);
export const SheetModel = model<SheetDocument>("Sheet", SheetSchema);
export default SheetModel;