Merge pull request #521 from Hexastack/fix/utils-strict-null-check

fix: utilities decorators IsLessThanDate, IsObjectId
This commit is contained in:
Med Marrouchi 2025-01-06 17:27:41 +01:00 committed by GitHub
commit c3518d003a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright © 2024 Hexastack. All rights reserved. * Copyright © 2025 Hexastack. All rights reserved.
* *
* Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms: * Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms:
* 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission. * 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission.
@ -8,15 +8,15 @@
import { import {
registerDecorator, registerDecorator,
ValidationOptions,
ValidationArguments, ValidationArguments,
ValidationOptions,
} from 'class-validator'; } from 'class-validator';
export function IsLessThanDate( export function IsLessThanDate(
property: string, property: string,
validationOptions?: ValidationOptions, validationOptions?: ValidationOptions,
) { ) {
return (object: unknown, propertyName: string) => { return (object: object, propertyName: string) => {
registerDecorator({ registerDecorator({
target: object.constructor, target: object.constructor,
propertyName, propertyName,

View File

@ -11,7 +11,7 @@ import { Types } from 'mongoose';
export const IsObjectId = export const IsObjectId =
(validationOptions?: ValidationOptions) => (validationOptions?: ValidationOptions) =>
(object: unknown, propertyName: string) => (object: object, propertyName: string) =>
registerDecorator({ registerDecorator({
target: object.constructor, target: object.constructor,
propertyName, propertyName,