# Introduction Added a no-explicit-any rule to the twenty-server, not applicable to tests and integration tests folder Related to https://github.com/twentyhq/core-team-issues/issues/975 Discussed with Charles ## In case of conflicts Until this is approved I won't rebased and handle conflict, just need to drop two latest commits and re run the scripts etc ## Legacy We decided not to handle the existing lint error occurrences and programmatically ignored them through a disable next line rule comment ## Open question We might wanna activate the [no-explicit-any](https://typescript-eslint.io/rules/no-explicit-any/) `ignoreRestArgs` for our use case ? ``` ignoreRestArgs?: boolean; ``` --------- Co-authored-by: etiennejouan <jouan.etienne@gmail.com>
73 lines
1.7 KiB
TypeScript
73 lines
1.7 KiB
TypeScript
import {
|
|
Field,
|
|
HideField,
|
|
ObjectType,
|
|
registerEnumType,
|
|
} from '@nestjs/graphql';
|
|
|
|
import {
|
|
Authorize,
|
|
BeforeDeleteOne,
|
|
IDField,
|
|
QueryOptions,
|
|
Relation,
|
|
} from '@ptc-org/nestjs-query-graphql';
|
|
import { CreateDateColumn, UpdateDateColumn } from 'typeorm';
|
|
|
|
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
|
import { ObjectMetadataDTO } from 'src/engine/metadata-modules/object-metadata/dtos/object-metadata.dto';
|
|
import { BeforeDeleteOneRelation } from 'src/engine/metadata-modules/relation-metadata/hooks/before-delete-one-relation.hook';
|
|
import { RelationMetadataType } from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
|
|
|
registerEnumType(RelationMetadataType, {
|
|
name: 'RelationMetadataType',
|
|
description: 'Type of the relation',
|
|
});
|
|
|
|
@ObjectType('RelationMetadata')
|
|
@Authorize({
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
authorize: (context: any) => ({
|
|
workspaceId: { eq: context?.req?.workspace?.id },
|
|
}),
|
|
})
|
|
@QueryOptions({
|
|
defaultResultSize: 10,
|
|
disableFilter: true,
|
|
disableSort: true,
|
|
maxResultsSize: 1000,
|
|
})
|
|
@BeforeDeleteOne(BeforeDeleteOneRelation)
|
|
@Relation('fromObjectMetadata', () => ObjectMetadataDTO)
|
|
@Relation('toObjectMetadata', () => ObjectMetadataDTO)
|
|
export class RelationMetadataDTO {
|
|
@IDField(() => UUIDScalarType)
|
|
id: string;
|
|
|
|
@Field(() => RelationMetadataType)
|
|
relationType: RelationMetadataType;
|
|
|
|
@Field()
|
|
fromObjectMetadataId: string;
|
|
|
|
@Field()
|
|
toObjectMetadataId: string;
|
|
|
|
@Field()
|
|
fromFieldMetadataId: string;
|
|
|
|
@Field()
|
|
toFieldMetadataId: string;
|
|
|
|
@HideField()
|
|
workspaceId: string;
|
|
|
|
@Field()
|
|
@CreateDateColumn()
|
|
createdAt: Date;
|
|
|
|
@Field()
|
|
@UpdateDateColumn()
|
|
updatedAt: Date;
|
|
}
|