forked from premieroctet/openchakra
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sosynpl[premieroctet#132]: added question model and logic to get anno…
…unce/FAQ questions and answers
- Loading branch information
1 parent
b100e77
commit 95b2b68
Showing
3 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
backend/web/server/plugins/sosynpl/schemas/QuestionSchema.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const mongoose = require('mongoose') | ||
const { schemaOptions } = require('../../../utils/schemas') | ||
const Schema = mongoose.Schema | ||
|
||
const QuestionSchema = new Schema({ | ||
title: { | ||
type: String, | ||
required: [true, `Le titre est obligatoire`], | ||
}, | ||
answer: { | ||
type: String, | ||
required: false, | ||
}, | ||
tag: { | ||
type: String, | ||
required: false, | ||
}, | ||
announce: { | ||
type: Schema.Types.ObjectId, | ||
ref: 'announce', | ||
required: false, | ||
} | ||
}, { ...schemaOptions }) | ||
|
||
module.exports = QuestionSchema |