File size: 697 Bytes
7b850b7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { Inject, Injectable } from '@nestjs/common';
import { Model, Types } from 'mongoose';
import { USER_REPOSITORY } from 'src/constants';
import { IUserDocument } from './user.schema';
import { sharedCrudService } from '../shared/sharedCrud.services';

interface UserDocument extends IUserDocument {
  _id: Types.ObjectId;
}

@Injectable()
export class UserService extends sharedCrudService {
  constructor(

    @Inject(USER_REPOSITORY) readonly userRepository: Model<IUserDocument>,

  ) {
    super(userRepository);
  }

  async getUserData(reqUser: any) {
    const user = await this.userRepository.findById({
      _id: reqUser._id,
    });
    return user;
  }
}