SHARE
TWEET

Untitled

a guest Jul 18th, 2019 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. import { InjectRepository } from '@nestjs/typeorm';
  3. import { CrudService } from './../crud/crud.service';
  4. import { Injectable } from '@nestjs/common';
  5. import { Stuff } from 'src/entity/Stuff';
  6. import { Repository } from 'typeorm';
  7.  
  8. @Injectable()
  9. export class StuffService extends CrudService<Stuff> {
  10.     constructor(@InjectRepository(Stuff) private stuffRepository: Repository<Stuff>) {
  11.         super(stuffRepository);
  12.     }
  13.  
  14.     async getAll(id: number, query: object): Promise<Stuff[]> {
  15.         return await this.stuffRepository.find({
  16.             where: {userId: id, ...query},
  17.         });
  18.     }
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top