-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: update unique property name to uniqueQuery
- Loading branch information
1 parent
bbb259f
commit 8e44261
Showing
3 changed files
with
12 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
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,15 +1,19 @@ | ||
import { Filter } from 'mongodb'; | ||
import { Job } from '.'; | ||
|
||
export type UniqueMethod = (unique: any, options?: { insertOnly: boolean }) => Job; | ||
export type UniqueMethod<TSchema extends Document = Document> = ( | ||
filter: Filter<TSchema>, | ||
options?: { insertOnly: boolean } | ||
) => Job; | ||
/** | ||
* Data to ensure is unique for job to be created | ||
* @name Job#unique | ||
* @function | ||
* @param unique mongo data query for unique | ||
* @param filter mongo data query for unique | ||
* @param options unique options | ||
*/ | ||
export const unique: UniqueMethod = function (this: Job, unique, options?) { | ||
this.attrs.unique = unique; | ||
export const unique: UniqueMethod = function (this: Job, filter, options?) { | ||
this.attrs.uniqueQuery = filter; | ||
this.attrs.uniqueOpts = options; | ||
return this; | ||
}; |
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