aboutsummaryrefslogtreecommitdiff
path: root/models/feedback/feedback.schema.ts
diff options
context:
space:
mode:
Diffstat (limited to 'models/feedback/feedback.schema.ts')
-rw-r--r--models/feedback/feedback.schema.ts28
1 files changed, 28 insertions, 0 deletions
diff --git a/models/feedback/feedback.schema.ts b/models/feedback/feedback.schema.ts
new file mode 100644
index 0000000..a0844d6
--- /dev/null
+++ b/models/feedback/feedback.schema.ts
@@ -0,0 +1,28 @@
+import { Document, Schema, Types } from 'mongoose';
+
+export interface FeedbackSchema extends Document {
+ contents: string;
+ authorId: string;
+ score: number;
+ version: string;
+ createdAt: Date;
+}
+
+export const FeedbackSchema = new Schema({
+ contents: String,
+ authorId: {
+ type: Types.ObjectId,
+ required: true,
+ ref: 'User'
+ },
+ score: {
+ type: Number,
+ required: true
+ },
+ version: {
+ type: String,
+ match: /^v\d+\.\d+\.\d+$/,
+ required: true
+ }
+}, { timestamps: true });
+