Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

로그인 - users.service.ts #6

Open
pgb0930 opened this issue Aug 27, 2024 · 0 comments
Open

로그인 - users.service.ts #6

pgb0930 opened this issue Aug 27, 2024 · 0 comments

Comments

@pgb0930
Copy link
Collaborator

pgb0930 commented Aug 27, 2024

🚅 Issue 한 줄 요약

users.service.ts

🤷 Issue 세부 내용

import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { User } from './user.entity';

@Injectable()
export class UsersService {
  constructor(
    @InjectRepository(User)
    private usersRepository: Repository<User>,
  ) {}

  async create(username: string, password: string): Promise<User> {
    const newUser = this.usersRepository.create({ username, password });
    return this.usersRepository.save(newUser);
  }

  async findOne(username: string): Promise<User | undefined> {
    return this.usersRepository.findOne({ where: { username } });
  }
}

✨ 기대 결과

📸 스크린샷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant