Skip to content

Commit 61604c8

Browse files
Merge pull request #92 from IzikLisbon/master
Add support for all UUID versions
2 parents 84a0538 + a24fd7c commit 61604c8

File tree

7 files changed

+163
-302
lines changed

7 files changed

+163
-302
lines changed

lib/annotations/association/BelongsToMany.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function BelongsToMany(relatedClassGetter: ModelClassGetter,
2020
through = throughOrOptions;
2121
} else {
2222
through = (throughOrOptions as IAssociationOptionsBelongsToMany).through;
23-
options = throughOrOptions;
23+
options = throughOrOptions as IAssociationOptionsBelongsToMany;
2424
}
2525
return (target: any, propertyName: string) => {
2626
addAssociation(

lib/annotations/validation/IsUUID.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import 'reflect-metadata';
22
import {addAttributeOptions} from "../../services/models";
33

4-
/**
5-
* Only allow uuids
4+
/*
5+
* Only allow uuids.
6+
* Version's regular expressions:
7+
* https://github.com/chriso/validator.js/blob/b59133b1727b6af355b403a9a97a19226cceb34b/lib/isUUID.js#L14-L19.
68
*/
7-
export function IsUUID(version: number): Function {
9+
export function IsUUID(version: 3|4|5|"3"|"4"|"5"|"all"): Function {
810

911
return (target: any, propertyName: string) =>
1012
addAttributeOptions(target, propertyName, {

lib/interfaces/IBaseIncludeOptions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export interface IBaseIncludeOptions {
1515
* Where clauses to apply to the child models. Note that this converts the eager load to an inner join,
1616
* unless you explicitly set `required: false`
1717
*/
18-
where?: WhereOptions;
18+
where?: WhereOptions<any>;
1919

2020
/**
2121
* A list of attributes to select from the child model

lib/interfaces/IFindOptions.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export interface IFindOptions extends LoggingOptions, SearchPathOptions {
1111
/**
1212
* A hash of attributes to describe your search. See above for examples.
1313
*/
14-
where?: WhereOptions | Array<col | and | or | string> | col | and | or | string;
14+
where?: WhereOptions<any> | Array<col | and | or | string> | col | and | or | string;
1515

1616
/**
1717
* A list of the attributes that you want to select. To rename an attribute, you can pass an array, with
@@ -69,7 +69,7 @@ export interface IFindOptions extends LoggingOptions, SearchPathOptions {
6969
/**
7070
* having ?!?
7171
*/
72-
having?: WhereOptions;
72+
having?: WhereOptions<any>;
7373

7474
/**
7575
* Group by. It is not mentioned in sequelize's JSDoc, but mentioned in docs.

lib/interfaces/IScopeFindOptions.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export interface IScopeFindOptions extends LoggingOptions, SearchPathOptions {
1111
/**
1212
* A hash of attributes to describe your search. See above for examples.
1313
*/
14-
where?: WhereOptions | Array<col | and | or | string> | col | and | or | string;
14+
where?: WhereOptions<any> | Array<col | and | or | string> | col | and | or | string;
1515

1616
/**
1717
* A list of the attributes that you want to select. To rename an attribute, you can pass an array, with
@@ -69,7 +69,7 @@ export interface IScopeFindOptions extends LoggingOptions, SearchPathOptions {
6969
/**
7070
* having ?!?
7171
*/
72-
having?: WhereOptions;
72+
having?: WhereOptions<any>;
7373

7474
/**
7575
* Group by. It is not mentioned in sequelize's JSDoc, but mentioned in docs.

0 commit comments

Comments
 (0)