import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { UserModel } from './entities/user.entity'; import { Repository } from 'typeorm'; /** * 사용자 정보 서비스 * 프로필 조회/수정 등 사용자 정보 관련 비즈니스 로직 * * TODO: 나중에 프로필 기능 필요시 아래 주석 해제 */ @Injectable() export class UserService { constructor( @InjectRepository(UserModel) private readonly userRepository: Repository, ) {} // /** // * 사용자 ID로 조회 // */ // async findByUserId(userId: string): Promise { // return this.userRepository.findOne({ // where: { userId, delDt: IsNull() }, // }); // } // /** // * 사용자 번호로 조회 // */ // async findByUserNo(userNo: number): Promise { // return this.userRepository.findOne({ // where: { pkUserNo: userNo, delDt: IsNull() }, // }); // } // /** // * 내 프로필 조회 // */ // async getProfile(userNo: number): Promise<{ // userNo: number; // userId: string; // userName: string; // userPhone: string; // userEmail: string; // userRole: string; // }> { // const user = await this.userRepository.findOne({ // where: { pkUserNo: userNo, delDt: IsNull() }, // }); // if (!user) { // throw new NotFoundException('사용자를 찾을 수 없습니다'); // } // return { // userNo: user.pkUserNo, // userId: user.userId, // userName: user.userName, // userPhone: user.userPhone, // userEmail: user.userEmail, // userRole: user.userRole, // }; // } // /** // * 프로필 수정 // */ // async updateProfile( // userNo: number, // data: { userName?: string; userPhone?: string }, // ): Promise<{ message: string }> { // const user = await this.userRepository.findOne({ // where: { pkUserNo: userNo, delDt: IsNull() }, // }); // if (!user) { // throw new NotFoundException('사용자를 찾을 수 없습니다'); // } // if (data.userName) user.userName = data.userName; // if (data.userPhone) user.userPhone = data.userPhone; // await this.userRepository.save(user); // return { message: '프로필이 수정되었습니다' }; // } // /** // * 전체 사용자 목록 조회 (관리자용) // */ // async findAll(): Promise { // return this.userRepository.find({ // where: { delDt: IsNull() }, // order: { regDt: 'DESC' }, // }); // } }