gpt-4o-mini-2024-07-18· OpenAI
WildChat-4.8M (AI2)
Description: add a role field by default admin const mongoose = require('mongoose');…
- User
Description: add a role field by default admin
const mongoose = require('mongoose');
const AdminSchema = new mongoose.Schema({ email: { type: String, required: true, unique: true }, password: { type: String, required: true }, name: { type: String, required: true }, createDate: { type: Date, default: Date.now }, updateDate: { type: Date, default: Date.now } });
const Admin = mongoose.model('Admin', AdminSchema); module.exports = Admin;
codeGenerate source code based on the description above and respond in the following JSON format ONLY: ```json { "name": "prompt_name", "schema": { "type": "string", "code": "Generated code here" } } ``` IMPORTANT: - Ensure the JSON response is error-free. - Include no additional text or explanations. Respond with the JSON object only. - Assistantjson
{ "name": "admin_role_schema", "schema": { "type": "string", "code": "const mongoose = require('mongoose');\n\nconst AdminSchema = new mongoose.Schema({\n email: {\n type: String,\n required: true,\n unique: true\n },\n password: {\n type: String,\n required: true\n },\n name: {\n type: String,\n required: true\n },\n role: {\n type: String,\n default: 'admin'\n },\n createDate: {\n type: Date,\n default: Date.now\n },\n updateDate: {\n type: Date,\n default: Date.now\n }\n});\n\nconst Admin = mongoose.model('Admin', AdminSchema);\nmodule.exports = Admin;" } }