fix: add firstName and lastName to user model (#473)

* fix: add firstname and lastanme to user model

* fix: avoid undefined in displayName resolve field

* fix: user firstName and lastName instead of firstname lastname

* fix: person table proper naming firstName lastName

* fix: migrate front with firstName and lastName

* fix: make front-graphql-generate not working
This commit is contained in:
Jérémy M
2023-06-29 17:11:15 +02:00
committed by GitHub
parent d9af205ccb
commit 097b278b11
100 changed files with 606 additions and 329 deletions

View File

@ -9,10 +9,10 @@ export class PersonCountAggregateInput {
id?: true;
@Field(() => Boolean, {nullable:true})
firstname?: true;
firstName?: true;
@Field(() => Boolean, {nullable:true})
lastname?: true;
lastName?: true;
@Field(() => Boolean, {nullable:true})
email?: true;

View File

@ -10,10 +10,10 @@ export class PersonCountAggregate {
id!: number;
@Field(() => Int, {nullable:false})
firstname!: number;
firstName!: number;
@Field(() => Int, {nullable:false})
lastname!: number;
lastName!: number;
@Field(() => Int, {nullable:false})
email!: number;

View File

@ -10,10 +10,10 @@ export class PersonCountOrderByAggregateInput {
id?: keyof typeof SortOrder;
@Field(() => SortOrder, {nullable:true})
firstname?: keyof typeof SortOrder;
firstName?: keyof typeof SortOrder;
@Field(() => SortOrder, {nullable:true})
lastname?: keyof typeof SortOrder;
lastName?: keyof typeof SortOrder;
@Field(() => SortOrder, {nullable:true})
email?: keyof typeof SortOrder;

View File

@ -13,11 +13,11 @@ export class PersonCreateManyCompanyInput {
@Field(() => String, {nullable:false})
@Validator.IsString()
firstname!: string;
firstName!: string;
@Field(() => String, {nullable:false})
@Validator.IsString()
lastname!: string;
lastName!: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()

View File

@ -13,11 +13,11 @@ export class PersonCreateManyWorkspaceInput {
@Field(() => String, {nullable:false})
@Validator.IsString()
firstname!: string;
firstName!: string;
@Field(() => String, {nullable:false})
@Validator.IsString()
lastname!: string;
lastName!: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()

View File

@ -13,11 +13,11 @@ export class PersonCreateManyInput {
@Field(() => String, {nullable:false})
@Validator.IsString()
firstname!: string;
firstName!: string;
@Field(() => String, {nullable:false})
@Validator.IsString()
lastname!: string;
lastName!: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()

View File

@ -14,11 +14,11 @@ export class PersonCreateWithoutCompanyInput {
@Field(() => String, {nullable:false})
@Validator.IsString()
firstname!: string;
firstName!: string;
@Field(() => String, {nullable:false})
@Validator.IsString()
lastname!: string;
lastName!: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()

View File

@ -14,11 +14,11 @@ export class PersonCreateWithoutWorkspaceInput {
@Field(() => String, {nullable:false})
@Validator.IsString()
firstname!: string;
firstName!: string;
@Field(() => String, {nullable:false})
@Validator.IsString()
lastname!: string;
lastName!: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()

View File

@ -15,11 +15,11 @@ export class PersonCreateInput {
@Field(() => String, {nullable:false})
@Validator.IsString()
firstname!: string;
firstName!: string;
@Field(() => String, {nullable:false})
@Validator.IsString()
lastname!: string;
lastName!: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()

View File

@ -16,11 +16,11 @@ export class PersonGroupBy {
@Field(() => String, {nullable:false})
@Validator.IsString()
firstname!: string;
firstName!: string;
@Field(() => String, {nullable:false})
@Validator.IsString()
lastname!: string;
lastName!: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()

View File

@ -9,10 +9,10 @@ export class PersonMaxAggregateInput {
id?: true;
@Field(() => Boolean, {nullable:true})
firstname?: true;
firstName?: true;
@Field(() => Boolean, {nullable:true})
lastname?: true;
lastName?: true;
@Field(() => Boolean, {nullable:true})
email?: true;

View File

@ -13,11 +13,11 @@ export class PersonMaxAggregate {
@Field(() => String, {nullable:true})
@Validator.IsString()
firstname?: string;
firstName?: string;
@Field(() => String, {nullable:true})
@Validator.IsString()
lastname?: string;
lastName?: string;
@Field(() => String, {nullable:true})
@Validator.IsEmail()

View File

@ -10,10 +10,10 @@ export class PersonMaxOrderByAggregateInput {
id?: keyof typeof SortOrder;
@Field(() => SortOrder, {nullable:true})
firstname?: keyof typeof SortOrder;
firstName?: keyof typeof SortOrder;
@Field(() => SortOrder, {nullable:true})
lastname?: keyof typeof SortOrder;
lastName?: keyof typeof SortOrder;
@Field(() => SortOrder, {nullable:true})
email?: keyof typeof SortOrder;

View File

@ -9,10 +9,10 @@ export class PersonMinAggregateInput {
id?: true;
@Field(() => Boolean, {nullable:true})
firstname?: true;
firstName?: true;
@Field(() => Boolean, {nullable:true})
lastname?: true;
lastName?: true;
@Field(() => Boolean, {nullable:true})
email?: true;

View File

@ -13,11 +13,11 @@ export class PersonMinAggregate {
@Field(() => String, {nullable:true})
@Validator.IsString()
firstname?: string;
firstName?: string;
@Field(() => String, {nullable:true})
@Validator.IsString()
lastname?: string;
lastName?: string;
@Field(() => String, {nullable:true})
@Validator.IsEmail()

View File

@ -10,10 +10,10 @@ export class PersonMinOrderByAggregateInput {
id?: keyof typeof SortOrder;
@Field(() => SortOrder, {nullable:true})
firstname?: keyof typeof SortOrder;
firstName?: keyof typeof SortOrder;
@Field(() => SortOrder, {nullable:true})
lastname?: keyof typeof SortOrder;
lastName?: keyof typeof SortOrder;
@Field(() => SortOrder, {nullable:true})
email?: keyof typeof SortOrder;

View File

@ -13,10 +13,10 @@ export class PersonOrderByWithAggregationInput {
id?: keyof typeof SortOrder;
@Field(() => SortOrder, {nullable:true})
firstname?: keyof typeof SortOrder;
firstName?: keyof typeof SortOrder;
@Field(() => SortOrder, {nullable:true})
lastname?: keyof typeof SortOrder;
lastName?: keyof typeof SortOrder;
@Field(() => SortOrder, {nullable:true})
email?: keyof typeof SortOrder;

View File

@ -12,10 +12,10 @@ export class PersonOrderByWithRelationInput {
id?: keyof typeof SortOrder;
@Field(() => SortOrder, {nullable:true})
firstname?: keyof typeof SortOrder;
firstName?: keyof typeof SortOrder;
@Field(() => SortOrder, {nullable:true})
lastname?: keyof typeof SortOrder;
lastName?: keyof typeof SortOrder;
@Field(() => SortOrder, {nullable:true})
email?: keyof typeof SortOrder;

View File

@ -2,8 +2,8 @@ import { registerEnumType } from '@nestjs/graphql';
export enum PersonScalarFieldEnum {
id = "id",
firstname = "firstname",
lastname = "lastname",
firstName = "firstName",
lastName = "lastName",
email = "email",
phone = "phone",
city = "city",

View File

@ -22,10 +22,10 @@ export class PersonScalarWhereWithAggregatesInput {
id?: StringWithAggregatesFilter;
@Field(() => StringWithAggregatesFilter, {nullable:true})
firstname?: StringWithAggregatesFilter;
firstName?: StringWithAggregatesFilter;
@Field(() => StringWithAggregatesFilter, {nullable:true})
lastname?: StringWithAggregatesFilter;
lastName?: StringWithAggregatesFilter;
@Field(() => StringWithAggregatesFilter, {nullable:true})
email?: StringWithAggregatesFilter;

View File

@ -22,10 +22,10 @@ export class PersonScalarWhereInput {
id?: StringFilter;
@Field(() => StringFilter, {nullable:true})
firstname?: StringFilter;
firstName?: StringFilter;
@Field(() => StringFilter, {nullable:true})
lastname?: StringFilter;
lastName?: StringFilter;
@Field(() => StringFilter, {nullable:true})
email?: StringFilter;

View File

@ -13,11 +13,11 @@ export class PersonUncheckedCreateWithoutCompanyInput {
@Field(() => String, {nullable:false})
@Validator.IsString()
firstname!: string;
firstName!: string;
@Field(() => String, {nullable:false})
@Validator.IsString()
lastname!: string;
lastName!: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()

View File

@ -13,11 +13,11 @@ export class PersonUncheckedCreateWithoutWorkspaceInput {
@Field(() => String, {nullable:false})
@Validator.IsString()
firstname!: string;
firstName!: string;
@Field(() => String, {nullable:false})
@Validator.IsString()
lastname!: string;
lastName!: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()

View File

@ -13,11 +13,11 @@ export class PersonUncheckedCreateInput {
@Field(() => String, {nullable:false})
@Validator.IsString()
firstname!: string;
firstName!: string;
@Field(() => String, {nullable:false})
@Validator.IsString()
lastname!: string;
lastName!: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()

View File

@ -13,10 +13,10 @@ export class PersonUncheckedUpdateManyWithoutPeopleInput {
id?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
firstname?: StringFieldUpdateOperationsInput;
firstName?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
lastname?: StringFieldUpdateOperationsInput;
lastName?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
email?: StringFieldUpdateOperationsInput;

View File

@ -13,10 +13,10 @@ export class PersonUncheckedUpdateManyInput {
id?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
firstname?: StringFieldUpdateOperationsInput;
firstName?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
lastname?: StringFieldUpdateOperationsInput;
lastName?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
email?: StringFieldUpdateOperationsInput;

View File

@ -12,10 +12,10 @@ export class PersonUncheckedUpdateWithoutCompanyInput {
id?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
firstname?: StringFieldUpdateOperationsInput;
firstName?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
lastname?: StringFieldUpdateOperationsInput;
lastName?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
email?: StringFieldUpdateOperationsInput;

View File

@ -13,10 +13,10 @@ export class PersonUncheckedUpdateWithoutWorkspaceInput {
id?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
firstname?: StringFieldUpdateOperationsInput;
firstName?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
lastname?: StringFieldUpdateOperationsInput;
lastName?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
email?: StringFieldUpdateOperationsInput;

View File

@ -13,10 +13,10 @@ export class PersonUncheckedUpdateInput {
id?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
firstname?: StringFieldUpdateOperationsInput;
firstName?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
lastname?: StringFieldUpdateOperationsInput;
lastName?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
email?: StringFieldUpdateOperationsInput;

View File

@ -12,10 +12,10 @@ export class PersonUpdateManyMutationInput {
id?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
firstname?: StringFieldUpdateOperationsInput;
firstName?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
lastname?: StringFieldUpdateOperationsInput;
lastName?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
email?: StringFieldUpdateOperationsInput;

View File

@ -13,10 +13,10 @@ export class PersonUpdateWithoutCompanyInput {
id?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
firstname?: StringFieldUpdateOperationsInput;
firstName?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
lastname?: StringFieldUpdateOperationsInput;
lastName?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
email?: StringFieldUpdateOperationsInput;

View File

@ -13,10 +13,10 @@ export class PersonUpdateWithoutWorkspaceInput {
id?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
firstname?: StringFieldUpdateOperationsInput;
firstName?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
lastname?: StringFieldUpdateOperationsInput;
lastName?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
email?: StringFieldUpdateOperationsInput;

View File

@ -14,10 +14,10 @@ export class PersonUpdateInput {
id?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
firstname?: StringFieldUpdateOperationsInput;
firstName?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
lastname?: StringFieldUpdateOperationsInput;
lastName?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
email?: StringFieldUpdateOperationsInput;

View File

@ -24,10 +24,10 @@ export class PersonWhereInput {
id?: StringFilter;
@Field(() => StringFilter, {nullable:true})
firstname?: StringFilter;
firstName?: StringFilter;
@Field(() => StringFilter, {nullable:true})
lastname?: StringFilter;
lastName?: StringFilter;
@Field(() => StringFilter, {nullable:true})
email?: StringFilter;

View File

@ -12,10 +12,10 @@ export class Person {
id!: string;
@Field(() => String, {nullable:false})
firstname!: string;
firstName!: string;
@Field(() => String, {nullable:false})
lastname!: string;
lastName!: string;
@Field(() => String, {nullable:false})
email!: string;

View File

@ -8,6 +8,12 @@ export class UserCountAggregateInput {
@Field(() => Boolean, {nullable:true})
id?: true;
@Field(() => Boolean, {nullable:true})
firstName?: true;
@Field(() => Boolean, {nullable:true})
lastName?: true;
@Field(() => Boolean, {nullable:true})
displayName?: true;

View File

@ -10,6 +10,12 @@ export class UserCountAggregate {
id!: number;
@Field(() => Int, {nullable:false})
firstName!: number;
@Field(() => Int, {nullable:false})
lastName!: number;
@HideField()
displayName!: number;
@Field(() => Int, {nullable:false})

View File

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

View File

@ -14,8 +14,16 @@ export class UserCreateManyInput {
@Field(() => String, {nullable:false})
@Validator.IsString()
firstName!: string;
@Field(() => String, {nullable:false})
@Validator.IsString()
lastName!: string;
@Field(() => String, {nullable:true})
@Validator.IsString()
@Validator.IsOptional()
displayName!: string;
displayName?: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()

View File

@ -17,8 +17,16 @@ export class UserCreateWithoutCommentsInput {
@Field(() => String, {nullable:false})
@Validator.IsString()
firstName!: string;
@Field(() => String, {nullable:false})
@Validator.IsString()
lastName!: string;
@Field(() => String, {nullable:true})
@Validator.IsString()
@Validator.IsOptional()
displayName!: string;
displayName?: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()

View File

@ -17,8 +17,16 @@ export class UserCreateWithoutCompaniesInput {
@Field(() => String, {nullable:false})
@Validator.IsString()
firstName!: string;
@Field(() => String, {nullable:false})
@Validator.IsString()
lastName!: string;
@Field(() => String, {nullable:true})
@Validator.IsString()
@Validator.IsOptional()
displayName!: string;
displayName?: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()

View File

@ -17,8 +17,16 @@ export class UserCreateWithoutRefreshTokensInput {
@Field(() => String, {nullable:false})
@Validator.IsString()
firstName!: string;
@Field(() => String, {nullable:false})
@Validator.IsString()
lastName!: string;
@Field(() => String, {nullable:true})
@Validator.IsString()
@Validator.IsOptional()
displayName!: string;
displayName?: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()

View File

@ -17,8 +17,16 @@ export class UserCreateWithoutWorkspaceMemberInput {
@Field(() => String, {nullable:false})
@Validator.IsString()
firstName!: string;
@Field(() => String, {nullable:false})
@Validator.IsString()
lastName!: string;
@Field(() => String, {nullable:true})
@Validator.IsString()
@Validator.IsOptional()
displayName!: string;
displayName?: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()

View File

@ -18,8 +18,16 @@ export class UserCreateInput {
@Field(() => String, {nullable:false})
@Validator.IsString()
firstName!: string;
@Field(() => String, {nullable:false})
@Validator.IsString()
lastName!: string;
@Field(() => String, {nullable:true})
@Validator.IsString()
@Validator.IsOptional()
displayName!: string;
displayName?: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()

View File

@ -17,8 +17,14 @@ export class UserGroupBy {
@Field(() => String, {nullable:false})
@Validator.IsString()
@Validator.IsOptional()
displayName!: string;
firstName!: string;
@Field(() => String, {nullable:false})
@Validator.IsString()
lastName!: string;
@HideField()
displayName?: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()

View File

@ -8,6 +8,12 @@ export class UserMaxAggregateInput {
@Field(() => Boolean, {nullable:true})
id?: true;
@Field(() => Boolean, {nullable:true})
firstName?: true;
@Field(() => Boolean, {nullable:true})
lastName?: true;
@Field(() => Boolean, {nullable:true})
displayName?: true;

View File

@ -13,7 +13,13 @@ export class UserMaxAggregate {
@Field(() => String, {nullable:true})
@Validator.IsString()
@Validator.IsOptional()
firstName?: string;
@Field(() => String, {nullable:true})
@Validator.IsString()
lastName?: string;
@HideField()
displayName?: string;
@Field(() => String, {nullable:true})

View File

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

View File

@ -8,6 +8,12 @@ export class UserMinAggregateInput {
@Field(() => Boolean, {nullable:true})
id?: true;
@Field(() => Boolean, {nullable:true})
firstName?: true;
@Field(() => Boolean, {nullable:true})
lastName?: true;
@Field(() => Boolean, {nullable:true})
displayName?: true;

View File

@ -13,7 +13,13 @@ export class UserMinAggregate {
@Field(() => String, {nullable:true})
@Validator.IsString()
@Validator.IsOptional()
firstName?: string;
@Field(() => String, {nullable:true})
@Validator.IsString()
lastName?: string;
@HideField()
displayName?: string;
@Field(() => String, {nullable:true})

View File

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

View File

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

View File

@ -13,6 +13,12 @@ export class UserOrderByWithRelationInput {
@Field(() => SortOrder, {nullable:true})
id?: keyof typeof SortOrder;
@Field(() => SortOrder, {nullable:true})
firstName?: keyof typeof SortOrder;
@Field(() => SortOrder, {nullable:true})
lastName?: keyof typeof SortOrder;
@Field(() => SortOrder, {nullable:true})
displayName?: keyof typeof SortOrder;

View File

@ -2,6 +2,8 @@ import { registerEnumType } from '@nestjs/graphql';
export enum UserScalarFieldEnum {
id = "id",
firstName = "firstName",
lastName = "lastName",
displayName = "displayName",
email = "email",
emailVerified = "emailVerified",

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 { BoolWithAggregatesFilter } from '../prisma/bool-with-aggregates-filter.input';
import { StringNullableWithAggregatesFilter } from '../prisma/string-nullable-with-aggregates-filter.input';
import { BoolWithAggregatesFilter } from '../prisma/bool-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';
@ -24,7 +24,13 @@ export class UserScalarWhereWithAggregatesInput {
id?: StringWithAggregatesFilter;
@Field(() => StringWithAggregatesFilter, {nullable:true})
displayName?: StringWithAggregatesFilter;
firstName?: StringWithAggregatesFilter;
@Field(() => StringWithAggregatesFilter, {nullable:true})
lastName?: StringWithAggregatesFilter;
@Field(() => StringNullableWithAggregatesFilter, {nullable:true})
displayName?: StringNullableWithAggregatesFilter;
@Field(() => StringWithAggregatesFilter, {nullable:true})
email?: StringWithAggregatesFilter;

View File

@ -17,8 +17,16 @@ export class UserUncheckedCreateWithoutCommentsInput {
@Field(() => String, {nullable:false})
@Validator.IsString()
firstName!: string;
@Field(() => String, {nullable:false})
@Validator.IsString()
lastName!: string;
@Field(() => String, {nullable:true})
@Validator.IsString()
@Validator.IsOptional()
displayName!: string;
displayName?: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()

View File

@ -17,8 +17,16 @@ export class UserUncheckedCreateWithoutCompaniesInput {
@Field(() => String, {nullable:false})
@Validator.IsString()
firstName!: string;
@Field(() => String, {nullable:false})
@Validator.IsString()
lastName!: string;
@Field(() => String, {nullable:true})
@Validator.IsString()
@Validator.IsOptional()
displayName!: string;
displayName?: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()

View File

@ -17,8 +17,16 @@ export class UserUncheckedCreateWithoutRefreshTokensInput {
@Field(() => String, {nullable:false})
@Validator.IsString()
firstName!: string;
@Field(() => String, {nullable:false})
@Validator.IsString()
lastName!: string;
@Field(() => String, {nullable:true})
@Validator.IsString()
@Validator.IsOptional()
displayName!: string;
displayName?: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()

View File

@ -17,8 +17,16 @@ export class UserUncheckedCreateWithoutWorkspaceMemberInput {
@Field(() => String, {nullable:false})
@Validator.IsString()
firstName!: string;
@Field(() => String, {nullable:false})
@Validator.IsString()
lastName!: string;
@Field(() => String, {nullable:true})
@Validator.IsString()
@Validator.IsOptional()
displayName!: string;
displayName?: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()

View File

@ -18,8 +18,16 @@ export class UserUncheckedCreateInput {
@Field(() => String, {nullable:false})
@Validator.IsString()
firstName!: string;
@Field(() => String, {nullable:false})
@Validator.IsString()
lastName!: string;
@Field(() => String, {nullable:true})
@Validator.IsString()
@Validator.IsOptional()
displayName!: string;
displayName?: string;
@Field(() => String, {nullable:false})
@Validator.IsEmail()

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 { BoolFieldUpdateOperationsInput } from '../prisma/bool-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { BoolFieldUpdateOperationsInput } from '../prisma/bool-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';
@ -16,7 +16,13 @@ export class UserUncheckedUpdateManyInput {
id?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
displayName?: StringFieldUpdateOperationsInput;
firstName?: StringFieldUpdateOperationsInput;
@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 { BoolFieldUpdateOperationsInput } from '../prisma/bool-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { BoolFieldUpdateOperationsInput } from '../prisma/bool-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';
@ -19,7 +19,13 @@ export class UserUncheckedUpdateWithoutCommentsInput {
id?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
displayName?: StringFieldUpdateOperationsInput;
firstName?: StringFieldUpdateOperationsInput;
@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 { BoolFieldUpdateOperationsInput } from '../prisma/bool-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { BoolFieldUpdateOperationsInput } from '../prisma/bool-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';
@ -19,7 +19,13 @@ export class UserUncheckedUpdateWithoutCompaniesInput {
id?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
displayName?: StringFieldUpdateOperationsInput;
firstName?: StringFieldUpdateOperationsInput;
@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 { BoolFieldUpdateOperationsInput } from '../prisma/bool-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { BoolFieldUpdateOperationsInput } from '../prisma/bool-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';
@ -19,7 +19,13 @@ export class UserUncheckedUpdateWithoutRefreshTokensInput {
id?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
displayName?: StringFieldUpdateOperationsInput;
firstName?: StringFieldUpdateOperationsInput;
@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 { BoolFieldUpdateOperationsInput } from '../prisma/bool-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { BoolFieldUpdateOperationsInput } from '../prisma/bool-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';
@ -19,7 +19,13 @@ export class UserUncheckedUpdateWithoutWorkspaceMemberInput {
id?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
displayName?: StringFieldUpdateOperationsInput;
firstName?: StringFieldUpdateOperationsInput;
@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 { BoolFieldUpdateOperationsInput } from '../prisma/bool-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { BoolFieldUpdateOperationsInput } from '../prisma/bool-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';
@ -20,7 +20,13 @@ export class UserUncheckedUpdateInput {
id?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
displayName?: StringFieldUpdateOperationsInput;
firstName?: StringFieldUpdateOperationsInput;
@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 { BoolFieldUpdateOperationsInput } from '../prisma/bool-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { BoolFieldUpdateOperationsInput } from '../prisma/bool-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';
@ -16,7 +16,13 @@ export class UserUpdateManyMutationInput {
id?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
displayName?: StringFieldUpdateOperationsInput;
firstName?: StringFieldUpdateOperationsInput;
@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 { BoolFieldUpdateOperationsInput } from '../prisma/bool-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { BoolFieldUpdateOperationsInput } from '../prisma/bool-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';
@ -19,7 +19,13 @@ export class UserUpdateWithoutCommentsInput {
id?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
displayName?: StringFieldUpdateOperationsInput;
firstName?: StringFieldUpdateOperationsInput;
@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 { BoolFieldUpdateOperationsInput } from '../prisma/bool-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { BoolFieldUpdateOperationsInput } from '../prisma/bool-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';
@ -19,7 +19,13 @@ export class UserUpdateWithoutCompaniesInput {
id?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
displayName?: StringFieldUpdateOperationsInput;
firstName?: StringFieldUpdateOperationsInput;
@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 { BoolFieldUpdateOperationsInput } from '../prisma/bool-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { BoolFieldUpdateOperationsInput } from '../prisma/bool-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';
@ -19,7 +19,13 @@ export class UserUpdateWithoutRefreshTokensInput {
id?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
displayName?: StringFieldUpdateOperationsInput;
firstName?: StringFieldUpdateOperationsInput;
@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 { BoolFieldUpdateOperationsInput } from '../prisma/bool-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { BoolFieldUpdateOperationsInput } from '../prisma/bool-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';
@ -19,7 +19,13 @@ export class UserUpdateWithoutWorkspaceMemberInput {
id?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
displayName?: StringFieldUpdateOperationsInput;
firstName?: StringFieldUpdateOperationsInput;
@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 { BoolFieldUpdateOperationsInput } from '../prisma/bool-field-update-operations.input';
import { NullableStringFieldUpdateOperationsInput } from '../prisma/nullable-string-field-update-operations.input';
import { BoolFieldUpdateOperationsInput } from '../prisma/bool-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';
@ -20,7 +20,13 @@ export class UserUpdateInput {
id?: StringFieldUpdateOperationsInput;
@Field(() => StringFieldUpdateOperationsInput, {nullable:true})
displayName?: StringFieldUpdateOperationsInput;
firstName?: StringFieldUpdateOperationsInput;
@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 { BoolFilter } from '../prisma/bool-filter.input';
import { StringNullableFilter } from '../prisma/string-nullable-filter.input';
import { BoolFilter } from '../prisma/bool-filter.input';
import { DateTimeNullableFilter } from '../prisma/date-time-nullable-filter.input';
import { HideField } from '@nestjs/graphql';
import { JsonNullableFilter } from '../prisma/json-nullable-filter.input';
@ -28,7 +28,13 @@ export class UserWhereInput {
id?: StringFilter;
@Field(() => StringFilter, {nullable:true})
displayName?: StringFilter;
firstName?: StringFilter;
@Field(() => StringFilter, {nullable:true})
lastName?: StringFilter;
@Field(() => StringNullableFilter, {nullable:true})
displayName?: StringNullableFilter;
@Field(() => StringFilter, {nullable:true})
email?: StringFilter;

View File

@ -16,7 +16,13 @@ export class User {
id!: string;
@Field(() => String, {nullable:false})
displayName!: string;
firstName!: string;
@Field(() => String, {nullable:false})
lastName!: string;
@HideField()
displayName!: string | null;
@Field(() => String, {nullable:false})
email!: string;

View File

@ -10,7 +10,6 @@ import { AuthGuard } from '@nestjs/passport';
import { Response } from 'express';
import { GoogleRequest } from '../strategies/google.auth.strategy';
import { UserService } from '../../user/user.service';
import { assertNotNull } from 'src/utils/assert';
import { TokenService } from '../services/token.service';
@Controller('auth/google')
@ -31,12 +30,12 @@ export class GoogleAuthController {
@UseGuards(AuthGuard('google'))
async googleAuthRedirect(@Req() req: GoogleRequest, @Res() res: Response) {
const { firstName, lastName, email } = req.user;
const displayName = [firstName, lastName].filter(assertNotNull).join(' ');
const user = await this.userService.createUser({
data: {
email,
displayName,
firstName: firstName ?? '',
lastName: lastName ?? '',
locale: 'en',
},
});

View File

@ -1,6 +1,7 @@
import {
IsEmail,
IsNotEmpty,
IsOptional,
IsString,
Matches,
MinLength,
@ -22,8 +23,21 @@ export class RegisterInput {
@Matches(PASSWORD_REGEX, { message: 'password too weak' })
password: string;
@Field(() => String, {
deprecationReason: 'Deprecated, please use firstName and lastName instead',
nullable: true,
})
@IsOptional()
@IsString()
displayName?: string;
@Field(() => String)
@IsNotEmpty()
@IsString()
displayName: string;
firstName: string;
@Field(() => String)
@IsNotEmpty()
@IsString()
lastName: string;
}

View File

@ -43,7 +43,8 @@ export class AuthService {
const user = await this.userService.createUser({
data: {
displayName: registerInput.displayName,
firstName: registerInput.firstName,
lastName: registerInput.lastName,
email: registerInput.email,
passwordHash,
locale: 'en',

View File

@ -1,4 +1,4 @@
import * as TypeGraphQL from '@nestjs/graphql';
import { Resolver, ResolveField, Root, Int } from '@nestjs/graphql';
import { CommentThread } from 'src/core/@generated/comment-thread/comment-thread.model';
import { Comment } from 'src/core/@generated/comment/comment.model';
import { Company } from 'src/core/@generated/company/company.model';
@ -9,18 +9,18 @@ import {
PrismaSelector,
} from 'src/decorators/prisma-select.decorator';
@TypeGraphQL.Resolver(() => Company)
@Resolver(() => Company)
export class CompanyRelationsResolver {
constructor(
private readonly commentThreadService: CommentThreadService,
private readonly commentService: CommentService,
) {}
@TypeGraphQL.ResolveField(() => [CommentThread], {
@ResolveField(() => [CommentThread], {
nullable: false,
})
async commentThreads(
@TypeGraphQL.Root() company: Company,
@Root() company: Company,
@PrismaSelector({ modelName: 'CommentThread' })
prismaSelect: PrismaSelect<'CommentThread'>,
): Promise<Partial<CommentThread>[]> {
@ -37,11 +37,11 @@ export class CompanyRelationsResolver {
});
}
@TypeGraphQL.ResolveField(() => [Comment], {
@ResolveField(() => [Comment], {
nullable: false,
})
async comments(
@TypeGraphQL.Root() company: Company,
@Root() company: Company,
@PrismaSelector({ modelName: 'Comment' })
prismaSelect: PrismaSelect<'Comment'>,
): Promise<Partial<Comment>[]> {
@ -60,10 +60,10 @@ export class CompanyRelationsResolver {
});
}
@TypeGraphQL.ResolveField(() => TypeGraphQL.Int, {
@ResolveField(() => Int, {
nullable: false,
})
async _commentCount(@TypeGraphQL.Root() company: Company): Promise<number> {
async _commentCount(@Root() company: Company): Promise<number> {
return this.commentService.count({
where: {
commentThread: {

View File

@ -1,4 +1,4 @@
import * as TypeGraphQL from '@nestjs/graphql';
import { Resolver, Root, ResolveField, Int } from '@nestjs/graphql';
import { CommentThread } from 'src/core/@generated/comment-thread/comment-thread.model';
import { Comment } from 'src/core/@generated/comment/comment.model';
import { Person } from 'src/core/@generated/person/person.model';
@ -9,18 +9,18 @@ import {
PrismaSelector,
} from 'src/decorators/prisma-select.decorator';
@TypeGraphQL.Resolver(() => Person)
@Resolver(() => Person)
export class PersonRelationsResolver {
constructor(
private readonly commentThreadService: CommentThreadService,
private readonly commentService: CommentService,
) {}
@TypeGraphQL.ResolveField(() => [CommentThread], {
@ResolveField(() => [CommentThread], {
nullable: false,
})
async commentThreads(
@TypeGraphQL.Root() person: Person,
@Root() person: Person,
@PrismaSelector({ modelName: 'CommentThread' })
prismaSelect: PrismaSelect<'CommentThread'>,
): Promise<Partial<CommentThread>[]> {
@ -37,11 +37,11 @@ export class PersonRelationsResolver {
});
}
@TypeGraphQL.ResolveField(() => [Comment], {
@ResolveField(() => [Comment], {
nullable: false,
})
async comments(
@TypeGraphQL.Root() person: Person,
@Root() person: Person,
@PrismaSelector({ modelName: 'Comment' })
prismaSelect: PrismaSelect<'Comment'>,
): Promise<Partial<Comment>[]> {
@ -60,10 +60,10 @@ export class PersonRelationsResolver {
});
}
@TypeGraphQL.ResolveField(() => TypeGraphQL.Int, {
@ResolveField(() => Int, {
nullable: false,
})
async _commentCount(@TypeGraphQL.Root() person: Person): Promise<number> {
async _commentCount(@Root() person: Person): Promise<number> {
return this.commentService.count({
where: {
commentThread: {

View File

@ -1,4 +1,4 @@
import { Args, Resolver, Query } from '@nestjs/graphql';
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';
@ -46,4 +46,16 @@ export class UserResolver {
select: prismaSelect.value,
});
}
@ResolveField(() => String, {
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}`;
}
}

View File

@ -1,5 +1,5 @@
import * as TypeGraphQL from '@nestjs/graphql';
import { Resolver } from '@nestjs/graphql';
import { WorkspaceMember } from '../../@generated/workspace-member/workspace-member.model';
@TypeGraphQL.Resolver(() => WorkspaceMember)
@Resolver(() => WorkspaceMember)
export class WorkspaceMemberResolver {}