fix: forbid creation of objects or fields with certain characters or with forbidden keywords that clashes with pg_graphql (#3957)
* fix: forbid creation of objects or fields with certain characters or with forbidden keywords that clashes with pg_graphql * refactor: add a decorator for name validation and use it on fields
This commit is contained in:
committed by
GitHub
parent
b1eb0577bc
commit
0fe838d320
@ -3,6 +3,7 @@ import { Field, HideField, InputType } from '@nestjs/graphql';
|
||||
import { BeforeCreateOne } from '@ptc-org/nestjs-query-graphql';
|
||||
import { IsNotEmpty, IsOptional, IsString, IsUUID } from 'class-validator';
|
||||
|
||||
import { IsValidName } from 'src/metadata/decorators/is-valid-name.decorator';
|
||||
import { BeforeCreateOneObject } from 'src/metadata/object-metadata/hooks/before-create-one-object.hook';
|
||||
|
||||
@InputType()
|
||||
@ -11,11 +12,13 @@ export class CreateObjectInput {
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@Field()
|
||||
@IsValidName()
|
||||
nameSingular: string;
|
||||
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@Field()
|
||||
@IsValidName()
|
||||
namePlural: string;
|
||||
|
||||
@IsString()
|
||||
|
||||
Reference in New Issue
Block a user