Implementar modulo de Roles y Usuarios

This commit is contained in:
2026-06-02 23:19:34 +00:00
parent 8b306b9afc
commit c6f3f3d135
17 changed files with 405 additions and 2 deletions

View File

@ -0,0 +1,46 @@
import userModel from "./user.model";
export class UserService {
async getAll() {
return await userModel
.find()
.populate("roleId");
}
async getById(
id:string
) {
return await userModel
.find()
.populate("roleId");
}
async create(
data:any
) {
return await userModel.create(data);
}
async update(
id:string,
data:any
) {
return await userModel.findByIdAndUpdate(
id,
data,
{
new:true
}
);
}
async delete(
id:string
) {
return await userModel.findByIdAndDelete(
id
);
}
}