Skip to content

Add support for all UUID versions #92

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/annotations/association/BelongsToMany.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function BelongsToMany(relatedClassGetter: ModelClassGetter,
through = throughOrOptions;
} else {
through = (throughOrOptions as IAssociationOptionsBelongsToMany).through;
options = throughOrOptions;
options = throughOrOptions as IAssociationOptionsBelongsToMany;
}
return (target: any, propertyName: string) => {
addAssociation(
Expand Down
8 changes: 5 additions & 3 deletions lib/annotations/validation/IsUUID.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import 'reflect-metadata';
import {addAttributeOptions} from "../../services/models";

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

return (target: any, propertyName: string) =>
addAttributeOptions(target, propertyName, {
Expand Down
2 changes: 1 addition & 1 deletion lib/interfaces/IBaseIncludeOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface IBaseIncludeOptions {
* Where clauses to apply to the child models. Note that this converts the eager load to an inner join,
* unless you explicitly set `required: false`
*/
where?: WhereOptions;
where?: WhereOptions<any>;

/**
* A list of attributes to select from the child model
Expand Down
4 changes: 2 additions & 2 deletions lib/interfaces/IFindOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface IFindOptions extends LoggingOptions, SearchPathOptions {
/**
* A hash of attributes to describe your search. See above for examples.
*/
where?: WhereOptions | Array<col | and | or | string> | col | and | or | string;
where?: WhereOptions<any> | Array<col | and | or | string> | col | and | or | string;

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

/**
* Group by. It is not mentioned in sequelize's JSDoc, but mentioned in docs.
Expand Down
4 changes: 2 additions & 2 deletions lib/interfaces/IScopeFindOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface IScopeFindOptions extends LoggingOptions, SearchPathOptions {
/**
* A hash of attributes to describe your search. See above for examples.
*/
where?: WhereOptions | Array<col | and | or | string> | col | and | or | string;
where?: WhereOptions<any> | Array<col | and | or | string> | col | and | or | string;

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

/**
* Group by. It is not mentioned in sequelize's JSDoc, but mentioned in docs.
Expand Down
Loading