forked from Immortalin/onefraction
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
8 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
import { ModelType } from 'typegoose' | ||
import UserModal, { User } from './UserEntity' | ||
import UserModel, { User } from './UserEntity' | ||
|
||
export class UserService { | ||
private readonly modal: ModelType<User> | ||
private readonly model: ModelType<User> | ||
|
||
constructor() { | ||
this.modal = UserModal | ||
this.model = UserModel | ||
} | ||
|
||
async find(selector?: Partial<User>) { | ||
return this.modal.find(selector) | ||
return this.model.find(selector) | ||
} | ||
|
||
async findOneById(_id: string) { | ||
return this.modal.findOne({ _id }) | ||
return this.model.findOne({ _id }) | ||
} | ||
|
||
async remove(_id: string) { | ||
let entityToRemove = await this.modal.findOne(_id) | ||
await this.modal.remove(entityToRemove) | ||
let entityToRemove = await this.model.findOne(_id) | ||
await this.model.remove(entityToRemove) | ||
} | ||
|
||
async count(entity: any) { | ||
return this.modal.count(entity) | ||
return this.model.count(entity) | ||
} | ||
} |