mirror of
https://github.com/hexastack/hexabot
synced 2025-05-05 05:15:02 +00:00
Merge pull request #521 from Hexastack/fix/utils-strict-null-check
fix: utilities decorators IsLessThanDate, IsObjectId
This commit is contained in:
commit
c3518d003a
@ -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,
|
||||||
|
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user