12345678910111213141516171819202122 |
- const User = require('./schemas/user');
- const findByNumber = async (number) => {
- return await User.findOne({ number });
- };
- const findById = async (id) => {
- return await User.findById(id);
- };
- const createUser = async (body) => {
- const user = new User({ ...body });
- return await user.save();
- };
- const updateUser = async (id, obj) => {
- return await User.updateOne({ _id: id }, { ...obj });
- };
- module.exports = {
- findByNumber,
- createUser,
- updateUser,
- findById,
- };
|