Remove singular/plural from field-metadata (#2085)
* Remove singular/plural from field-metadata * revert removing id from create input * remove console log * remove console log * codegen * missing files * fix tests
This commit is contained in:
@ -13,22 +13,12 @@ export class CreateFieldInput {
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@Field()
|
||||
nameSingular: string;
|
||||
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
@Field({ nullable: true })
|
||||
namePlural?: string;
|
||||
name: string;
|
||||
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@Field()
|
||||
labelSingular: string;
|
||||
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
@Field({ nullable: true })
|
||||
labelPlural?: string;
|
||||
label: string;
|
||||
|
||||
// Todo: use a type enum and share with typeorm entity
|
||||
@IsEnum([
|
||||
|
||||
@ -1,28 +1,18 @@
|
||||
import { Field, InputType } from '@nestjs/graphql';
|
||||
|
||||
import { IsBoolean, IsOptional, IsString } from 'class-validator';
|
||||
import { IsBoolean, IsNotEmpty, IsOptional, IsString } from 'class-validator';
|
||||
|
||||
@InputType()
|
||||
export class UpdateFieldInput {
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
@Field({ nullable: true })
|
||||
nameSingular?: string;
|
||||
@IsNotEmpty()
|
||||
@Field()
|
||||
name: string;
|
||||
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
@Field({ nullable: true })
|
||||
namePlural?: string;
|
||||
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
@Field({ nullable: true })
|
||||
labelSingular?: string;
|
||||
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
@Field({ nullable: true })
|
||||
labelPlural?: string;
|
||||
@IsNotEmpty()
|
||||
@Field()
|
||||
label: string;
|
||||
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
|
||||
@ -38,7 +38,7 @@ export const fieldMetadataAutoResolverOpts: AutoResolverOpts<
|
||||
update: {
|
||||
many: { disabled: true },
|
||||
},
|
||||
delete: { disabled: true },
|
||||
delete: { many: { disabled: true } },
|
||||
guards: [JwtAuthGuard],
|
||||
},
|
||||
];
|
||||
|
||||
@ -51,20 +51,12 @@ export class FieldMetadata {
|
||||
type: string;
|
||||
|
||||
@Field()
|
||||
@Column({ nullable: false, name: 'name_singular' })
|
||||
nameSingular: string;
|
||||
@Column({ nullable: false })
|
||||
name: string;
|
||||
|
||||
@Field()
|
||||
@Column({ nullable: true, name: 'name_plural' })
|
||||
namePlural: string;
|
||||
|
||||
@Field()
|
||||
@Column({ nullable: false, name: 'label_singular' })
|
||||
labelSingular: string;
|
||||
|
||||
@Field()
|
||||
@Column({ nullable: true, name: 'label_plural' })
|
||||
labelPlural: string;
|
||||
@Column({ nullable: false })
|
||||
label: string;
|
||||
|
||||
@Column({ nullable: false, name: 'target_column_map', type: 'jsonb' })
|
||||
targetColumnMap: FieldMetadataTargetColumnMap;
|
||||
|
||||
@ -44,8 +44,7 @@ export class FieldMetadataService extends TypeOrmQueryService<FieldMetadata> {
|
||||
|
||||
const fieldAlreadyExists = await this.fieldMetadataRepository.findOne({
|
||||
where: {
|
||||
nameSingular: record.nameSingular,
|
||||
namePlural: record.namePlural,
|
||||
name: record.name,
|
||||
objectId: record.objectId,
|
||||
workspaceId: record.workspaceId,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user