摘要: CrudController: 查看代码 export const getOne = model => async (req, res) => { try { const doc = model .findOne({ createdBy: req.user._id, _id: req.params. 阅读全文
posted @ 2022-08-23 19:25 Zhentiw 阅读(21) 评论(0) 推荐(0) 编辑
摘要: Each model controller: import { crudControllers } from '../../utils/crud' import { Item } from './item.model' export default crudControllers(Item) You 阅读全文
posted @ 2022-08-23 19:23 Zhentiw 阅读(11) 评论(0) 推荐(0) 编辑
摘要: Model: import mongoose from 'mongoose' const itemSchema = new mongoose.Schema( { name: { type: String, required: true, trim: true, maxlength: 50 }, st 阅读全文
posted @ 2022-08-23 19:20 Zhentiw 阅读(13) 评论(0) 推荐(0) 编辑