import { Injectable } from '@nestjs/common' ; import { InjectRepository } from '@nestjs/typeorm' ; import { ProviderType } from 'aws-sdk/clients/codegurureviewer' ; import { Repository } from 'typeorm' ; import { CreateUserInput } from './input/create-user.input' ; import { UpdateUserInput } from './input/update-user.input' ; import { User } from './user.entity' ; @ Injectable ( ) export class UserService { constructor ( @ InjectRepository ( User ) private userRepository ) { } findOne ( id ) { return this . userRepository . findOne ( id ) ; } findOneOrFail ( id ) { return this . userRepository . findOneOrFail ( id ) ; } async findByProvider ( provider , providerId ) { return await this . userRepository . findOne ( { where : { provider , providerId , } , } ) ; } async create ( fields ) { return await this . userRepository . save ( { ... fields } ) ; } async update ( id , fields ) { return await this . userRepository . update ( id , { ... fields } ) ; } async remove ( id ) { return await this . userRepository . delete ( id ) ; } }