forked from keyshade-xyz/keyshade
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(api): Variables with empty names (keyshade-xyz#745)
Co-authored-by: Rajdip Bhattacharya <[email protected]>
- Loading branch information
1 parent
27b8405
commit b8e2abf
Showing
6 changed files
with
80 additions
and
28 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
apps/api/src/decorators/non-empty-trimmed-string.decorator.ts
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { IsNotEmpty } from 'class-validator' | ||
import { TrimmedString } from '@/decorators/trimmed-string.decorator' | ||
import { applyDecorators } from '@nestjs/common' | ||
|
||
export function NonEmptyTrimmedString() { | ||
return applyDecorators(TrimmedString(), IsNotEmpty()) | ||
} |
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,7 +1,7 @@ | ||
import { Transform } from 'class-transformer' | ||
|
||
export function TrimString() { | ||
return Transform(({ value }) => | ||
typeof value === 'string' ? value?.trim() : value | ||
) | ||
} | ||
import { Transform } from 'class-transformer' | ||
|
||
export function TrimString() { | ||
return Transform(({ value }) => | ||
typeof value === 'string' ? value.trim() : value | ||
) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { IsString } from 'class-validator' | ||
import { TrimString } from '@/decorators/trim-string.decorator' | ||
import { applyDecorators } from '@nestjs/common' | ||
|
||
export function TrimmedString() { | ||
return applyDecorators(TrimString(), IsString()) | ||
} |
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
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