chore: add uploader and user profile picture

This commit is contained in:
mahyargdz
2025-07-24 12:37:08 +03:30
parent f42280846c
commit 5f4b679467
23 changed files with 1639 additions and 232 deletions
@@ -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"] });