fix: displayName return undefined and drop displayName from user table (#505)

This commit is contained in:
Jérémy M
2023-07-04 20:08:15 +02:00
committed by GitHub
parent d83313cd93
commit 6fc416da76
98 changed files with 128 additions and 222 deletions

View File

@ -45,6 +45,7 @@
"@paljs/plugins": "^5.3.3",
"@prisma/client": "^4.13.0",
"@types/lodash.camelcase": "^4.3.7",
"@types/lodash.merge": "^4.6.7",
"add": "^2.0.6",
"apollo-server-express": "^3.12.0",
"axios": "^1.4.0",
@ -60,6 +61,7 @@
"lodash.camelcase": "^4.3.0",
"lodash.isobject": "^3.0.2",
"lodash.kebabcase": "^4.1.1",
"lodash.merge": "^4.6.2",
"ms": "^2.1.3",
"passport": "^0.6.0",
"passport-google-oauth20": "^2.0.0",

View File

@ -9,8 +9,8 @@ export class CreateManyCommentThreadTargetArgs {
@Field(() => [CommentThreadTargetCreateManyInput], {nullable:false})
@Type(() => CommentThreadTargetCreateManyInput)
@ValidateNested({each: true})
@Type(() => CommentThreadTargetCreateManyInput)
@ValidateNested({each: true})
data!: Array<CommentThreadTargetCreateManyInput>;
@Field(() => Boolean, {nullable:true})

View File

@ -9,7 +9,7 @@ export class CreateOneCommentThreadTargetArgs {
@Field(() => CommentThreadTargetCreateInput, {nullable:false})
@Type(() => CommentThreadTargetCreateInput)
@ValidateNested({each: true})
@Type(() => CommentThreadTargetCreateInput)
@ValidateNested({each: true})
data!: CommentThreadTargetCreateInput;
}

View File

@ -10,8 +10,8 @@ export class UpdateManyCommentThreadTargetArgs {
@Field(() => CommentThreadTargetUpdateManyMutationInput, {nullable:false})
@Type(() => CommentThreadTargetUpdateManyMutationInput)
@ValidateNested({each: true})
@Type(() => CommentThreadTargetUpdateManyMutationInput)
@ValidateNested({each: true})
data!: CommentThreadTargetUpdateManyMutationInput;
@Field(() => CommentThreadTargetWhereInput, {nullable:true})

View File

@ -10,8 +10,8 @@ export class UpdateOneCommentThreadTargetArgs {
@Field(() => CommentThreadTargetUpdateInput, {nullable:false})
@Type(() => CommentThreadTargetUpdateInput)
@ValidateNested({each: true})
@Type(() => CommentThreadTargetUpdateInput)
@ValidateNested({each: true})
data!: CommentThreadTargetUpdateInput;
@Field(() => CommentThreadTargetWhereUniqueInput, {nullable:false})

View File

@ -9,8 +9,8 @@ export class CreateManyCommentThreadArgs {
@Field(() => [CommentThreadCreateManyInput], {nullable:false})
@Type(() => CommentThreadCreateManyInput)
@ValidateNested({each: true})
@Type(() => CommentThreadCreateManyInput)
@ValidateNested({each: true})
data!: Array<CommentThreadCreateManyInput>;
@Field(() => Boolean, {nullable:true})

View File

@ -9,7 +9,7 @@ export class CreateOneCommentThreadArgs {
@Field(() => CommentThreadCreateInput, {nullable:false})
@Type(() => CommentThreadCreateInput)
@ValidateNested({each: true})
@Type(() => CommentThreadCreateInput)
@ValidateNested({each: true})
data!: CommentThreadCreateInput;
}

View File

@ -10,8 +10,8 @@ export class UpdateManyCommentThreadArgs {
@Field(() => CommentThreadUpdateManyMutationInput, {nullable:false})
@Type(() => CommentThreadUpdateManyMutationInput)
@ValidateNested({each: true})
@Type(() => CommentThreadUpdateManyMutationInput)
@ValidateNested({each: true})
data!: CommentThreadUpdateManyMutationInput;
@Field(() => CommentThreadWhereInput, {nullable:true})

View File

@ -10,8 +10,8 @@ export class UpdateOneCommentThreadArgs {
@Field(() => CommentThreadUpdateInput, {nullable:false})
@Type(() => CommentThreadUpdateInput)
@ValidateNested({each: true})
@Type(() => CommentThreadUpdateInput)
@ValidateNested({each: true})
data!: CommentThreadUpdateInput;
@Field(() => CommentThreadWhereUniqueInput, {nullable:false})

View File

@ -9,8 +9,8 @@ export class CreateManyCommentArgs {
@Field(() => [CommentCreateManyInput], {nullable:false})
@Type(() => CommentCreateManyInput)
@ValidateNested({each: true})
@Type(() => CommentCreateManyInput)
@ValidateNested({each: true})
data!: Array<CommentCreateManyInput>;
@Field(() => Boolean, {nullable:true})

View File

@ -9,7 +9,7 @@ export class CreateOneCommentArgs {
@Field(() => CommentCreateInput, {nullable:false})
@Type(() => CommentCreateInput)
@ValidateNested({each: true})
@Type(() => CommentCreateInput)
@ValidateNested({each: true})
data!: CommentCreateInput;
}

View File

@ -10,8 +10,8 @@ export class UpdateManyCommentArgs {
@Field(() => CommentUpdateManyMutationInput, {nullable:false})
@Type(() => CommentUpdateManyMutationInput)
@ValidateNested({each: true})
@Type(() => CommentUpdateManyMutationInput)
@ValidateNested({each: true})
data!: CommentUpdateManyMutationInput;
@Field(() => CommentWhereInput, {nullable:true})

View File

@ -10,8 +10,8 @@ export class UpdateOneCommentArgs {
@Field(() => CommentUpdateInput, {nullable:false})
@Type(() => CommentUpdateInput)
@ValidateNested({each: true})
@Type(() => CommentUpdateInput)
@ValidateNested({each: true})
data!: CommentUpdateInput;
@Field(() => CommentWhereUniqueInput, {nullable:false})

View File

@ -9,8 +9,8 @@ export class CreateManyCompanyArgs {
@Field(() => [CompanyCreateManyInput], {nullable:false})
@Type(() => CompanyCreateManyInput)
@ValidateNested({each: true})
@Type(() => CompanyCreateManyInput)
@ValidateNested({each: true})
data!: Array<CompanyCreateManyInput>;
@Field(() => Boolean, {nullable:true})

View File

@ -9,7 +9,7 @@ export class CreateOneCompanyArgs {
@Field(() => CompanyCreateInput, {nullable:false})
@Type(() => CompanyCreateInput)
@ValidateNested({each: true})
@Type(() => CompanyCreateInput)
@ValidateNested({each: true})
data!: CompanyCreateInput;
}

View File

@ -10,8 +10,8 @@ export class UpdateManyCompanyArgs {
@Field(() => CompanyUpdateManyMutationInput, {nullable:false})
@Type(() => CompanyUpdateManyMutationInput)
@ValidateNested({each: true})
@Type(() => CompanyUpdateManyMutationInput)
@ValidateNested({each: true})
data!: CompanyUpdateManyMutationInput;
@Field(() => CompanyWhereInput, {nullable:true})

View File

@ -10,8 +10,8 @@ export class UpdateOneCompanyArgs {
@Field(() => CompanyUpdateInput, {nullable:false})
@Type(() => CompanyUpdateInput)
@ValidateNested({each: true})
@Type(() => CompanyUpdateInput)
@ValidateNested({each: true})
data!: CompanyUpdateInput;
@Field(() => CompanyWhereUniqueInput, {nullable:false})

View File

@ -9,8 +9,8 @@ export class CreateManyPersonArgs {
@Field(() => [PersonCreateManyInput], {nullable:false})
@Type(() => PersonCreateManyInput)
@ValidateNested({each: true})
@Type(() => PersonCreateManyInput)
@ValidateNested({each: true})
data!: Array<PersonCreateManyInput>;
@Field(() => Boolean, {nullable:true})

View File

@ -9,7 +9,7 @@ export class CreateOnePersonArgs {
@Field(() => PersonCreateInput, {nullable:false})
@Type(() => PersonCreateInput)
@ValidateNested({each: true})
@Type(() => PersonCreateInput)
@ValidateNested({each: true})
data!: PersonCreateInput;
}

View File

@ -10,8 +10,8 @@ export class UpdateManyPersonArgs {
@Field(() => PersonUpdateManyMutationInput, {nullable:false})
@Type(() => PersonUpdateManyMutationInput)
@ValidateNested({each: true})
@Type(() => PersonUpdateManyMutationInput)
@ValidateNested({each: true})
data!: PersonUpdateManyMutationInput;
@Field(() => PersonWhereInput, {nullable:true})

View File

@ -10,8 +10,8 @@ export class UpdateOnePersonArgs {
@Field(() => PersonUpdateInput, {nullable:false})
@Type(() => PersonUpdateInput)
@ValidateNested({each: true})
@Type(() => PersonUpdateInput)
@ValidateNested({each: true})
data!: PersonUpdateInput;
@Field(() => PersonWhereUniqueInput, {nullable:false})

View File

@ -9,8 +9,8 @@ export class CreateManyPipelineProgressArgs {
@Field(() => [PipelineProgressCreateManyInput], {nullable:false})
@Type(() => PipelineProgressCreateManyInput)
@ValidateNested({each: true})
@Type(() => PipelineProgressCreateManyInput)
@ValidateNested({each: true})
data!: Array<PipelineProgressCreateManyInput>;
@Field(() => Boolean, {nullable:true})

View File

@ -9,7 +9,7 @@ export class CreateOnePipelineProgressArgs {
@Field(() => PipelineProgressCreateInput, {nullable:false})
@Type(() => PipelineProgressCreateInput)
@ValidateNested({each: true})
@Type(() => PipelineProgressCreateInput)
@ValidateNested({each: true})
data!: PipelineProgressCreateInput;
}

View File

@ -10,8 +10,8 @@ export class UpdateManyPipelineProgressArgs {
@Field(() => PipelineProgressUpdateManyMutationInput, {nullable:false})
@Type(() => PipelineProgressUpdateManyMutationInput)
@ValidateNested({each: true})
@Type(() => PipelineProgressUpdateManyMutationInput)
@ValidateNested({each: true})
data!: PipelineProgressUpdateManyMutationInput;
@Field(() => PipelineProgressWhereInput, {nullable:true})

View File

@ -10,8 +10,8 @@ export class UpdateOnePipelineProgressArgs {
@Field(() => PipelineProgressUpdateInput, {nullable:false})
@Type(() => PipelineProgressUpdateInput)
@ValidateNested({each: true})
@Type(() => PipelineProgressUpdateInput)
@ValidateNested({each: true})
data!: PipelineProgressUpdateInput;
@Field(() => PipelineProgressWhereUniqueInput, {nullable:false})

View File

@ -9,8 +9,8 @@ export class CreateManyPipelineStageArgs {
@Field(() => [PipelineStageCreateManyInput], {nullable:false})
@Type(() => PipelineStageCreateManyInput)
@ValidateNested({each: true})
@Type(() => PipelineStageCreateManyInput)
@ValidateNested({each: true})
data!: Array<PipelineStageCreateManyInput>;
@Field(() => Boolean, {nullable:true})

View File

@ -9,7 +9,7 @@ export class CreateOnePipelineStageArgs {
@Field(() => PipelineStageCreateInput, {nullable:false})
@Type(() => PipelineStageCreateInput)
@ValidateNested({each: true})
@Type(() => PipelineStageCreateInput)
@ValidateNested({each: true})
data!: PipelineStageCreateInput;
}

View File

@ -10,8 +10,8 @@ export class UpdateManyPipelineStageArgs {
@Field(() => PipelineStageUpdateManyMutationInput, {nullable:false})
@Type(() => PipelineStageUpdateManyMutationInput)
@ValidateNested({each: true})
@Type(() => PipelineStageUpdateManyMutationInput)
@ValidateNested({each: true})
data!: PipelineStageUpdateManyMutationInput;
@Field(() => PipelineStageWhereInput, {nullable:true})

View File

@ -10,8 +10,8 @@ export class UpdateOnePipelineStageArgs {
@Field(() => PipelineStageUpdateInput, {nullable:false})
@Type(() => PipelineStageUpdateInput)
@ValidateNested({each: true})
@Type(() => PipelineStageUpdateInput)
@ValidateNested({each: true})
data!: PipelineStageUpdateInput;
@Field(() => PipelineStageWhereUniqueInput, {nullable:false})

View File

@ -9,8 +9,8 @@ export class CreateManyPipelineArgs {
@Field(() => [PipelineCreateManyInput], {nullable:false})
@Type(() => PipelineCreateManyInput)
@ValidateNested({each: true})
@Type(() => PipelineCreateManyInput)
@ValidateNested({each: true})
data!: Array<PipelineCreateManyInput>;
@Field(() => Boolean, {nullable:true})

View File

@ -9,7 +9,7 @@ export class CreateOnePipelineArgs {
@Field(() => PipelineCreateInput, {nullable:false})
@Type(() => PipelineCreateInput)
@ValidateNested({each: true})
@Type(() => PipelineCreateInput)
@ValidateNested({each: true})
data!: PipelineCreateInput;
}

View File

@ -10,8 +10,8 @@ export class UpdateManyPipelineArgs {
@Field(() => PipelineUpdateManyMutationInput, {nullable:false})
@Type(() => PipelineUpdateManyMutationInput)
@ValidateNested({each: true})
@Type(() => PipelineUpdateManyMutationInput)
@ValidateNested({each: true})
data!: PipelineUpdateManyMutationInput;
@Field(() => PipelineWhereInput, {nullable:true})

View File

@ -10,8 +10,8 @@ export class UpdateOnePipelineArgs {
@Field(() => PipelineUpdateInput, {nullable:false})
@Type(() => PipelineUpdateInput)
@ValidateNested({each: true})
@Type(() => PipelineUpdateInput)
@ValidateNested({each: true})
data!: PipelineUpdateInput;
@Field(() => PipelineWhereUniqueInput, {nullable:false})

View File

@ -9,8 +9,8 @@ export class CreateManyRefreshTokenArgs {
@Field(() => [RefreshTokenCreateManyInput], {nullable:false})
@Type(() => RefreshTokenCreateManyInput)
@ValidateNested({each: true})
@Type(() => RefreshTokenCreateManyInput)
@ValidateNested({each: true})
data!: Array<RefreshTokenCreateManyInput>;
@Field(() => Boolean, {nullable:true})

View File

@ -9,7 +9,7 @@ export class CreateOneRefreshTokenArgs {
@Field(() => RefreshTokenCreateInput, {nullable:false})
@Type(() => RefreshTokenCreateInput)
@ValidateNested({each: true})
@Type(() => RefreshTokenCreateInput)
@ValidateNested({each: true})
data!: RefreshTokenCreateInput;
}

View File

@ -10,8 +10,8 @@ export class UpdateManyRefreshTokenArgs {
@Field(() => RefreshTokenUpdateManyMutationInput, {nullable:false})
@Type(() => RefreshTokenUpdateManyMutationInput)
@ValidateNested({each: true})
@Type(() => RefreshTokenUpdateManyMutationInput)
@ValidateNested({each: true})
data!: RefreshTokenUpdateManyMutationInput;
@Field(() => RefreshTokenWhereInput, {nullable:true})

View File

@ -10,8 +10,8 @@ export class UpdateOneRefreshTokenArgs {
@Field(() => RefreshTokenUpdateInput, {nullable:false})
@Type(() => RefreshTokenUpdateInput)
@ValidateNested({each: true})
@Type(() => RefreshTokenUpdateInput)
@ValidateNested({each: true})
data!: RefreshTokenUpdateInput;
@Field(() => RefreshTokenWhereUniqueInput, {nullable:false})

View File

@ -9,8 +9,8 @@ export class CreateManyUserArgs {
@Field(() => [UserCreateManyInput], {nullable:false})
@Type(() => UserCreateManyInput)
@ValidateNested({each: true})
@Type(() => UserCreateManyInput)
@ValidateNested({each: true})
data!: Array<UserCreateManyInput>;
@Field(() => Boolean, {nullable:true})

View File

@ -9,7 +9,7 @@ export class CreateOneUserArgs {
@Field(() => UserCreateInput, {nullable:false})
@Type(() => UserCreateInput)
@ValidateNested({each: true})
@Type(() => UserCreateInput)
@ValidateNested({each: true})
data!: UserCreateInput;
}

View File

@ -10,8 +10,8 @@ export class UpdateManyUserArgs {
@Field(() => UserUpdateManyMutationInput, {nullable:false})
@Type(() => UserUpdateManyMutationInput)
@ValidateNested({each: true})
@Type(() => UserUpdateManyMutationInput)
@ValidateNested({each: true})
data!: UserUpdateManyMutationInput;
@Field(() => UserWhereInput, {nullable:true})

View File

@ -10,8 +10,8 @@ export class UpdateOneUserArgs {
@Field(() => UserUpdateInput, {nullable:false})
@Type(() => UserUpdateInput)
@ValidateNested({each: true})
@Type(() => UserUpdateInput)
@ValidateNested({each: true})
data!: UserUpdateInput;
@Field(() => UserWhereUniqueInput, {nullable:false})

View File

@ -14,9 +14,6 @@ export class UserCountAggregateInput {
@Field(() => Boolean, {nullable:true})
lastName?: true;
@Field(() => Boolean, {nullable:true})
displayName?: true;
@Field(() => Boolean, {nullable:true})
email?: true;

View File

@ -15,9 +15,6 @@ export class UserCountAggregate {
@Field(() => Int, {nullable:false})
lastName!: number;
@HideField()
displayName!: number;
@Field(() => Int, {nullable:false})
email!: number;

View File

@ -15,9 +15,6 @@ export class UserCountOrderByAggregateInput {
@Field(() => SortOrder, {nullable:true})
lastName?: keyof typeof SortOrder;
@Field(() => SortOrder, {nullable:true})
displayName?: keyof typeof SortOrder;
@Field(() => SortOrder, {nullable:true})
email?: keyof typeof SortOrder;

View File

@ -20,11 +20,6 @@ export class UserCreateManyInput {
@Validator.IsString()
lastName!: string;
@Field(() => String, {nullable:true})
@Validator.IsString()
@Validator.IsOptional()
displayName?: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()
email!: string;

View File

@ -23,11 +23,6 @@ export class UserCreateWithoutCommentsInput {
@Validator.IsString()
lastName!: string;
@Field(() => String, {nullable:true})
@Validator.IsString()
@Validator.IsOptional()
displayName?: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()
email!: string;

View File

@ -23,11 +23,6 @@ export class UserCreateWithoutCompaniesInput {
@Validator.IsString()
lastName!: string;
@Field(() => String, {nullable:true})
@Validator.IsString()
@Validator.IsOptional()
displayName?: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()
email!: string;

View File

@ -23,11 +23,6 @@ export class UserCreateWithoutRefreshTokensInput {
@Validator.IsString()
lastName!: string;
@Field(() => String, {nullable:true})
@Validator.IsString()
@Validator.IsOptional()
displayName?: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()
email!: string;

View File

@ -23,11 +23,6 @@ export class UserCreateWithoutWorkspaceMemberInput {
@Validator.IsString()
lastName!: string;
@Field(() => String, {nullable:true})
@Validator.IsString()
@Validator.IsOptional()
displayName?: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()
email!: string;

View File

@ -24,11 +24,6 @@ export class UserCreateInput {
@Validator.IsString()
lastName!: string;
@Field(() => String, {nullable:true})
@Validator.IsString()
@Validator.IsOptional()
displayName?: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()
email!: string;

View File

@ -23,9 +23,6 @@ export class UserGroupBy {
@Validator.IsString()
lastName!: string;
@HideField()
displayName?: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()
email!: string;

View File

@ -14,9 +14,6 @@ export class UserMaxAggregateInput {
@Field(() => Boolean, {nullable:true})
lastName?: true;
@Field(() => Boolean, {nullable:true})
displayName?: true;
@Field(() => Boolean, {nullable:true})
email?: true;

View File

@ -19,9 +19,6 @@ export class UserMaxAggregate {
@Validator.IsString()
lastName?: string;
@HideField()
displayName?: string;
@Field(() => String, {nullable:true})
@Validator.IsEmail()
email?: string;

View File

@ -15,9 +15,6 @@ export class UserMaxOrderByAggregateInput {
@Field(() => SortOrder, {nullable:true})
lastName?: keyof typeof SortOrder;
@Field(() => SortOrder, {nullable:true})
displayName?: keyof typeof SortOrder;
@Field(() => SortOrder, {nullable:true})
email?: keyof typeof SortOrder;

View File

@ -14,9 +14,6 @@ export class UserMinAggregateInput {
@Field(() => Boolean, {nullable:true})
lastName?: true;
@Field(() => Boolean, {nullable:true})
displayName?: true;
@Field(() => Boolean, {nullable:true})
email?: true;

View File

@ -19,9 +19,6 @@ export class UserMinAggregate {
@Validator.IsString()
lastName?: string;
@HideField()
displayName?: string;
@Field(() => String, {nullable:true})
@Validator.IsEmail()
email?: string;

View File

@ -15,9 +15,6 @@ export class UserMinOrderByAggregateInput {
@Field(() => SortOrder, {nullable:true})
lastName?: keyof typeof SortOrder;
@Field(() => SortOrder, {nullable:true})
displayName?: keyof typeof SortOrder;
@Field(() => SortOrder, {nullable:true})
email?: keyof typeof SortOrder;

View File

@ -18,9 +18,6 @@ export class UserOrderByWithAggregationInput {
@Field(() => SortOrder, {nullable:true})
lastName?: keyof typeof SortOrder;
@Field(() => SortOrder, {nullable:true})
displayName?: keyof typeof SortOrder;
@Field(() => SortOrder, {nullable:true})
email?: keyof typeof SortOrder;

View File

@ -19,9 +19,6 @@ export class UserOrderByWithRelationInput {
@Field(() => SortOrder, {nullable:true})
lastName?: keyof typeof SortOrder;
@Field(() => SortOrder, {nullable:true})
displayName?: keyof typeof SortOrder;
@Field(() => SortOrder, {nullable:true})
email?: keyof typeof SortOrder;

View File

@ -4,7 +4,6 @@ export enum UserScalarFieldEnum {
id = "id",
firstName = "firstName",
lastName = "lastName",
displayName = "displayName",
email = "email",
emailVerified = "emailVerified",
avatarUrl = "avatarUrl",

View File

@ -1,8 +1,8 @@
import { Field } from '@nestjs/graphql';
import { InputType } from '@nestjs/graphql';
import { StringWithAggregatesFilter } from '../prisma/string-with-aggregates-filter.input';
import { StringNullableWithAggregatesFilter } from '../prisma/string-nullable-with-aggregates-filter.input';
import { BoolWithAggregatesFilter } from '../prisma/bool-with-aggregates-filter.input';
import { StringNullableWithAggregatesFilter } from '../prisma/string-nullable-with-aggregates-filter.input';
import { DateTimeNullableWithAggregatesFilter } from '../prisma/date-time-nullable-with-aggregates-filter.input';
import { HideField } from '@nestjs/graphql';
import { JsonNullableWithAggregatesFilter } from '../prisma/json-nullable-with-aggregates-filter.input';
@ -29,9 +29,6 @@ export class UserScalarWhereWithAggregatesInput {
@Field(() => StringWithAggregatesFilter, {nullable:true})
lastName?: StringWithAggregatesFilter;
@Field(() => StringNullableWithAggregatesFilter, {nullable:true})
displayName?: StringNullableWithAggregatesFilter;
@Field(() => StringWithAggregatesFilter, {nullable:true})
email?: StringWithAggregatesFilter;

View File

@ -23,11 +23,6 @@ export class UserUncheckedCreateWithoutCommentsInput {
@Validator.IsString()
lastName!: string;
@Field(() => String, {nullable:true})
@Validator.IsString()
@Validator.IsOptional()
displayName?: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()
email!: string;

View File

@ -23,11 +23,6 @@ export class UserUncheckedCreateWithoutCompaniesInput {
@Validator.IsString()
lastName!: string;
@Field(() => String, {nullable:true})
@Validator.IsString()
@Validator.IsOptional()
displayName?: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()
email!: string;

View File

@ -23,11 +23,6 @@ export class UserUncheckedCreateWithoutRefreshTokensInput {
@Validator.IsString()
lastName!: string;
@Field(() => String, {nullable:true})
@Validator.IsString()
@Validator.IsOptional()
displayName?: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()
email!: string;

View File

@ -23,11 +23,6 @@ export class UserUncheckedCreateWithoutWorkspaceMemberInput {
@Validator.IsString()
lastName!: string;
@Field(() => String, {nullable:true})
@Validator.IsString()
@Validator.IsOptional()
displayName?: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()
email!: string;

View File

@ -24,11 +24,6 @@ export class UserUncheckedCreateInput {
@Validator.IsString()
lastName!: string;
@Field(() => String, {nullable:true})
@Validator.IsString()
@Validator.IsOptional()
displayName?: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()
email!: string;

View File

@ -1,8 +1,8 @@
import { Field } from '@nestjs/graphql';
import { InputType } from '@nestjs/graphql';
import { StringFieldUpdateOperationsInput } from '../prisma/string-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { BoolFieldUpdateOperationsInput } from '../prisma/bool-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { NullableDateTimeFieldUpdateOperationsInput } from '../prisma/nullable-date-time-field-update-operations.input';
import { HideField } from '@nestjs/graphql';
import { GraphQLJSON } from 'graphql-type-json';
@ -21,9 +21,6 @@ export class UserUncheckedUpdateManyInput {
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
lastName?: StringFieldUpdateOperationsInput;
@Field(() => NullableStringFieldUpdateOperationsInput, {nullable:true})
displayName?: NullableStringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
email?: StringFieldUpdateOperationsInput;

View File

@ -1,8 +1,8 @@
import { Field } from '@nestjs/graphql';
import { InputType } from '@nestjs/graphql';
import { StringFieldUpdateOperationsInput } from '../prisma/string-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { BoolFieldUpdateOperationsInput } from '../prisma/bool-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { NullableDateTimeFieldUpdateOperationsInput } from '../prisma/nullable-date-time-field-update-operations.input';
import { HideField } from '@nestjs/graphql';
import { GraphQLJSON } from 'graphql-type-json';
@ -24,9 +24,6 @@ export class UserUncheckedUpdateWithoutCommentsInput {
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
lastName?: StringFieldUpdateOperationsInput;
@Field(() => NullableStringFieldUpdateOperationsInput, {nullable:true})
displayName?: NullableStringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
email?: StringFieldUpdateOperationsInput;

View File

@ -1,8 +1,8 @@
import { Field } from '@nestjs/graphql';
import { InputType } from '@nestjs/graphql';
import { StringFieldUpdateOperationsInput } from '../prisma/string-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { BoolFieldUpdateOperationsInput } from '../prisma/bool-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { NullableDateTimeFieldUpdateOperationsInput } from '../prisma/nullable-date-time-field-update-operations.input';
import { HideField } from '@nestjs/graphql';
import { GraphQLJSON } from 'graphql-type-json';
@ -24,9 +24,6 @@ export class UserUncheckedUpdateWithoutCompaniesInput {
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
lastName?: StringFieldUpdateOperationsInput;
@Field(() => NullableStringFieldUpdateOperationsInput, {nullable:true})
displayName?: NullableStringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
email?: StringFieldUpdateOperationsInput;

View File

@ -1,8 +1,8 @@
import { Field } from '@nestjs/graphql';
import { InputType } from '@nestjs/graphql';
import { StringFieldUpdateOperationsInput } from '../prisma/string-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { BoolFieldUpdateOperationsInput } from '../prisma/bool-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { NullableDateTimeFieldUpdateOperationsInput } from '../prisma/nullable-date-time-field-update-operations.input';
import { HideField } from '@nestjs/graphql';
import { GraphQLJSON } from 'graphql-type-json';
@ -24,9 +24,6 @@ export class UserUncheckedUpdateWithoutRefreshTokensInput {
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
lastName?: StringFieldUpdateOperationsInput;
@Field(() => NullableStringFieldUpdateOperationsInput, {nullable:true})
displayName?: NullableStringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
email?: StringFieldUpdateOperationsInput;

View File

@ -1,8 +1,8 @@
import { Field } from '@nestjs/graphql';
import { InputType } from '@nestjs/graphql';
import { StringFieldUpdateOperationsInput } from '../prisma/string-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { BoolFieldUpdateOperationsInput } from '../prisma/bool-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { NullableDateTimeFieldUpdateOperationsInput } from '../prisma/nullable-date-time-field-update-operations.input';
import { HideField } from '@nestjs/graphql';
import { GraphQLJSON } from 'graphql-type-json';
@ -24,9 +24,6 @@ export class UserUncheckedUpdateWithoutWorkspaceMemberInput {
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
lastName?: StringFieldUpdateOperationsInput;
@Field(() => NullableStringFieldUpdateOperationsInput, {nullable:true})
displayName?: NullableStringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
email?: StringFieldUpdateOperationsInput;

View File

@ -1,8 +1,8 @@
import { Field } from '@nestjs/graphql';
import { InputType } from '@nestjs/graphql';
import { StringFieldUpdateOperationsInput } from '../prisma/string-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { BoolFieldUpdateOperationsInput } from '../prisma/bool-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { NullableDateTimeFieldUpdateOperationsInput } from '../prisma/nullable-date-time-field-update-operations.input';
import { HideField } from '@nestjs/graphql';
import { GraphQLJSON } from 'graphql-type-json';
@ -25,9 +25,6 @@ export class UserUncheckedUpdateInput {
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
lastName?: StringFieldUpdateOperationsInput;
@Field(() => NullableStringFieldUpdateOperationsInput, {nullable:true})
displayName?: NullableStringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
email?: StringFieldUpdateOperationsInput;

View File

@ -1,8 +1,8 @@
import { Field } from '@nestjs/graphql';
import { InputType } from '@nestjs/graphql';
import { StringFieldUpdateOperationsInput } from '../prisma/string-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { BoolFieldUpdateOperationsInput } from '../prisma/bool-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { NullableDateTimeFieldUpdateOperationsInput } from '../prisma/nullable-date-time-field-update-operations.input';
import { HideField } from '@nestjs/graphql';
import { GraphQLJSON } from 'graphql-type-json';
@ -21,9 +21,6 @@ export class UserUpdateManyMutationInput {
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
lastName?: StringFieldUpdateOperationsInput;
@Field(() => NullableStringFieldUpdateOperationsInput, {nullable:true})
displayName?: NullableStringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
email?: StringFieldUpdateOperationsInput;

View File

@ -1,8 +1,8 @@
import { Field } from '@nestjs/graphql';
import { InputType } from '@nestjs/graphql';
import { StringFieldUpdateOperationsInput } from '../prisma/string-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { BoolFieldUpdateOperationsInput } from '../prisma/bool-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { NullableDateTimeFieldUpdateOperationsInput } from '../prisma/nullable-date-time-field-update-operations.input';
import { HideField } from '@nestjs/graphql';
import { GraphQLJSON } from 'graphql-type-json';
@ -24,9 +24,6 @@ export class UserUpdateWithoutCommentsInput {
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
lastName?: StringFieldUpdateOperationsInput;
@Field(() => NullableStringFieldUpdateOperationsInput, {nullable:true})
displayName?: NullableStringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
email?: StringFieldUpdateOperationsInput;

View File

@ -1,8 +1,8 @@
import { Field } from '@nestjs/graphql';
import { InputType } from '@nestjs/graphql';
import { StringFieldUpdateOperationsInput } from '../prisma/string-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { BoolFieldUpdateOperationsInput } from '../prisma/bool-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { NullableDateTimeFieldUpdateOperationsInput } from '../prisma/nullable-date-time-field-update-operations.input';
import { HideField } from '@nestjs/graphql';
import { GraphQLJSON } from 'graphql-type-json';
@ -24,9 +24,6 @@ export class UserUpdateWithoutCompaniesInput {
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
lastName?: StringFieldUpdateOperationsInput;
@Field(() => NullableStringFieldUpdateOperationsInput, {nullable:true})
displayName?: NullableStringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
email?: StringFieldUpdateOperationsInput;

View File

@ -1,8 +1,8 @@
import { Field } from '@nestjs/graphql';
import { InputType } from '@nestjs/graphql';
import { StringFieldUpdateOperationsInput } from '../prisma/string-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { BoolFieldUpdateOperationsInput } from '../prisma/bool-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { NullableDateTimeFieldUpdateOperationsInput } from '../prisma/nullable-date-time-field-update-operations.input';
import { HideField } from '@nestjs/graphql';
import { GraphQLJSON } from 'graphql-type-json';
@ -24,9 +24,6 @@ export class UserUpdateWithoutRefreshTokensInput {
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
lastName?: StringFieldUpdateOperationsInput;
@Field(() => NullableStringFieldUpdateOperationsInput, {nullable:true})
displayName?: NullableStringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
email?: StringFieldUpdateOperationsInput;

View File

@ -1,8 +1,8 @@
import { Field } from '@nestjs/graphql';
import { InputType } from '@nestjs/graphql';
import { StringFieldUpdateOperationsInput } from '../prisma/string-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { BoolFieldUpdateOperationsInput } from '../prisma/bool-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { NullableDateTimeFieldUpdateOperationsInput } from '../prisma/nullable-date-time-field-update-operations.input';
import { HideField } from '@nestjs/graphql';
import { GraphQLJSON } from 'graphql-type-json';
@ -24,9 +24,6 @@ export class UserUpdateWithoutWorkspaceMemberInput {
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
lastName?: StringFieldUpdateOperationsInput;
@Field(() => NullableStringFieldUpdateOperationsInput, {nullable:true})
displayName?: NullableStringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
email?: StringFieldUpdateOperationsInput;

View File

@ -1,8 +1,8 @@
import { Field } from '@nestjs/graphql';
import { InputType } from '@nestjs/graphql';
import { StringFieldUpdateOperationsInput } from '../prisma/string-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { BoolFieldUpdateOperationsInput } from '../prisma/bool-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { NullableDateTimeFieldUpdateOperationsInput } from '../prisma/nullable-date-time-field-update-operations.input';
import { HideField } from '@nestjs/graphql';
import { GraphQLJSON } from 'graphql-type-json';
@ -25,9 +25,6 @@ export class UserUpdateInput {
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
lastName?: StringFieldUpdateOperationsInput;
@Field(() => NullableStringFieldUpdateOperationsInput, {nullable:true})
displayName?: NullableStringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
email?: StringFieldUpdateOperationsInput;

View File

@ -1,8 +1,8 @@
import { Field } from '@nestjs/graphql';
import { InputType } from '@nestjs/graphql';
import { StringFilter } from '../prisma/string-filter.input';
import { StringNullableFilter } from '../prisma/string-nullable-filter.input';
import { BoolFilter } from '../prisma/bool-filter.input';
import { StringNullableFilter } from '../prisma/string-nullable-filter.input';
import { DateTimeNullableFilter } from '../prisma/date-time-nullable-filter.input';
import { HideField } from '@nestjs/graphql';
import { JsonNullableFilter } from '../prisma/json-nullable-filter.input';
@ -33,9 +33,6 @@ export class UserWhereInput {
@Field(() => StringFilter, {nullable:true})
lastName?: StringFilter;
@Field(() => StringNullableFilter, {nullable:true})
displayName?: StringNullableFilter;
@Field(() => StringFilter, {nullable:true})
email?: StringFilter;

View File

@ -21,9 +21,6 @@ export class User {
@Field(() => String, {nullable:false})
lastName!: string;
@HideField()
displayName!: string | null;
@Field(() => String, {nullable:false})
email!: string;

View File

@ -9,8 +9,8 @@ export class CreateManyWorkspaceMemberArgs {
@Field(() => [WorkspaceMemberCreateManyInput], {nullable:false})
@Type(() => WorkspaceMemberCreateManyInput)
@ValidateNested({each: true})
@Type(() => WorkspaceMemberCreateManyInput)
@ValidateNested({each: true})
data!: Array<WorkspaceMemberCreateManyInput>;
@Field(() => Boolean, {nullable:true})

View File

@ -9,7 +9,7 @@ export class CreateOneWorkspaceMemberArgs {
@Field(() => WorkspaceMemberCreateInput, {nullable:false})
@Type(() => WorkspaceMemberCreateInput)
@ValidateNested({each: true})
@Type(() => WorkspaceMemberCreateInput)
@ValidateNested({each: true})
data!: WorkspaceMemberCreateInput;
}

View File

@ -10,8 +10,8 @@ export class UpdateManyWorkspaceMemberArgs {
@Field(() => WorkspaceMemberUpdateManyMutationInput, {nullable:false})
@Type(() => WorkspaceMemberUpdateManyMutationInput)
@ValidateNested({each: true})
@Type(() => WorkspaceMemberUpdateManyMutationInput)
@ValidateNested({each: true})
data!: WorkspaceMemberUpdateManyMutationInput;
@Field(() => WorkspaceMemberWhereInput, {nullable:true})

View File

@ -10,8 +10,8 @@ export class UpdateOneWorkspaceMemberArgs {
@Field(() => WorkspaceMemberUpdateInput, {nullable:false})
@Type(() => WorkspaceMemberUpdateInput)
@ValidateNested({each: true})
@Type(() => WorkspaceMemberUpdateInput)
@ValidateNested({each: true})
data!: WorkspaceMemberUpdateInput;
@Field(() => WorkspaceMemberWhereUniqueInput, {nullable:false})

View File

@ -9,8 +9,8 @@ export class CreateManyWorkspaceArgs {
@Field(() => [WorkspaceCreateManyInput], {nullable:false})
@Type(() => WorkspaceCreateManyInput)
@ValidateNested({each: true})
@Type(() => WorkspaceCreateManyInput)
@ValidateNested({each: true})
data!: Array<WorkspaceCreateManyInput>;
@Field(() => Boolean, {nullable:true})

View File

@ -9,7 +9,7 @@ export class CreateOneWorkspaceArgs {
@Field(() => WorkspaceCreateInput, {nullable:false})
@Type(() => WorkspaceCreateInput)
@ValidateNested({each: true})
@Type(() => WorkspaceCreateInput)
@ValidateNested({each: true})
data!: WorkspaceCreateInput;
}

View File

@ -10,8 +10,8 @@ export class UpdateManyWorkspaceArgs {
@Field(() => WorkspaceUpdateManyMutationInput, {nullable:false})
@Type(() => WorkspaceUpdateManyMutationInput)
@ValidateNested({each: true})
@Type(() => WorkspaceUpdateManyMutationInput)
@ValidateNested({each: true})
data!: WorkspaceUpdateManyMutationInput;
@Field(() => WorkspaceWhereInput, {nullable:true})

View File

@ -10,8 +10,8 @@ export class UpdateOneWorkspaceArgs {
@Field(() => WorkspaceUpdateInput, {nullable:false})
@Type(() => WorkspaceUpdateInput)
@ValidateNested({each: true})
@Type(() => WorkspaceUpdateInput)
@ValidateNested({each: true})
data!: WorkspaceUpdateInput;
@Field(() => WorkspaceWhereUniqueInput, {nullable:false})

View File

@ -8,6 +8,11 @@ import { VerifyInput } from './dto/verify.input';
import { AuthService } from './services/auth.service';
import { LoginToken } from './dto/login-token.entity';
import { ChallengeInput } from './dto/challenge.input';
import {
PrismaSelect,
PrismaSelector,
} from 'src/decorators/prisma-select.decorator';
import { Prisma } from '@prisma/client';
@Resolver()
export class AuthResolver {
@ -25,11 +30,21 @@ export class AuthResolver {
}
@Mutation(() => Verify)
async verify(@Args() verifyInput: VerifyInput): Promise<Verify> {
async verify(
@Args() verifyInput: VerifyInput,
@PrismaSelector({
modelName: 'User',
defaultFields: { User: { id: true } },
})
prismaSelect: PrismaSelect<'User'>,
): Promise<Verify> {
const email = await this.tokenService.verifyLoginToken(
verifyInput.loginToken,
);
const result = await this.authService.verify(email);
const select = prismaSelect.valueOf('user') as Prisma.UserSelect & {
id: true;
};
const result = await this.authService.verify(email, select);
return result;
}

View File

@ -16,7 +16,13 @@ export class VerifyAuthController {
const email = await this.tokenService.verifyLoginToken(
verifyInput.loginToken,
);
const result = await this.authService.verify(email);
const result = await this.authService.verify(email, {
id: true,
firstName: true,
lastName: true,
email: true,
emailVerified: true,
});
return result;
}

View File

@ -5,5 +5,5 @@ import { User } from 'src/core/@generated/user/user.model';
@ObjectType()
export class Verify extends AuthTokens {
@Field(() => User)
user: User;
user: Partial<User>;
}

View File

@ -11,6 +11,7 @@ import { RegisterInput } from '../dto/register.input';
import { PASSWORD_REGEX, compareHash, hashPassword } from '../auth.util';
import { Verify } from '../dto/verify.entity';
import { TokenService } from './token.service';
import { Prisma } from '@prisma/client';
export type UserPayload = {
firstName: string;
@ -74,11 +75,17 @@ export class AuthService {
return user;
}
async verify(email: string): Promise<Verify> {
async verify(
email: string,
select: Prisma.UserSelect & {
id: true;
},
): Promise<Verify> {
const user = await this.userService.findUnique({
where: {
email,
},
select,
});
assert(user, "This user doesn't exist", NotFoundException);

View File

@ -1,8 +1,6 @@
import { Args, Resolver, Query, ResolveField, Parent } from '@nestjs/graphql';
import { UserService } from './user.service';
import { FindManyUserArgs } from 'src/core/@generated/user/find-many-user.args';
import { Workspace } from '@prisma/client';
import { AuthWorkspace } from 'src/decorators/auth-workspace.decorator';
import { User } from 'src/core/@generated/user/user.model';
import { ExceptionFilter } from 'src/filters/exception.filter';
import { UseFilters, UseGuards } from '@nestjs/common';
@ -31,7 +29,6 @@ export class UserResolver {
@CheckAbilities(ReadUserAbilityHandler)
async findManyUser(
@Args() args: FindManyUserArgs,
@AuthWorkspace() workspace: Workspace,
@UserAbility() ability: AppAbility,
@PrismaSelector({ modelName: 'User' })
prismaSelect: PrismaSelect<'User'>,
@ -51,11 +48,6 @@ export class UserResolver {
nullable: false,
})
displayName(@Parent() parent: User): string {
// TODO: Should be removed when displayName is removed from the database
if (!parent.firstName && !parent.lastName) {
return parent.displayName ?? '';
}
return `${parent.firstName} ${parent.lastName}`;
return `${parent.firstName ?? ''} ${parent.lastName ?? ''}`;
}
}

View File

@ -0,0 +1,10 @@
/*
Warnings:
- You are about to drop the column `displayName` on the `users` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "users" DROP COLUMN "displayName",
ALTER COLUMN "firstName" DROP DEFAULT,
ALTER COLUMN "lastName" DROP DEFAULT;

View File

@ -138,11 +138,6 @@ model User {
firstName String
/// @Validator.IsString()
lastName String
// @deprecated: Use `firstName` and `lastName` instead
/// @Validator.IsString()
/// @Validator.IsOptional()
/// @TypeGraphQL.omit(input: false, output: true)
displayName String?
/// @Validator.IsEmail()
email String @unique
/// @Validator.IsBoolean()

View File

@ -1,5 +1,6 @@
import { createParamDecorator, ExecutionContext } from '@nestjs/common';
import { GqlExecutionContext } from '@nestjs/graphql';
import merge from 'lodash.merge';
import {
PrismaSelect,
ModelSelectMap,
@ -8,6 +9,14 @@ import {
export { PrismaSelect };
const globalDefaultFields: DefaultFieldsMap = {
User: {
// Needed for displayName resolve field
firstName: true,
lastName: true,
},
};
export const PrismaSelector = createParamDecorator(
(
data: {
@ -20,7 +29,7 @@ export const PrismaSelector = createParamDecorator(
const info = gqlCtx.getInfo();
return new PrismaSelect(data.modelName, info, {
defaultFields: data.defaultFields,
defaultFields: merge(globalDefaultFields, data.defaultFields),
});
},
);

View File

@ -44,9 +44,9 @@ export class PrismaSelect<
mergeObject?: any,
) {
if (typeof filterByOrMergeObject === 'string') {
return super.valueOf(field, filterByOrMergeObject, mergeObject);
return super.valueOf(field, filterByOrMergeObject, mergeObject).select;
} else {
return super.valueOf(field, this.modelName, filterByOrMergeObject);
return super.valueOf(field, this.modelName, filterByOrMergeObject).select;
}
}

View File

@ -2872,6 +2872,13 @@
dependencies:
"@types/lodash" "*"
"@types/lodash.merge@^4.6.7":
version "4.6.7"
resolved "https://registry.yarnpkg.com/@types/lodash.merge/-/lodash.merge-4.6.7.tgz#0af6555dd8bc6568ef73e5e0d820a027362946b1"
integrity sha512-OwxUJ9E50gw3LnAefSHJPHaBLGEKmQBQ7CZe/xflHkyy/wH2zVyEIAKReHvVrrn7zKdF58p16We9kMfh7v0RRQ==
dependencies:
"@types/lodash" "*"
"@types/lodash@*":
version "4.14.195"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.195.tgz#bafc975b252eb6cea78882ce8a7b6bf22a6de632"
@ -6238,7 +6245,7 @@ lodash.memoize@4.x:
lodash.merge@^4.6.2:
version "4.6.2"
resolved "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz"
resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a"
integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==
lodash.omit@4.5.0: