chore: add uploader and user profile picture
This commit is contained in:
@@ -16,6 +16,7 @@ import { Template } from "../../templates/entities/template.entity";
|
||||
import { PasswordService } from "../../utils/services/password.service";
|
||||
import { CreateEmailUserDto } from "../DTO/create-email-user.dto";
|
||||
import { UpdateEmailUserDto } from "../DTO/update-email-user.dto";
|
||||
import { UpdateUserProfileDto } from "../DTO/update-user-profile.dto";
|
||||
import { UserListQueryDto } from "../DTO/user-list-query.dto";
|
||||
import { Role } from "../entities/role.entity";
|
||||
import { User } from "../entities/user.entity";
|
||||
@@ -80,6 +81,16 @@ export class UsersService {
|
||||
};
|
||||
}
|
||||
/*******************************/
|
||||
async updateProfile(userId: string, updateMeDto: UpdateUserProfileDto) {
|
||||
const user = await this.userRepository.findOne({ id: userId, deletedAt: null });
|
||||
if (!user) throw new BadRequestException(UserMessage.USER_NOT_FOUND);
|
||||
|
||||
this.userRepository.assign(user, updateMeDto);
|
||||
await this.em.flush();
|
||||
|
||||
return { message: UserMessage.USER_UPDATED_SUCCESSFULLY, user };
|
||||
}
|
||||
/*******************************/
|
||||
|
||||
async findOneByIdWithEntityManager(id: string, em: EntityManager) {
|
||||
const user = await em.findOne(User, { id }, { populate: ["role"] });
|
||||
|
||||
Reference in New Issue
Block a user