/
Wizardd
/
Forms
Обзор
Документация
Войти
/
Wizardd
/
Forms
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
backend/models/Form.js
18 строк
692 B
Sontayr
add number,
16 июн 2025, 18:15
16 июн 2025, 18:15
31287a5
Код
Авторство
О чём код?
const mongoose = require('mongoose'); const QuestionSchema = new mongoose.Schema({ name: { type: String, required: true }, // новое поле type: { type: String, enum: ['text', 'dropdown', 'number', 'checkbox'], required: true }, label: { type: String, required: true }, options: [String] // для dropdown может быть null или массив }); const FormSchema = new mongoose.Schema({ title: { type: String, required: true }, description: { type: String, default: null }, questions: [QuestionSchema], creatorEmail: { type: String, required: true }, createdAt: { type: Date, default: Date.now } }); module.exports = mongoose.model('Form', FormSchema);