(input: DocumentDefinition<UserDocument>)
| 3 | import User, { UserDocument } from "../model/user.model"; |
| 4 | |
| 5 | export async function createUser(input: DocumentDefinition<UserDocument>) { |
| 6 | try { |
| 7 | return await User.create(input); |
| 8 | } catch (error) { |
| 9 | throw new Error(error); |
| 10 | } |
| 11 | } |
| 12 | |
| 13 | export async function findUser(query: FilterQuery<UserDocument>) { |
| 14 | return User.findOne(query).lean(); |