Created
September 29, 2020 13:31
-
-
Save talesmgodois/e18acdf0e2ae531e82abf81c7fbe6474 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>, | |
) {} | |
findAll(): Promise<User[]> { | |
return this.usersRepository.find(); | |
} | |
findOne(id: string): Promise<User> { | |
return this.usersRepository.findOne(id); | |
} | |
async remove(id: string): Promise<void> { | |
await this.usersRepository.delete(id); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment