Scope server with workspace (#157)
* Rename User to AuthUser to avoid naming conflict with user business entity * Prevent query by workspace in graphql * Make full user and workspace object available in graphql resolvers * Add Seed to create companies and people accross two workspace * Check workspace on all entities findMany, find, create, update)
This commit is contained in:
@ -67,30 +67,6 @@ export type CompanyCreateInput = {
|
|||||||
updatedAt?: InputMaybe<Scalars['DateTime']>;
|
updatedAt?: InputMaybe<Scalars['DateTime']>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CompanyCreateManyWorkspaceInput = {
|
|
||||||
accountOwnerId?: InputMaybe<Scalars['String']>;
|
|
||||||
address: Scalars['String'];
|
|
||||||
createdAt?: InputMaybe<Scalars['DateTime']>;
|
|
||||||
deletedAt?: InputMaybe<Scalars['DateTime']>;
|
|
||||||
domainName: Scalars['String'];
|
|
||||||
employees?: InputMaybe<Scalars['Int']>;
|
|
||||||
id: Scalars['String'];
|
|
||||||
name: Scalars['String'];
|
|
||||||
updatedAt?: InputMaybe<Scalars['DateTime']>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type CompanyCreateManyWorkspaceInputEnvelope = {
|
|
||||||
data: Array<CompanyCreateManyWorkspaceInput>;
|
|
||||||
skipDuplicates?: InputMaybe<Scalars['Boolean']>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type CompanyCreateNestedManyWithoutWorkspaceInput = {
|
|
||||||
connect?: InputMaybe<Array<CompanyWhereUniqueInput>>;
|
|
||||||
connectOrCreate?: InputMaybe<Array<CompanyCreateOrConnectWithoutWorkspaceInput>>;
|
|
||||||
create?: InputMaybe<Array<CompanyCreateWithoutWorkspaceInput>>;
|
|
||||||
createMany?: InputMaybe<CompanyCreateManyWorkspaceInputEnvelope>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type CompanyCreateNestedOneWithoutPeopleInput = {
|
export type CompanyCreateNestedOneWithoutPeopleInput = {
|
||||||
connect?: InputMaybe<CompanyWhereUniqueInput>;
|
connect?: InputMaybe<CompanyWhereUniqueInput>;
|
||||||
connectOrCreate?: InputMaybe<CompanyCreateOrConnectWithoutPeopleInput>;
|
connectOrCreate?: InputMaybe<CompanyCreateOrConnectWithoutPeopleInput>;
|
||||||
@ -102,11 +78,6 @@ export type CompanyCreateOrConnectWithoutPeopleInput = {
|
|||||||
where: CompanyWhereUniqueInput;
|
where: CompanyWhereUniqueInput;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CompanyCreateOrConnectWithoutWorkspaceInput = {
|
|
||||||
create: CompanyCreateWithoutWorkspaceInput;
|
|
||||||
where: CompanyWhereUniqueInput;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type CompanyCreateWithoutPeopleInput = {
|
export type CompanyCreateWithoutPeopleInput = {
|
||||||
accountOwner?: InputMaybe<UserCreateNestedOneWithoutCompaniesInput>;
|
accountOwner?: InputMaybe<UserCreateNestedOneWithoutCompaniesInput>;
|
||||||
address: Scalars['String'];
|
address: Scalars['String'];
|
||||||
@ -119,19 +90,6 @@ export type CompanyCreateWithoutPeopleInput = {
|
|||||||
updatedAt?: InputMaybe<Scalars['DateTime']>;
|
updatedAt?: InputMaybe<Scalars['DateTime']>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CompanyCreateWithoutWorkspaceInput = {
|
|
||||||
accountOwner?: InputMaybe<UserCreateNestedOneWithoutCompaniesInput>;
|
|
||||||
address: Scalars['String'];
|
|
||||||
createdAt?: InputMaybe<Scalars['DateTime']>;
|
|
||||||
deletedAt?: InputMaybe<Scalars['DateTime']>;
|
|
||||||
domainName: Scalars['String'];
|
|
||||||
employees?: InputMaybe<Scalars['Int']>;
|
|
||||||
id: Scalars['String'];
|
|
||||||
name: Scalars['String'];
|
|
||||||
people?: InputMaybe<PersonCreateNestedManyWithoutCompanyInput>;
|
|
||||||
updatedAt?: InputMaybe<Scalars['DateTime']>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type CompanyListRelationFilter = {
|
export type CompanyListRelationFilter = {
|
||||||
every?: InputMaybe<CompanyWhereInput>;
|
every?: InputMaybe<CompanyWhereInput>;
|
||||||
none?: InputMaybe<CompanyWhereInput>;
|
none?: InputMaybe<CompanyWhereInput>;
|
||||||
@ -174,21 +132,6 @@ export enum CompanyScalarFieldEnum {
|
|||||||
WorkspaceId = 'workspaceId'
|
WorkspaceId = 'workspaceId'
|
||||||
}
|
}
|
||||||
|
|
||||||
export type CompanyScalarWhereInput = {
|
|
||||||
AND?: InputMaybe<Array<CompanyScalarWhereInput>>;
|
|
||||||
NOT?: InputMaybe<Array<CompanyScalarWhereInput>>;
|
|
||||||
OR?: InputMaybe<Array<CompanyScalarWhereInput>>;
|
|
||||||
accountOwnerId?: InputMaybe<StringNullableFilter>;
|
|
||||||
address?: InputMaybe<StringFilter>;
|
|
||||||
createdAt?: InputMaybe<DateTimeFilter>;
|
|
||||||
deletedAt?: InputMaybe<DateTimeNullableFilter>;
|
|
||||||
domainName?: InputMaybe<StringFilter>;
|
|
||||||
employees?: InputMaybe<IntNullableFilter>;
|
|
||||||
id?: InputMaybe<StringFilter>;
|
|
||||||
name?: InputMaybe<StringFilter>;
|
|
||||||
updatedAt?: InputMaybe<DateTimeFilter>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type CompanyUpdateInput = {
|
export type CompanyUpdateInput = {
|
||||||
accountOwner?: InputMaybe<UserUpdateOneWithoutCompaniesNestedInput>;
|
accountOwner?: InputMaybe<UserUpdateOneWithoutCompaniesNestedInput>;
|
||||||
address?: InputMaybe<StringFieldUpdateOperationsInput>;
|
address?: InputMaybe<StringFieldUpdateOperationsInput>;
|
||||||
@ -202,36 +145,6 @@ export type CompanyUpdateInput = {
|
|||||||
updatedAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
|
updatedAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CompanyUpdateManyMutationInput = {
|
|
||||||
address?: InputMaybe<StringFieldUpdateOperationsInput>;
|
|
||||||
createdAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
|
|
||||||
deletedAt?: InputMaybe<NullableDateTimeFieldUpdateOperationsInput>;
|
|
||||||
domainName?: InputMaybe<StringFieldUpdateOperationsInput>;
|
|
||||||
employees?: InputMaybe<NullableIntFieldUpdateOperationsInput>;
|
|
||||||
id?: InputMaybe<StringFieldUpdateOperationsInput>;
|
|
||||||
name?: InputMaybe<StringFieldUpdateOperationsInput>;
|
|
||||||
updatedAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type CompanyUpdateManyWithWhereWithoutWorkspaceInput = {
|
|
||||||
data: CompanyUpdateManyMutationInput;
|
|
||||||
where: CompanyScalarWhereInput;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type CompanyUpdateManyWithoutWorkspaceNestedInput = {
|
|
||||||
connect?: InputMaybe<Array<CompanyWhereUniqueInput>>;
|
|
||||||
connectOrCreate?: InputMaybe<Array<CompanyCreateOrConnectWithoutWorkspaceInput>>;
|
|
||||||
create?: InputMaybe<Array<CompanyCreateWithoutWorkspaceInput>>;
|
|
||||||
createMany?: InputMaybe<CompanyCreateManyWorkspaceInputEnvelope>;
|
|
||||||
delete?: InputMaybe<Array<CompanyWhereUniqueInput>>;
|
|
||||||
deleteMany?: InputMaybe<Array<CompanyScalarWhereInput>>;
|
|
||||||
disconnect?: InputMaybe<Array<CompanyWhereUniqueInput>>;
|
|
||||||
set?: InputMaybe<Array<CompanyWhereUniqueInput>>;
|
|
||||||
update?: InputMaybe<Array<CompanyUpdateWithWhereUniqueWithoutWorkspaceInput>>;
|
|
||||||
updateMany?: InputMaybe<Array<CompanyUpdateManyWithWhereWithoutWorkspaceInput>>;
|
|
||||||
upsert?: InputMaybe<Array<CompanyUpsertWithWhereUniqueWithoutWorkspaceInput>>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type CompanyUpdateOneWithoutPeopleNestedInput = {
|
export type CompanyUpdateOneWithoutPeopleNestedInput = {
|
||||||
connect?: InputMaybe<CompanyWhereUniqueInput>;
|
connect?: InputMaybe<CompanyWhereUniqueInput>;
|
||||||
connectOrCreate?: InputMaybe<CompanyCreateOrConnectWithoutPeopleInput>;
|
connectOrCreate?: InputMaybe<CompanyCreateOrConnectWithoutPeopleInput>;
|
||||||
@ -242,11 +155,6 @@ export type CompanyUpdateOneWithoutPeopleNestedInput = {
|
|||||||
upsert?: InputMaybe<CompanyUpsertWithoutPeopleInput>;
|
upsert?: InputMaybe<CompanyUpsertWithoutPeopleInput>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CompanyUpdateWithWhereUniqueWithoutWorkspaceInput = {
|
|
||||||
data: CompanyUpdateWithoutWorkspaceInput;
|
|
||||||
where: CompanyWhereUniqueInput;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type CompanyUpdateWithoutPeopleInput = {
|
export type CompanyUpdateWithoutPeopleInput = {
|
||||||
accountOwner?: InputMaybe<UserUpdateOneWithoutCompaniesNestedInput>;
|
accountOwner?: InputMaybe<UserUpdateOneWithoutCompaniesNestedInput>;
|
||||||
address?: InputMaybe<StringFieldUpdateOperationsInput>;
|
address?: InputMaybe<StringFieldUpdateOperationsInput>;
|
||||||
@ -259,25 +167,6 @@ export type CompanyUpdateWithoutPeopleInput = {
|
|||||||
updatedAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
|
updatedAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CompanyUpdateWithoutWorkspaceInput = {
|
|
||||||
accountOwner?: InputMaybe<UserUpdateOneWithoutCompaniesNestedInput>;
|
|
||||||
address?: InputMaybe<StringFieldUpdateOperationsInput>;
|
|
||||||
createdAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
|
|
||||||
deletedAt?: InputMaybe<NullableDateTimeFieldUpdateOperationsInput>;
|
|
||||||
domainName?: InputMaybe<StringFieldUpdateOperationsInput>;
|
|
||||||
employees?: InputMaybe<NullableIntFieldUpdateOperationsInput>;
|
|
||||||
id?: InputMaybe<StringFieldUpdateOperationsInput>;
|
|
||||||
name?: InputMaybe<StringFieldUpdateOperationsInput>;
|
|
||||||
people?: InputMaybe<PersonUpdateManyWithoutCompanyNestedInput>;
|
|
||||||
updatedAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type CompanyUpsertWithWhereUniqueWithoutWorkspaceInput = {
|
|
||||||
create: CompanyCreateWithoutWorkspaceInput;
|
|
||||||
update: CompanyUpdateWithoutWorkspaceInput;
|
|
||||||
where: CompanyWhereUniqueInput;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type CompanyUpsertWithoutPeopleInput = {
|
export type CompanyUpsertWithoutPeopleInput = {
|
||||||
create: CompanyCreateWithoutPeopleInput;
|
create: CompanyCreateWithoutPeopleInput;
|
||||||
update: CompanyUpdateWithoutPeopleInput;
|
update: CompanyUpdateWithoutPeopleInput;
|
||||||
@ -363,7 +252,6 @@ export type Mutation = {
|
|||||||
createOnePerson: Person;
|
createOnePerson: Person;
|
||||||
deleteManyCompany: AffectedRows;
|
deleteManyCompany: AffectedRows;
|
||||||
deleteManyPerson: AffectedRows;
|
deleteManyPerson: AffectedRows;
|
||||||
deleteOneCompany?: Maybe<Company>;
|
|
||||||
updateOneCompany?: Maybe<Company>;
|
updateOneCompany?: Maybe<Company>;
|
||||||
updateOnePerson?: Maybe<Person>;
|
updateOnePerson?: Maybe<Person>;
|
||||||
};
|
};
|
||||||
@ -389,11 +277,6 @@ export type MutationDeleteManyPersonArgs = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export type MutationDeleteOneCompanyArgs = {
|
|
||||||
where: CompanyWhereUniqueInput;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
export type MutationUpdateOneCompanyArgs = {
|
export type MutationUpdateOneCompanyArgs = {
|
||||||
data: CompanyUpdateInput;
|
data: CompanyUpdateInput;
|
||||||
where: CompanyWhereUniqueInput;
|
where: CompanyWhereUniqueInput;
|
||||||
@ -534,24 +417,6 @@ export type PersonCreateManyCompanyInputEnvelope = {
|
|||||||
skipDuplicates?: InputMaybe<Scalars['Boolean']>;
|
skipDuplicates?: InputMaybe<Scalars['Boolean']>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type PersonCreateManyWorkspaceInput = {
|
|
||||||
city: Scalars['String'];
|
|
||||||
companyId?: InputMaybe<Scalars['String']>;
|
|
||||||
createdAt?: InputMaybe<Scalars['DateTime']>;
|
|
||||||
deletedAt?: InputMaybe<Scalars['DateTime']>;
|
|
||||||
email: Scalars['String'];
|
|
||||||
firstname: Scalars['String'];
|
|
||||||
id: Scalars['String'];
|
|
||||||
lastname: Scalars['String'];
|
|
||||||
phone: Scalars['String'];
|
|
||||||
updatedAt?: InputMaybe<Scalars['DateTime']>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type PersonCreateManyWorkspaceInputEnvelope = {
|
|
||||||
data: Array<PersonCreateManyWorkspaceInput>;
|
|
||||||
skipDuplicates?: InputMaybe<Scalars['Boolean']>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type PersonCreateNestedManyWithoutCompanyInput = {
|
export type PersonCreateNestedManyWithoutCompanyInput = {
|
||||||
connect?: InputMaybe<Array<PersonWhereUniqueInput>>;
|
connect?: InputMaybe<Array<PersonWhereUniqueInput>>;
|
||||||
connectOrCreate?: InputMaybe<Array<PersonCreateOrConnectWithoutCompanyInput>>;
|
connectOrCreate?: InputMaybe<Array<PersonCreateOrConnectWithoutCompanyInput>>;
|
||||||
@ -559,23 +424,11 @@ export type PersonCreateNestedManyWithoutCompanyInput = {
|
|||||||
createMany?: InputMaybe<PersonCreateManyCompanyInputEnvelope>;
|
createMany?: InputMaybe<PersonCreateManyCompanyInputEnvelope>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type PersonCreateNestedManyWithoutWorkspaceInput = {
|
|
||||||
connect?: InputMaybe<Array<PersonWhereUniqueInput>>;
|
|
||||||
connectOrCreate?: InputMaybe<Array<PersonCreateOrConnectWithoutWorkspaceInput>>;
|
|
||||||
create?: InputMaybe<Array<PersonCreateWithoutWorkspaceInput>>;
|
|
||||||
createMany?: InputMaybe<PersonCreateManyWorkspaceInputEnvelope>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type PersonCreateOrConnectWithoutCompanyInput = {
|
export type PersonCreateOrConnectWithoutCompanyInput = {
|
||||||
create: PersonCreateWithoutCompanyInput;
|
create: PersonCreateWithoutCompanyInput;
|
||||||
where: PersonWhereUniqueInput;
|
where: PersonWhereUniqueInput;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type PersonCreateOrConnectWithoutWorkspaceInput = {
|
|
||||||
create: PersonCreateWithoutWorkspaceInput;
|
|
||||||
where: PersonWhereUniqueInput;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type PersonCreateWithoutCompanyInput = {
|
export type PersonCreateWithoutCompanyInput = {
|
||||||
city: Scalars['String'];
|
city: Scalars['String'];
|
||||||
createdAt?: InputMaybe<Scalars['DateTime']>;
|
createdAt?: InputMaybe<Scalars['DateTime']>;
|
||||||
@ -588,19 +441,6 @@ export type PersonCreateWithoutCompanyInput = {
|
|||||||
updatedAt?: InputMaybe<Scalars['DateTime']>;
|
updatedAt?: InputMaybe<Scalars['DateTime']>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type PersonCreateWithoutWorkspaceInput = {
|
|
||||||
city: Scalars['String'];
|
|
||||||
company?: InputMaybe<CompanyCreateNestedOneWithoutPeopleInput>;
|
|
||||||
createdAt?: InputMaybe<Scalars['DateTime']>;
|
|
||||||
deletedAt?: InputMaybe<Scalars['DateTime']>;
|
|
||||||
email: Scalars['String'];
|
|
||||||
firstname: Scalars['String'];
|
|
||||||
id: Scalars['String'];
|
|
||||||
lastname: Scalars['String'];
|
|
||||||
phone: Scalars['String'];
|
|
||||||
updatedAt?: InputMaybe<Scalars['DateTime']>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type PersonListRelationFilter = {
|
export type PersonListRelationFilter = {
|
||||||
every?: InputMaybe<PersonWhereInput>;
|
every?: InputMaybe<PersonWhereInput>;
|
||||||
none?: InputMaybe<PersonWhereInput>;
|
none?: InputMaybe<PersonWhereInput>;
|
||||||
@ -685,11 +525,6 @@ export type PersonUpdateManyWithWhereWithoutCompanyInput = {
|
|||||||
where: PersonScalarWhereInput;
|
where: PersonScalarWhereInput;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type PersonUpdateManyWithWhereWithoutWorkspaceInput = {
|
|
||||||
data: PersonUpdateManyMutationInput;
|
|
||||||
where: PersonScalarWhereInput;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type PersonUpdateManyWithoutCompanyNestedInput = {
|
export type PersonUpdateManyWithoutCompanyNestedInput = {
|
||||||
connect?: InputMaybe<Array<PersonWhereUniqueInput>>;
|
connect?: InputMaybe<Array<PersonWhereUniqueInput>>;
|
||||||
connectOrCreate?: InputMaybe<Array<PersonCreateOrConnectWithoutCompanyInput>>;
|
connectOrCreate?: InputMaybe<Array<PersonCreateOrConnectWithoutCompanyInput>>;
|
||||||
@ -704,30 +539,11 @@ export type PersonUpdateManyWithoutCompanyNestedInput = {
|
|||||||
upsert?: InputMaybe<Array<PersonUpsertWithWhereUniqueWithoutCompanyInput>>;
|
upsert?: InputMaybe<Array<PersonUpsertWithWhereUniqueWithoutCompanyInput>>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type PersonUpdateManyWithoutWorkspaceNestedInput = {
|
|
||||||
connect?: InputMaybe<Array<PersonWhereUniqueInput>>;
|
|
||||||
connectOrCreate?: InputMaybe<Array<PersonCreateOrConnectWithoutWorkspaceInput>>;
|
|
||||||
create?: InputMaybe<Array<PersonCreateWithoutWorkspaceInput>>;
|
|
||||||
createMany?: InputMaybe<PersonCreateManyWorkspaceInputEnvelope>;
|
|
||||||
delete?: InputMaybe<Array<PersonWhereUniqueInput>>;
|
|
||||||
deleteMany?: InputMaybe<Array<PersonScalarWhereInput>>;
|
|
||||||
disconnect?: InputMaybe<Array<PersonWhereUniqueInput>>;
|
|
||||||
set?: InputMaybe<Array<PersonWhereUniqueInput>>;
|
|
||||||
update?: InputMaybe<Array<PersonUpdateWithWhereUniqueWithoutWorkspaceInput>>;
|
|
||||||
updateMany?: InputMaybe<Array<PersonUpdateManyWithWhereWithoutWorkspaceInput>>;
|
|
||||||
upsert?: InputMaybe<Array<PersonUpsertWithWhereUniqueWithoutWorkspaceInput>>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type PersonUpdateWithWhereUniqueWithoutCompanyInput = {
|
export type PersonUpdateWithWhereUniqueWithoutCompanyInput = {
|
||||||
data: PersonUpdateWithoutCompanyInput;
|
data: PersonUpdateWithoutCompanyInput;
|
||||||
where: PersonWhereUniqueInput;
|
where: PersonWhereUniqueInput;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type PersonUpdateWithWhereUniqueWithoutWorkspaceInput = {
|
|
||||||
data: PersonUpdateWithoutWorkspaceInput;
|
|
||||||
where: PersonWhereUniqueInput;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type PersonUpdateWithoutCompanyInput = {
|
export type PersonUpdateWithoutCompanyInput = {
|
||||||
city?: InputMaybe<StringFieldUpdateOperationsInput>;
|
city?: InputMaybe<StringFieldUpdateOperationsInput>;
|
||||||
createdAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
|
createdAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
|
||||||
@ -740,31 +556,12 @@ export type PersonUpdateWithoutCompanyInput = {
|
|||||||
updatedAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
|
updatedAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type PersonUpdateWithoutWorkspaceInput = {
|
|
||||||
city?: InputMaybe<StringFieldUpdateOperationsInput>;
|
|
||||||
company?: InputMaybe<CompanyUpdateOneWithoutPeopleNestedInput>;
|
|
||||||
createdAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
|
|
||||||
deletedAt?: InputMaybe<NullableDateTimeFieldUpdateOperationsInput>;
|
|
||||||
email?: InputMaybe<StringFieldUpdateOperationsInput>;
|
|
||||||
firstname?: InputMaybe<StringFieldUpdateOperationsInput>;
|
|
||||||
id?: InputMaybe<StringFieldUpdateOperationsInput>;
|
|
||||||
lastname?: InputMaybe<StringFieldUpdateOperationsInput>;
|
|
||||||
phone?: InputMaybe<StringFieldUpdateOperationsInput>;
|
|
||||||
updatedAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type PersonUpsertWithWhereUniqueWithoutCompanyInput = {
|
export type PersonUpsertWithWhereUniqueWithoutCompanyInput = {
|
||||||
create: PersonCreateWithoutCompanyInput;
|
create: PersonCreateWithoutCompanyInput;
|
||||||
update: PersonUpdateWithoutCompanyInput;
|
update: PersonUpdateWithoutCompanyInput;
|
||||||
where: PersonWhereUniqueInput;
|
where: PersonWhereUniqueInput;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type PersonUpsertWithWhereUniqueWithoutWorkspaceInput = {
|
|
||||||
create: PersonCreateWithoutWorkspaceInput;
|
|
||||||
update: PersonUpdateWithoutWorkspaceInput;
|
|
||||||
where: PersonWhereUniqueInput;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type PersonWhereInput = {
|
export type PersonWhereInput = {
|
||||||
AND?: InputMaybe<Array<PersonWhereInput>>;
|
AND?: InputMaybe<Array<PersonWhereInput>>;
|
||||||
NOT?: InputMaybe<Array<PersonWhereInput>>;
|
NOT?: InputMaybe<Array<PersonWhereInput>>;
|
||||||
@ -788,14 +585,13 @@ export type PersonWhereUniqueInput = {
|
|||||||
|
|
||||||
export type Query = {
|
export type Query = {
|
||||||
__typename?: 'Query';
|
__typename?: 'Query';
|
||||||
companies: Array<Company>;
|
findManyCompany: Array<Company>;
|
||||||
people: Array<Person>;
|
findManyPerson: Array<Person>;
|
||||||
user: User;
|
findManyUser: Array<User>;
|
||||||
users: Array<User>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export type QueryCompaniesArgs = {
|
export type QueryFindManyCompanyArgs = {
|
||||||
cursor?: InputMaybe<CompanyWhereUniqueInput>;
|
cursor?: InputMaybe<CompanyWhereUniqueInput>;
|
||||||
distinct?: InputMaybe<Array<CompanyScalarFieldEnum>>;
|
distinct?: InputMaybe<Array<CompanyScalarFieldEnum>>;
|
||||||
orderBy?: InputMaybe<Array<CompanyOrderByWithRelationInput>>;
|
orderBy?: InputMaybe<Array<CompanyOrderByWithRelationInput>>;
|
||||||
@ -805,7 +601,7 @@ export type QueryCompaniesArgs = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export type QueryPeopleArgs = {
|
export type QueryFindManyPersonArgs = {
|
||||||
cursor?: InputMaybe<PersonWhereUniqueInput>;
|
cursor?: InputMaybe<PersonWhereUniqueInput>;
|
||||||
distinct?: InputMaybe<Array<PersonScalarFieldEnum>>;
|
distinct?: InputMaybe<Array<PersonScalarFieldEnum>>;
|
||||||
orderBy?: InputMaybe<Array<PersonOrderByWithRelationInput>>;
|
orderBy?: InputMaybe<Array<PersonOrderByWithRelationInput>>;
|
||||||
@ -815,12 +611,7 @@ export type QueryPeopleArgs = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export type QueryUserArgs = {
|
export type QueryFindManyUserArgs = {
|
||||||
where: UserWhereUniqueInput;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
export type QueryUsersArgs = {
|
|
||||||
cursor?: InputMaybe<UserWhereUniqueInput>;
|
cursor?: InputMaybe<UserWhereUniqueInput>;
|
||||||
distinct?: InputMaybe<Array<UserScalarFieldEnum>>;
|
distinct?: InputMaybe<Array<UserScalarFieldEnum>>;
|
||||||
orderBy?: InputMaybe<Array<UserOrderByWithRelationInput>>;
|
orderBy?: InputMaybe<Array<UserOrderByWithRelationInput>>;
|
||||||
@ -1225,29 +1016,6 @@ export type WorkspaceCount = {
|
|||||||
people: Scalars['Int'];
|
people: Scalars['Int'];
|
||||||
};
|
};
|
||||||
|
|
||||||
export type WorkspaceCreateNestedOneWithoutWorkspaceMemberInput = {
|
|
||||||
connect?: InputMaybe<WorkspaceWhereUniqueInput>;
|
|
||||||
connectOrCreate?: InputMaybe<WorkspaceCreateOrConnectWithoutWorkspaceMemberInput>;
|
|
||||||
create?: InputMaybe<WorkspaceCreateWithoutWorkspaceMemberInput>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type WorkspaceCreateOrConnectWithoutWorkspaceMemberInput = {
|
|
||||||
create: WorkspaceCreateWithoutWorkspaceMemberInput;
|
|
||||||
where: WorkspaceWhereUniqueInput;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type WorkspaceCreateWithoutWorkspaceMemberInput = {
|
|
||||||
companies?: InputMaybe<CompanyCreateNestedManyWithoutWorkspaceInput>;
|
|
||||||
createdAt?: InputMaybe<Scalars['DateTime']>;
|
|
||||||
deletedAt?: InputMaybe<Scalars['DateTime']>;
|
|
||||||
displayName: Scalars['String'];
|
|
||||||
domainName: Scalars['String'];
|
|
||||||
id: Scalars['String'];
|
|
||||||
logo?: InputMaybe<Scalars['String']>;
|
|
||||||
people?: InputMaybe<PersonCreateNestedManyWithoutWorkspaceInput>;
|
|
||||||
updatedAt?: InputMaybe<Scalars['DateTime']>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type WorkspaceMember = {
|
export type WorkspaceMember = {
|
||||||
__typename?: 'WorkspaceMember';
|
__typename?: 'WorkspaceMember';
|
||||||
createdAt: Scalars['DateTime'];
|
createdAt: Scalars['DateTime'];
|
||||||
@ -1276,17 +1044,6 @@ export type WorkspaceMemberCreateWithoutUserInput = {
|
|||||||
deletedAt?: InputMaybe<Scalars['DateTime']>;
|
deletedAt?: InputMaybe<Scalars['DateTime']>;
|
||||||
id: Scalars['String'];
|
id: Scalars['String'];
|
||||||
updatedAt?: InputMaybe<Scalars['DateTime']>;
|
updatedAt?: InputMaybe<Scalars['DateTime']>;
|
||||||
workspace: WorkspaceCreateNestedOneWithoutWorkspaceMemberInput;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type WorkspaceMemberListRelationFilter = {
|
|
||||||
every?: InputMaybe<WorkspaceMemberWhereInput>;
|
|
||||||
none?: InputMaybe<WorkspaceMemberWhereInput>;
|
|
||||||
some?: InputMaybe<WorkspaceMemberWhereInput>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type WorkspaceMemberOrderByRelationAggregateInput = {
|
|
||||||
_count?: InputMaybe<SortOrder>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type WorkspaceMemberOrderByWithRelationInput = {
|
export type WorkspaceMemberOrderByWithRelationInput = {
|
||||||
@ -1296,8 +1053,6 @@ export type WorkspaceMemberOrderByWithRelationInput = {
|
|||||||
updatedAt?: InputMaybe<SortOrder>;
|
updatedAt?: InputMaybe<SortOrder>;
|
||||||
user?: InputMaybe<UserOrderByWithRelationInput>;
|
user?: InputMaybe<UserOrderByWithRelationInput>;
|
||||||
userId?: InputMaybe<SortOrder>;
|
userId?: InputMaybe<SortOrder>;
|
||||||
workspace?: InputMaybe<WorkspaceOrderByWithRelationInput>;
|
|
||||||
workspaceId?: InputMaybe<SortOrder>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type WorkspaceMemberRelationFilter = {
|
export type WorkspaceMemberRelationFilter = {
|
||||||
@ -1320,7 +1075,6 @@ export type WorkspaceMemberUpdateWithoutUserInput = {
|
|||||||
deletedAt?: InputMaybe<NullableDateTimeFieldUpdateOperationsInput>;
|
deletedAt?: InputMaybe<NullableDateTimeFieldUpdateOperationsInput>;
|
||||||
id?: InputMaybe<StringFieldUpdateOperationsInput>;
|
id?: InputMaybe<StringFieldUpdateOperationsInput>;
|
||||||
updatedAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
|
updatedAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
|
||||||
workspace?: InputMaybe<WorkspaceUpdateOneRequiredWithoutWorkspaceMemberNestedInput>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type WorkspaceMemberUpsertWithoutUserInput = {
|
export type WorkspaceMemberUpsertWithoutUserInput = {
|
||||||
@ -1338,8 +1092,6 @@ export type WorkspaceMemberWhereInput = {
|
|||||||
updatedAt?: InputMaybe<DateTimeFilter>;
|
updatedAt?: InputMaybe<DateTimeFilter>;
|
||||||
user?: InputMaybe<UserRelationFilter>;
|
user?: InputMaybe<UserRelationFilter>;
|
||||||
userId?: InputMaybe<StringFilter>;
|
userId?: InputMaybe<StringFilter>;
|
||||||
workspace?: InputMaybe<WorkspaceRelationFilter>;
|
|
||||||
workspaceId?: InputMaybe<StringFilter>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type WorkspaceMemberWhereUniqueInput = {
|
export type WorkspaceMemberWhereUniqueInput = {
|
||||||
@ -1347,77 +1099,13 @@ export type WorkspaceMemberWhereUniqueInput = {
|
|||||||
userId?: InputMaybe<Scalars['String']>;
|
userId?: InputMaybe<Scalars['String']>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type WorkspaceOrderByWithRelationInput = {
|
|
||||||
WorkspaceMember?: InputMaybe<WorkspaceMemberOrderByRelationAggregateInput>;
|
|
||||||
companies?: InputMaybe<CompanyOrderByRelationAggregateInput>;
|
|
||||||
createdAt?: InputMaybe<SortOrder>;
|
|
||||||
deletedAt?: InputMaybe<SortOrder>;
|
|
||||||
displayName?: InputMaybe<SortOrder>;
|
|
||||||
domainName?: InputMaybe<SortOrder>;
|
|
||||||
id?: InputMaybe<SortOrder>;
|
|
||||||
logo?: InputMaybe<SortOrder>;
|
|
||||||
people?: InputMaybe<PersonOrderByRelationAggregateInput>;
|
|
||||||
updatedAt?: InputMaybe<SortOrder>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type WorkspaceRelationFilter = {
|
|
||||||
is?: InputMaybe<WorkspaceWhereInput>;
|
|
||||||
isNot?: InputMaybe<WorkspaceWhereInput>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type WorkspaceUpdateOneRequiredWithoutWorkspaceMemberNestedInput = {
|
|
||||||
connect?: InputMaybe<WorkspaceWhereUniqueInput>;
|
|
||||||
connectOrCreate?: InputMaybe<WorkspaceCreateOrConnectWithoutWorkspaceMemberInput>;
|
|
||||||
create?: InputMaybe<WorkspaceCreateWithoutWorkspaceMemberInput>;
|
|
||||||
update?: InputMaybe<WorkspaceUpdateWithoutWorkspaceMemberInput>;
|
|
||||||
upsert?: InputMaybe<WorkspaceUpsertWithoutWorkspaceMemberInput>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type WorkspaceUpdateWithoutWorkspaceMemberInput = {
|
|
||||||
companies?: InputMaybe<CompanyUpdateManyWithoutWorkspaceNestedInput>;
|
|
||||||
createdAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
|
|
||||||
deletedAt?: InputMaybe<NullableDateTimeFieldUpdateOperationsInput>;
|
|
||||||
displayName?: InputMaybe<StringFieldUpdateOperationsInput>;
|
|
||||||
domainName?: InputMaybe<StringFieldUpdateOperationsInput>;
|
|
||||||
id?: InputMaybe<StringFieldUpdateOperationsInput>;
|
|
||||||
logo?: InputMaybe<NullableStringFieldUpdateOperationsInput>;
|
|
||||||
people?: InputMaybe<PersonUpdateManyWithoutWorkspaceNestedInput>;
|
|
||||||
updatedAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type WorkspaceUpsertWithoutWorkspaceMemberInput = {
|
|
||||||
create: WorkspaceCreateWithoutWorkspaceMemberInput;
|
|
||||||
update: WorkspaceUpdateWithoutWorkspaceMemberInput;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type WorkspaceWhereInput = {
|
|
||||||
AND?: InputMaybe<Array<WorkspaceWhereInput>>;
|
|
||||||
NOT?: InputMaybe<Array<WorkspaceWhereInput>>;
|
|
||||||
OR?: InputMaybe<Array<WorkspaceWhereInput>>;
|
|
||||||
WorkspaceMember?: InputMaybe<WorkspaceMemberListRelationFilter>;
|
|
||||||
companies?: InputMaybe<CompanyListRelationFilter>;
|
|
||||||
createdAt?: InputMaybe<DateTimeFilter>;
|
|
||||||
deletedAt?: InputMaybe<DateTimeNullableFilter>;
|
|
||||||
displayName?: InputMaybe<StringFilter>;
|
|
||||||
domainName?: InputMaybe<StringFilter>;
|
|
||||||
id?: InputMaybe<StringFilter>;
|
|
||||||
logo?: InputMaybe<StringNullableFilter>;
|
|
||||||
people?: InputMaybe<PersonListRelationFilter>;
|
|
||||||
updatedAt?: InputMaybe<DateTimeFilter>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type WorkspaceWhereUniqueInput = {
|
|
||||||
domainName?: InputMaybe<Scalars['String']>;
|
|
||||||
id?: InputMaybe<Scalars['String']>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type GetCompaniesQueryVariables = Exact<{
|
export type GetCompaniesQueryVariables = Exact<{
|
||||||
orderBy?: InputMaybe<Array<CompanyOrderByWithRelationInput> | CompanyOrderByWithRelationInput>;
|
orderBy?: InputMaybe<Array<CompanyOrderByWithRelationInput> | CompanyOrderByWithRelationInput>;
|
||||||
where?: InputMaybe<CompanyWhereInput>;
|
where?: InputMaybe<CompanyWhereInput>;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
export type GetCompaniesQuery = { __typename?: 'Query', companies: Array<{ __typename?: 'Company', id: string, domainName: string, name: string, createdAt: any, address: string, employees?: number | null, accountOwner?: { __typename?: 'User', id: string, email: string, displayName: string } | null }> };
|
export type GetCompaniesQuery = { __typename?: 'Query', findManyCompany: Array<{ __typename?: 'Company', id: string, domainName: string, name: string, createdAt: any, address: string, employees?: number | null, accountOwner?: { __typename?: 'User', id: string, email: string, displayName: string } | null }> };
|
||||||
|
|
||||||
export type UpdateCompanyMutationVariables = Exact<{
|
export type UpdateCompanyMutationVariables = Exact<{
|
||||||
id?: InputMaybe<Scalars['String']>;
|
id?: InputMaybe<Scalars['String']>;
|
||||||
@ -1458,7 +1146,7 @@ export type GetPeopleQueryVariables = Exact<{
|
|||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
export type GetPeopleQuery = { __typename?: 'Query', people: Array<{ __typename?: 'Person', id: string, phone: string, email: string, city: string, firstname: string, lastname: string, createdAt: any, company?: { __typename?: 'Company', id: string, name: string, domainName: string } | null }> };
|
export type GetPeopleQuery = { __typename?: 'Query', findManyPerson: Array<{ __typename?: 'Person', id: string, phone: string, email: string, city: string, firstname: string, lastname: string, createdAt: any, company?: { __typename?: 'Company', id: string, name: string, domainName: string } | null }> };
|
||||||
|
|
||||||
export type UpdatePeopleMutationVariables = Exact<{
|
export type UpdatePeopleMutationVariables = Exact<{
|
||||||
id?: InputMaybe<Scalars['String']>;
|
id?: InputMaybe<Scalars['String']>;
|
||||||
@ -1513,39 +1201,39 @@ export type SearchUserQueryQuery = { __typename?: 'Query', searchResults: Array<
|
|||||||
export type EmptyQueryQueryVariables = Exact<{ [key: string]: never; }>;
|
export type EmptyQueryQueryVariables = Exact<{ [key: string]: never; }>;
|
||||||
|
|
||||||
|
|
||||||
export type EmptyQueryQuery = { __typename?: 'Query', users: Array<{ __typename?: 'User', id: string }> };
|
export type EmptyQueryQuery = { __typename?: 'Query', findManyUser: Array<{ __typename?: 'User', id: string }> };
|
||||||
|
|
||||||
export type SearchQueryQueryVariables = Exact<{
|
export type SearchCompanyQueryQueryVariables = Exact<{
|
||||||
where?: InputMaybe<CompanyWhereInput>;
|
where?: InputMaybe<CompanyWhereInput>;
|
||||||
limit?: InputMaybe<Scalars['Int']>;
|
limit?: InputMaybe<Scalars['Int']>;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
export type SearchQueryQuery = { __typename?: 'Query', searchResults: Array<{ __typename?: 'Company', id: string, name: string, domainName: string }> };
|
export type SearchCompanyQueryQuery = { __typename?: 'Query', searchResults: Array<{ __typename?: 'Company', id: string, name: string, domainName: string }> };
|
||||||
|
|
||||||
export type GetCurrentUserQueryVariables = Exact<{
|
export type GetCurrentUserQueryVariables = Exact<{
|
||||||
uuid?: InputMaybe<Scalars['String']>;
|
uuid?: InputMaybe<Scalars['String']>;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
export type GetCurrentUserQuery = { __typename?: 'Query', users: Array<{ __typename?: 'User', id: string, email: string, displayName: string, workspaceMember?: { __typename?: 'WorkspaceMember', workspace: { __typename?: 'Workspace', id: string, domainName: string, displayName: string, logo?: string | null } } | null }> };
|
export type GetCurrentUserQuery = { __typename?: 'Query', findManyUser: Array<{ __typename?: 'User', id: string, email: string, displayName: string, workspaceMember?: { __typename?: 'WorkspaceMember', workspace: { __typename?: 'Workspace', id: string, domainName: string, displayName: string, logo?: string | null } } | null }> };
|
||||||
|
|
||||||
export type GetUsersQueryVariables = Exact<{ [key: string]: never; }>;
|
export type GetUsersQueryVariables = Exact<{ [key: string]: never; }>;
|
||||||
|
|
||||||
|
|
||||||
export type GetUsersQuery = { __typename?: 'Query', users: Array<{ __typename?: 'User', id: string }> };
|
export type GetUsersQuery = { __typename?: 'Query', findManyUser: Array<{ __typename?: 'User', id: string }> };
|
||||||
|
|
||||||
|
|
||||||
export const GetCompaniesDocument = gql`
|
export const GetCompaniesDocument = gql`
|
||||||
query GetCompanies($orderBy: [CompanyOrderByWithRelationInput!], $where: CompanyWhereInput) {
|
query GetCompanies($orderBy: [CompanyOrderByWithRelationInput!], $where: CompanyWhereInput) {
|
||||||
companies(orderBy: $orderBy, where: $where) {
|
findManyCompany(orderBy: $orderBy, where: $where) {
|
||||||
id
|
id
|
||||||
domainName
|
domainName
|
||||||
name
|
name
|
||||||
createdAt
|
createdAt
|
||||||
address
|
address
|
||||||
employees
|
employees
|
||||||
accountOwner: accountOwner {
|
accountOwner {
|
||||||
id
|
id
|
||||||
email
|
email
|
||||||
displayName
|
displayName
|
||||||
@ -1714,7 +1402,7 @@ export type DeleteCompaniesMutationResult = Apollo.MutationResult<DeleteCompanie
|
|||||||
export type DeleteCompaniesMutationOptions = Apollo.BaseMutationOptions<DeleteCompaniesMutation, DeleteCompaniesMutationVariables>;
|
export type DeleteCompaniesMutationOptions = Apollo.BaseMutationOptions<DeleteCompaniesMutation, DeleteCompaniesMutationVariables>;
|
||||||
export const GetPeopleDocument = gql`
|
export const GetPeopleDocument = gql`
|
||||||
query GetPeople($orderBy: [PersonOrderByWithRelationInput!], $where: PersonWhereInput, $limit: Int) {
|
query GetPeople($orderBy: [PersonOrderByWithRelationInput!], $where: PersonWhereInput, $limit: Int) {
|
||||||
people(orderBy: $orderBy, where: $where, take: $limit) {
|
findManyPerson(orderBy: $orderBy, where: $where, take: $limit) {
|
||||||
id
|
id
|
||||||
phone
|
phone
|
||||||
email
|
email
|
||||||
@ -1901,7 +1589,7 @@ export type DeletePeopleMutationResult = Apollo.MutationResult<DeletePeopleMutat
|
|||||||
export type DeletePeopleMutationOptions = Apollo.BaseMutationOptions<DeletePeopleMutation, DeletePeopleMutationVariables>;
|
export type DeletePeopleMutationOptions = Apollo.BaseMutationOptions<DeletePeopleMutation, DeletePeopleMutationVariables>;
|
||||||
export const SearchPeopleQueryDocument = gql`
|
export const SearchPeopleQueryDocument = gql`
|
||||||
query SearchPeopleQuery($where: PersonWhereInput, $limit: Int) {
|
query SearchPeopleQuery($where: PersonWhereInput, $limit: Int) {
|
||||||
searchResults: people(where: $where, take: $limit) {
|
searchResults: findManyPerson(where: $where, take: $limit) {
|
||||||
id
|
id
|
||||||
phone
|
phone
|
||||||
email
|
email
|
||||||
@ -1943,7 +1631,7 @@ export type SearchPeopleQueryLazyQueryHookResult = ReturnType<typeof useSearchPe
|
|||||||
export type SearchPeopleQueryQueryResult = Apollo.QueryResult<SearchPeopleQueryQuery, SearchPeopleQueryQueryVariables>;
|
export type SearchPeopleQueryQueryResult = Apollo.QueryResult<SearchPeopleQueryQuery, SearchPeopleQueryQueryVariables>;
|
||||||
export const SearchUserQueryDocument = gql`
|
export const SearchUserQueryDocument = gql`
|
||||||
query SearchUserQuery($where: UserWhereInput, $limit: Int) {
|
query SearchUserQuery($where: UserWhereInput, $limit: Int) {
|
||||||
searchResults: users(where: $where, take: $limit) {
|
searchResults: findManyUser(where: $where, take: $limit) {
|
||||||
id
|
id
|
||||||
email
|
email
|
||||||
displayName
|
displayName
|
||||||
@ -1981,7 +1669,7 @@ export type SearchUserQueryLazyQueryHookResult = ReturnType<typeof useSearchUser
|
|||||||
export type SearchUserQueryQueryResult = Apollo.QueryResult<SearchUserQueryQuery, SearchUserQueryQueryVariables>;
|
export type SearchUserQueryQueryResult = Apollo.QueryResult<SearchUserQueryQuery, SearchUserQueryQueryVariables>;
|
||||||
export const EmptyQueryDocument = gql`
|
export const EmptyQueryDocument = gql`
|
||||||
query EmptyQuery {
|
query EmptyQuery {
|
||||||
users {
|
findManyUser {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2013,47 +1701,47 @@ export function useEmptyQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions
|
|||||||
export type EmptyQueryQueryHookResult = ReturnType<typeof useEmptyQueryQuery>;
|
export type EmptyQueryQueryHookResult = ReturnType<typeof useEmptyQueryQuery>;
|
||||||
export type EmptyQueryLazyQueryHookResult = ReturnType<typeof useEmptyQueryLazyQuery>;
|
export type EmptyQueryLazyQueryHookResult = ReturnType<typeof useEmptyQueryLazyQuery>;
|
||||||
export type EmptyQueryQueryResult = Apollo.QueryResult<EmptyQueryQuery, EmptyQueryQueryVariables>;
|
export type EmptyQueryQueryResult = Apollo.QueryResult<EmptyQueryQuery, EmptyQueryQueryVariables>;
|
||||||
export const SearchQueryDocument = gql`
|
export const SearchCompanyQueryDocument = gql`
|
||||||
query SearchQuery($where: CompanyWhereInput, $limit: Int) {
|
query SearchCompanyQuery($where: CompanyWhereInput, $limit: Int) {
|
||||||
searchResults: companies(where: $where, take: $limit) {
|
searchResults: findManyCompany(where: $where, take: $limit) {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
domainName: domainName
|
domainName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __useSearchQueryQuery__
|
* __useSearchCompanyQueryQuery__
|
||||||
*
|
*
|
||||||
* To run a query within a React component, call `useSearchQueryQuery` and pass it any options that fit your needs.
|
* To run a query within a React component, call `useSearchCompanyQueryQuery` and pass it any options that fit your needs.
|
||||||
* When your component renders, `useSearchQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties
|
* When your component renders, `useSearchCompanyQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties
|
||||||
* you can use to render your UI.
|
* you can use to render your UI.
|
||||||
*
|
*
|
||||||
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
|
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* const { data, loading, error } = useSearchQueryQuery({
|
* const { data, loading, error } = useSearchCompanyQueryQuery({
|
||||||
* variables: {
|
* variables: {
|
||||||
* where: // value for 'where'
|
* where: // value for 'where'
|
||||||
* limit: // value for 'limit'
|
* limit: // value for 'limit'
|
||||||
* },
|
* },
|
||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
export function useSearchQueryQuery(baseOptions?: Apollo.QueryHookOptions<SearchQueryQuery, SearchQueryQueryVariables>) {
|
export function useSearchCompanyQueryQuery(baseOptions?: Apollo.QueryHookOptions<SearchCompanyQueryQuery, SearchCompanyQueryQueryVariables>) {
|
||||||
const options = {...defaultOptions, ...baseOptions}
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
return Apollo.useQuery<SearchQueryQuery, SearchQueryQueryVariables>(SearchQueryDocument, options);
|
return Apollo.useQuery<SearchCompanyQueryQuery, SearchCompanyQueryQueryVariables>(SearchCompanyQueryDocument, options);
|
||||||
}
|
}
|
||||||
export function useSearchQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<SearchQueryQuery, SearchQueryQueryVariables>) {
|
export function useSearchCompanyQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<SearchCompanyQueryQuery, SearchCompanyQueryQueryVariables>) {
|
||||||
const options = {...defaultOptions, ...baseOptions}
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
return Apollo.useLazyQuery<SearchQueryQuery, SearchQueryQueryVariables>(SearchQueryDocument, options);
|
return Apollo.useLazyQuery<SearchCompanyQueryQuery, SearchCompanyQueryQueryVariables>(SearchCompanyQueryDocument, options);
|
||||||
}
|
}
|
||||||
export type SearchQueryQueryHookResult = ReturnType<typeof useSearchQueryQuery>;
|
export type SearchCompanyQueryQueryHookResult = ReturnType<typeof useSearchCompanyQueryQuery>;
|
||||||
export type SearchQueryLazyQueryHookResult = ReturnType<typeof useSearchQueryLazyQuery>;
|
export type SearchCompanyQueryLazyQueryHookResult = ReturnType<typeof useSearchCompanyQueryLazyQuery>;
|
||||||
export type SearchQueryQueryResult = Apollo.QueryResult<SearchQueryQuery, SearchQueryQueryVariables>;
|
export type SearchCompanyQueryQueryResult = Apollo.QueryResult<SearchCompanyQueryQuery, SearchCompanyQueryQueryVariables>;
|
||||||
export const GetCurrentUserDocument = gql`
|
export const GetCurrentUserDocument = gql`
|
||||||
query getCurrentUser($uuid: String) {
|
query getCurrentUser($uuid: String) {
|
||||||
users(where: {id: {equals: $uuid}}) {
|
findManyUser(where: {id: {equals: $uuid}}) {
|
||||||
id
|
id
|
||||||
email
|
email
|
||||||
displayName
|
displayName
|
||||||
@ -2098,7 +1786,7 @@ export type GetCurrentUserLazyQueryHookResult = ReturnType<typeof useGetCurrentU
|
|||||||
export type GetCurrentUserQueryResult = Apollo.QueryResult<GetCurrentUserQuery, GetCurrentUserQueryVariables>;
|
export type GetCurrentUserQueryResult = Apollo.QueryResult<GetCurrentUserQuery, GetCurrentUserQueryVariables>;
|
||||||
export const GetUsersDocument = gql`
|
export const GetUsersDocument = gql`
|
||||||
query getUsers {
|
query getUsers {
|
||||||
users {
|
findManyUser {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,7 @@ export const GET_COMPANIES = gql`
|
|||||||
$orderBy: [CompanyOrderByWithRelationInput!]
|
$orderBy: [CompanyOrderByWithRelationInput!]
|
||||||
$where: CompanyWhereInput
|
$where: CompanyWhereInput
|
||||||
) {
|
) {
|
||||||
companies(orderBy: $orderBy, where: $where) {
|
companies: findManyCompany(orderBy: $orderBy, where: $where) {
|
||||||
id
|
id
|
||||||
domainName
|
domainName
|
||||||
name
|
name
|
||||||
|
|||||||
@ -15,7 +15,7 @@ export const GET_PEOPLE = gql`
|
|||||||
$where: PersonWhereInput
|
$where: PersonWhereInput
|
||||||
$limit: Int
|
$limit: Int
|
||||||
) {
|
) {
|
||||||
people(orderBy: $orderBy, where: $where, take: $limit) {
|
people: findManyPerson(orderBy: $orderBy, where: $where, take: $limit) {
|
||||||
id
|
id
|
||||||
phone
|
phone
|
||||||
email
|
email
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import { debounce } from '../../../modules/utils/debounce';
|
|||||||
|
|
||||||
export const SEARCH_PEOPLE_QUERY = gql`
|
export const SEARCH_PEOPLE_QUERY = gql`
|
||||||
query SearchPeopleQuery($where: PersonWhereInput, $limit: Int) {
|
query SearchPeopleQuery($where: PersonWhereInput, $limit: Int) {
|
||||||
searchResults: people(where: $where, take: $limit) {
|
searchResults: findManyPerson(where: $where, take: $limit) {
|
||||||
id
|
id
|
||||||
phone
|
phone
|
||||||
email
|
email
|
||||||
@ -23,7 +23,7 @@ export const SEARCH_PEOPLE_QUERY = gql`
|
|||||||
|
|
||||||
export const SEARCH_USER_QUERY = gql`
|
export const SEARCH_USER_QUERY = gql`
|
||||||
query SearchUserQuery($where: UserWhereInput, $limit: Int) {
|
query SearchUserQuery($where: UserWhereInput, $limit: Int) {
|
||||||
searchResults: users(where: $where, take: $limit) {
|
searchResults: findManyUser(where: $where, take: $limit) {
|
||||||
id
|
id
|
||||||
email
|
email
|
||||||
displayName
|
displayName
|
||||||
@ -33,7 +33,7 @@ export const SEARCH_USER_QUERY = gql`
|
|||||||
// TODO: remove this query
|
// TODO: remove this query
|
||||||
export const EMPTY_QUERY = gql`
|
export const EMPTY_QUERY = gql`
|
||||||
query EmptyQuery {
|
query EmptyQuery {
|
||||||
users {
|
searchResults: findManyUser {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -41,7 +41,7 @@ export const EMPTY_QUERY = gql`
|
|||||||
|
|
||||||
export const SEARCH_COMPANY_QUERY = gql`
|
export const SEARCH_COMPANY_QUERY = gql`
|
||||||
query SearchCompanyQuery($where: CompanyWhereInput, $limit: Int) {
|
query SearchCompanyQuery($where: CompanyWhereInput, $limit: Int) {
|
||||||
searchResults: companies(where: $where, take: $limit) {
|
searchResults: findManyCompany(where: $where, take: $limit) {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
domainName
|
domainName
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { GraphqlQueryUser } from '../../../interfaces/entities/user.interface';
|
|||||||
|
|
||||||
export const GET_CURRENT_USER = gql`
|
export const GET_CURRENT_USER = gql`
|
||||||
query getCurrentUser($uuid: String) {
|
query getCurrentUser($uuid: String) {
|
||||||
users(where: { id: { equals: $uuid } }) {
|
users: findManyUser(where: { id: { equals: $uuid } }) {
|
||||||
id
|
id
|
||||||
email
|
email
|
||||||
displayName
|
displayName
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { gql } from '@apollo/client';
|
|||||||
|
|
||||||
export const GET_CURRENT_USER = gql`
|
export const GET_CURRENT_USER = gql`
|
||||||
query getUsers {
|
query getUsers {
|
||||||
users {
|
findManyUser {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -74,7 +74,6 @@ export function filterAndSortData<DataT>(
|
|||||||
limit: number,
|
limit: number,
|
||||||
): Array<DataT> {
|
): Array<DataT> {
|
||||||
let filteredData = filterData<DataT>(data, where);
|
let filteredData = filterData<DataT>(data, where);
|
||||||
console.log(filteredData);
|
|
||||||
|
|
||||||
if (orderBy) {
|
if (orderBy) {
|
||||||
const firstOrderBy = orderBy[0];
|
const firstOrderBy = orderBy[0];
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { ObjectType } from '@nestjs/graphql';
|
|||||||
import { ID } from '@nestjs/graphql';
|
import { ID } from '@nestjs/graphql';
|
||||||
import { User } from '../user/user.model';
|
import { User } from '../user/user.model';
|
||||||
|
|
||||||
@ObjectType()
|
@ObjectType({})
|
||||||
export class RefreshToken {
|
export class RefreshToken {
|
||||||
@Field(() => ID, { nullable: false })
|
@Field(() => ID, { nullable: false })
|
||||||
id!: string;
|
id!: string;
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import { Field } from '@nestjs/graphql';
|
import { Field } from '@nestjs/graphql';
|
||||||
import { InputType } from '@nestjs/graphql';
|
import { InputType } from '@nestjs/graphql';
|
||||||
|
import { HideField } from '@nestjs/graphql';
|
||||||
|
|
||||||
@InputType()
|
@InputType()
|
||||||
export class WorkspaceMemberCountAggregateInput {
|
export class WorkspaceMemberCountAggregateInput {
|
||||||
@ -18,7 +19,7 @@ export class WorkspaceMemberCountAggregateInput {
|
|||||||
@Field(() => Boolean, { nullable: true })
|
@Field(() => Boolean, { nullable: true })
|
||||||
userId?: true;
|
userId?: true;
|
||||||
|
|
||||||
@Field(() => Boolean, { nullable: true })
|
@HideField()
|
||||||
workspaceId?: true;
|
workspaceId?: true;
|
||||||
|
|
||||||
@Field(() => Boolean, { nullable: true })
|
@Field(() => Boolean, { nullable: true })
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { Field } from '@nestjs/graphql';
|
import { Field } from '@nestjs/graphql';
|
||||||
import { InputType } from '@nestjs/graphql';
|
import { InputType } from '@nestjs/graphql';
|
||||||
import { SortOrder } from '../prisma/sort-order.enum';
|
import { SortOrder } from '../prisma/sort-order.enum';
|
||||||
|
import { HideField } from '@nestjs/graphql';
|
||||||
|
|
||||||
@InputType()
|
@InputType()
|
||||||
export class WorkspaceMemberCountOrderByAggregateInput {
|
export class WorkspaceMemberCountOrderByAggregateInput {
|
||||||
@ -19,6 +20,6 @@ export class WorkspaceMemberCountOrderByAggregateInput {
|
|||||||
@Field(() => SortOrder, { nullable: true })
|
@Field(() => SortOrder, { nullable: true })
|
||||||
userId?: keyof typeof SortOrder;
|
userId?: keyof typeof SortOrder;
|
||||||
|
|
||||||
@Field(() => SortOrder, { nullable: true })
|
@HideField()
|
||||||
workspaceId?: keyof typeof SortOrder;
|
workspaceId?: keyof typeof SortOrder;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import { Field } from '@nestjs/graphql';
|
import { Field } from '@nestjs/graphql';
|
||||||
import { InputType } from '@nestjs/graphql';
|
import { InputType } from '@nestjs/graphql';
|
||||||
|
import { HideField } from '@nestjs/graphql';
|
||||||
|
|
||||||
@InputType()
|
@InputType()
|
||||||
export class WorkspaceMemberCreateManyInput {
|
export class WorkspaceMemberCreateManyInput {
|
||||||
@ -18,6 +19,6 @@ export class WorkspaceMemberCreateManyInput {
|
|||||||
@Field(() => String, { nullable: false })
|
@Field(() => String, { nullable: false })
|
||||||
userId!: string;
|
userId!: string;
|
||||||
|
|
||||||
@Field(() => String, { nullable: false })
|
@HideField()
|
||||||
workspaceId!: string;
|
workspaceId!: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { Field } from '@nestjs/graphql';
|
import { Field } from '@nestjs/graphql';
|
||||||
import { InputType } from '@nestjs/graphql';
|
import { InputType } from '@nestjs/graphql';
|
||||||
import { WorkspaceCreateNestedOneWithoutWorkspaceMemberInput } from '../workspace/workspace-create-nested-one-without-workspace-member.input';
|
import { WorkspaceCreateNestedOneWithoutWorkspaceMemberInput } from '../workspace/workspace-create-nested-one-without-workspace-member.input';
|
||||||
|
import { HideField } from '@nestjs/graphql';
|
||||||
|
|
||||||
@InputType()
|
@InputType()
|
||||||
export class WorkspaceMemberCreateWithoutUserInput {
|
export class WorkspaceMemberCreateWithoutUserInput {
|
||||||
@ -16,8 +17,6 @@ export class WorkspaceMemberCreateWithoutUserInput {
|
|||||||
@Field(() => Date, { nullable: true })
|
@Field(() => Date, { nullable: true })
|
||||||
deletedAt?: Date | string;
|
deletedAt?: Date | string;
|
||||||
|
|
||||||
@Field(() => WorkspaceCreateNestedOneWithoutWorkspaceMemberInput, {
|
@HideField()
|
||||||
nullable: false,
|
|
||||||
})
|
|
||||||
workspace!: WorkspaceCreateNestedOneWithoutWorkspaceMemberInput;
|
workspace!: WorkspaceCreateNestedOneWithoutWorkspaceMemberInput;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import { Field } from '@nestjs/graphql';
|
|||||||
import { InputType } from '@nestjs/graphql';
|
import { InputType } from '@nestjs/graphql';
|
||||||
import { UserCreateNestedOneWithoutWorkspaceMemberInput } from '../user/user-create-nested-one-without-workspace-member.input';
|
import { UserCreateNestedOneWithoutWorkspaceMemberInput } from '../user/user-create-nested-one-without-workspace-member.input';
|
||||||
import { WorkspaceCreateNestedOneWithoutWorkspaceMemberInput } from '../workspace/workspace-create-nested-one-without-workspace-member.input';
|
import { WorkspaceCreateNestedOneWithoutWorkspaceMemberInput } from '../workspace/workspace-create-nested-one-without-workspace-member.input';
|
||||||
|
import { HideField } from '@nestjs/graphql';
|
||||||
|
|
||||||
@InputType()
|
@InputType()
|
||||||
export class WorkspaceMemberCreateInput {
|
export class WorkspaceMemberCreateInput {
|
||||||
@ -22,8 +23,6 @@ export class WorkspaceMemberCreateInput {
|
|||||||
})
|
})
|
||||||
user!: UserCreateNestedOneWithoutWorkspaceMemberInput;
|
user!: UserCreateNestedOneWithoutWorkspaceMemberInput;
|
||||||
|
|
||||||
@Field(() => WorkspaceCreateNestedOneWithoutWorkspaceMemberInput, {
|
@HideField()
|
||||||
nullable: false,
|
|
||||||
})
|
|
||||||
workspace!: WorkspaceCreateNestedOneWithoutWorkspaceMemberInput;
|
workspace!: WorkspaceCreateNestedOneWithoutWorkspaceMemberInput;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import { Field } from '@nestjs/graphql';
|
import { Field } from '@nestjs/graphql';
|
||||||
import { InputType } from '@nestjs/graphql';
|
import { InputType } from '@nestjs/graphql';
|
||||||
|
import { HideField } from '@nestjs/graphql';
|
||||||
|
|
||||||
@InputType()
|
@InputType()
|
||||||
export class WorkspaceMemberMaxAggregateInput {
|
export class WorkspaceMemberMaxAggregateInput {
|
||||||
@ -18,6 +19,6 @@ export class WorkspaceMemberMaxAggregateInput {
|
|||||||
@Field(() => Boolean, { nullable: true })
|
@Field(() => Boolean, { nullable: true })
|
||||||
userId?: true;
|
userId?: true;
|
||||||
|
|
||||||
@Field(() => Boolean, { nullable: true })
|
@HideField()
|
||||||
workspaceId?: true;
|
workspaceId?: true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { Field } from '@nestjs/graphql';
|
import { Field } from '@nestjs/graphql';
|
||||||
import { InputType } from '@nestjs/graphql';
|
import { InputType } from '@nestjs/graphql';
|
||||||
import { SortOrder } from '../prisma/sort-order.enum';
|
import { SortOrder } from '../prisma/sort-order.enum';
|
||||||
|
import { HideField } from '@nestjs/graphql';
|
||||||
|
|
||||||
@InputType()
|
@InputType()
|
||||||
export class WorkspaceMemberMaxOrderByAggregateInput {
|
export class WorkspaceMemberMaxOrderByAggregateInput {
|
||||||
@ -19,6 +20,6 @@ export class WorkspaceMemberMaxOrderByAggregateInput {
|
|||||||
@Field(() => SortOrder, { nullable: true })
|
@Field(() => SortOrder, { nullable: true })
|
||||||
userId?: keyof typeof SortOrder;
|
userId?: keyof typeof SortOrder;
|
||||||
|
|
||||||
@Field(() => SortOrder, { nullable: true })
|
@HideField()
|
||||||
workspaceId?: keyof typeof SortOrder;
|
workspaceId?: keyof typeof SortOrder;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import { Field } from '@nestjs/graphql';
|
import { Field } from '@nestjs/graphql';
|
||||||
import { InputType } from '@nestjs/graphql';
|
import { InputType } from '@nestjs/graphql';
|
||||||
|
import { HideField } from '@nestjs/graphql';
|
||||||
|
|
||||||
@InputType()
|
@InputType()
|
||||||
export class WorkspaceMemberMinAggregateInput {
|
export class WorkspaceMemberMinAggregateInput {
|
||||||
@ -18,6 +19,6 @@ export class WorkspaceMemberMinAggregateInput {
|
|||||||
@Field(() => Boolean, { nullable: true })
|
@Field(() => Boolean, { nullable: true })
|
||||||
userId?: true;
|
userId?: true;
|
||||||
|
|
||||||
@Field(() => Boolean, { nullable: true })
|
@HideField()
|
||||||
workspaceId?: true;
|
workspaceId?: true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { Field } from '@nestjs/graphql';
|
import { Field } from '@nestjs/graphql';
|
||||||
import { InputType } from '@nestjs/graphql';
|
import { InputType } from '@nestjs/graphql';
|
||||||
import { SortOrder } from '../prisma/sort-order.enum';
|
import { SortOrder } from '../prisma/sort-order.enum';
|
||||||
|
import { HideField } from '@nestjs/graphql';
|
||||||
|
|
||||||
@InputType()
|
@InputType()
|
||||||
export class WorkspaceMemberMinOrderByAggregateInput {
|
export class WorkspaceMemberMinOrderByAggregateInput {
|
||||||
@ -19,6 +20,6 @@ export class WorkspaceMemberMinOrderByAggregateInput {
|
|||||||
@Field(() => SortOrder, { nullable: true })
|
@Field(() => SortOrder, { nullable: true })
|
||||||
userId?: keyof typeof SortOrder;
|
userId?: keyof typeof SortOrder;
|
||||||
|
|
||||||
@Field(() => SortOrder, { nullable: true })
|
@HideField()
|
||||||
workspaceId?: keyof typeof SortOrder;
|
workspaceId?: keyof typeof SortOrder;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { Field } from '@nestjs/graphql';
|
import { Field } from '@nestjs/graphql';
|
||||||
import { InputType } from '@nestjs/graphql';
|
import { InputType } from '@nestjs/graphql';
|
||||||
import { SortOrder } from '../prisma/sort-order.enum';
|
import { SortOrder } from '../prisma/sort-order.enum';
|
||||||
|
import { HideField } from '@nestjs/graphql';
|
||||||
import { WorkspaceMemberCountOrderByAggregateInput } from './workspace-member-count-order-by-aggregate.input';
|
import { WorkspaceMemberCountOrderByAggregateInput } from './workspace-member-count-order-by-aggregate.input';
|
||||||
import { WorkspaceMemberMaxOrderByAggregateInput } from './workspace-member-max-order-by-aggregate.input';
|
import { WorkspaceMemberMaxOrderByAggregateInput } from './workspace-member-max-order-by-aggregate.input';
|
||||||
import { WorkspaceMemberMinOrderByAggregateInput } from './workspace-member-min-order-by-aggregate.input';
|
import { WorkspaceMemberMinOrderByAggregateInput } from './workspace-member-min-order-by-aggregate.input';
|
||||||
@ -22,7 +23,7 @@ export class WorkspaceMemberOrderByWithAggregationInput {
|
|||||||
@Field(() => SortOrder, { nullable: true })
|
@Field(() => SortOrder, { nullable: true })
|
||||||
userId?: keyof typeof SortOrder;
|
userId?: keyof typeof SortOrder;
|
||||||
|
|
||||||
@Field(() => SortOrder, { nullable: true })
|
@HideField()
|
||||||
workspaceId?: keyof typeof SortOrder;
|
workspaceId?: keyof typeof SortOrder;
|
||||||
|
|
||||||
@Field(() => WorkspaceMemberCountOrderByAggregateInput, { nullable: true })
|
@Field(() => WorkspaceMemberCountOrderByAggregateInput, { nullable: true })
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { Field } from '@nestjs/graphql';
|
import { Field } from '@nestjs/graphql';
|
||||||
import { InputType } from '@nestjs/graphql';
|
import { InputType } from '@nestjs/graphql';
|
||||||
import { SortOrder } from '../prisma/sort-order.enum';
|
import { SortOrder } from '../prisma/sort-order.enum';
|
||||||
|
import { HideField } from '@nestjs/graphql';
|
||||||
import { UserOrderByWithRelationInput } from '../user/user-order-by-with-relation.input';
|
import { UserOrderByWithRelationInput } from '../user/user-order-by-with-relation.input';
|
||||||
import { WorkspaceOrderByWithRelationInput } from '../workspace/workspace-order-by-with-relation.input';
|
import { WorkspaceOrderByWithRelationInput } from '../workspace/workspace-order-by-with-relation.input';
|
||||||
|
|
||||||
@ -21,12 +22,12 @@ export class WorkspaceMemberOrderByWithRelationInput {
|
|||||||
@Field(() => SortOrder, { nullable: true })
|
@Field(() => SortOrder, { nullable: true })
|
||||||
userId?: keyof typeof SortOrder;
|
userId?: keyof typeof SortOrder;
|
||||||
|
|
||||||
@Field(() => SortOrder, { nullable: true })
|
@HideField()
|
||||||
workspaceId?: keyof typeof SortOrder;
|
workspaceId?: keyof typeof SortOrder;
|
||||||
|
|
||||||
@Field(() => UserOrderByWithRelationInput, { nullable: true })
|
@Field(() => UserOrderByWithRelationInput, { nullable: true })
|
||||||
user?: UserOrderByWithRelationInput;
|
user?: UserOrderByWithRelationInput;
|
||||||
|
|
||||||
@Field(() => WorkspaceOrderByWithRelationInput, { nullable: true })
|
@HideField()
|
||||||
workspace?: WorkspaceOrderByWithRelationInput;
|
workspace?: WorkspaceOrderByWithRelationInput;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { InputType } from '@nestjs/graphql';
|
|||||||
import { StringWithAggregatesFilter } from '../prisma/string-with-aggregates-filter.input';
|
import { StringWithAggregatesFilter } from '../prisma/string-with-aggregates-filter.input';
|
||||||
import { DateTimeWithAggregatesFilter } from '../prisma/date-time-with-aggregates-filter.input';
|
import { DateTimeWithAggregatesFilter } from '../prisma/date-time-with-aggregates-filter.input';
|
||||||
import { DateTimeNullableWithAggregatesFilter } from '../prisma/date-time-nullable-with-aggregates-filter.input';
|
import { DateTimeNullableWithAggregatesFilter } from '../prisma/date-time-nullable-with-aggregates-filter.input';
|
||||||
|
import { HideField } from '@nestjs/graphql';
|
||||||
|
|
||||||
@InputType()
|
@InputType()
|
||||||
export class WorkspaceMemberScalarWhereWithAggregatesInput {
|
export class WorkspaceMemberScalarWhereWithAggregatesInput {
|
||||||
@ -36,6 +37,6 @@ export class WorkspaceMemberScalarWhereWithAggregatesInput {
|
|||||||
@Field(() => StringWithAggregatesFilter, { nullable: true })
|
@Field(() => StringWithAggregatesFilter, { nullable: true })
|
||||||
userId?: StringWithAggregatesFilter;
|
userId?: StringWithAggregatesFilter;
|
||||||
|
|
||||||
@Field(() => StringWithAggregatesFilter, { nullable: true })
|
@HideField()
|
||||||
workspaceId?: StringWithAggregatesFilter;
|
workspaceId?: StringWithAggregatesFilter;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { InputType } from '@nestjs/graphql';
|
|||||||
import { StringFilter } from '../prisma/string-filter.input';
|
import { StringFilter } from '../prisma/string-filter.input';
|
||||||
import { DateTimeFilter } from '../prisma/date-time-filter.input';
|
import { DateTimeFilter } from '../prisma/date-time-filter.input';
|
||||||
import { DateTimeNullableFilter } from '../prisma/date-time-nullable-filter.input';
|
import { DateTimeNullableFilter } from '../prisma/date-time-nullable-filter.input';
|
||||||
|
import { HideField } from '@nestjs/graphql';
|
||||||
|
|
||||||
@InputType()
|
@InputType()
|
||||||
export class WorkspaceMemberScalarWhereInput {
|
export class WorkspaceMemberScalarWhereInput {
|
||||||
@ -30,6 +31,6 @@ export class WorkspaceMemberScalarWhereInput {
|
|||||||
@Field(() => StringFilter, { nullable: true })
|
@Field(() => StringFilter, { nullable: true })
|
||||||
userId?: StringFilter;
|
userId?: StringFilter;
|
||||||
|
|
||||||
@Field(() => StringFilter, { nullable: true })
|
@HideField()
|
||||||
workspaceId?: StringFilter;
|
workspaceId?: StringFilter;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import { Field } from '@nestjs/graphql';
|
import { Field } from '@nestjs/graphql';
|
||||||
import { InputType } from '@nestjs/graphql';
|
import { InputType } from '@nestjs/graphql';
|
||||||
|
import { HideField } from '@nestjs/graphql';
|
||||||
|
|
||||||
@InputType()
|
@InputType()
|
||||||
export class WorkspaceMemberUncheckedCreateWithoutUserInput {
|
export class WorkspaceMemberUncheckedCreateWithoutUserInput {
|
||||||
@ -15,6 +16,6 @@ export class WorkspaceMemberUncheckedCreateWithoutUserInput {
|
|||||||
@Field(() => Date, { nullable: true })
|
@Field(() => Date, { nullable: true })
|
||||||
deletedAt?: Date | string;
|
deletedAt?: Date | string;
|
||||||
|
|
||||||
@Field(() => String, { nullable: false })
|
@HideField()
|
||||||
workspaceId!: string;
|
workspaceId!: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import { Field } from '@nestjs/graphql';
|
import { Field } from '@nestjs/graphql';
|
||||||
import { InputType } from '@nestjs/graphql';
|
import { InputType } from '@nestjs/graphql';
|
||||||
|
import { HideField } from '@nestjs/graphql';
|
||||||
|
|
||||||
@InputType()
|
@InputType()
|
||||||
export class WorkspaceMemberUncheckedCreateInput {
|
export class WorkspaceMemberUncheckedCreateInput {
|
||||||
@ -18,6 +19,6 @@ export class WorkspaceMemberUncheckedCreateInput {
|
|||||||
@Field(() => String, { nullable: false })
|
@Field(() => String, { nullable: false })
|
||||||
userId!: string;
|
userId!: string;
|
||||||
|
|
||||||
@Field(() => String, { nullable: false })
|
@HideField()
|
||||||
workspaceId!: string;
|
workspaceId!: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { InputType } from '@nestjs/graphql';
|
|||||||
import { StringFieldUpdateOperationsInput } from '../prisma/string-field-update-operations.input';
|
import { StringFieldUpdateOperationsInput } from '../prisma/string-field-update-operations.input';
|
||||||
import { DateTimeFieldUpdateOperationsInput } from '../prisma/date-time-field-update-operations.input';
|
import { DateTimeFieldUpdateOperationsInput } from '../prisma/date-time-field-update-operations.input';
|
||||||
import { NullableDateTimeFieldUpdateOperationsInput } from '../prisma/nullable-date-time-field-update-operations.input';
|
import { NullableDateTimeFieldUpdateOperationsInput } from '../prisma/nullable-date-time-field-update-operations.input';
|
||||||
|
import { HideField } from '@nestjs/graphql';
|
||||||
|
|
||||||
@InputType()
|
@InputType()
|
||||||
export class WorkspaceMemberUncheckedUpdateManyInput {
|
export class WorkspaceMemberUncheckedUpdateManyInput {
|
||||||
@ -21,6 +22,6 @@ export class WorkspaceMemberUncheckedUpdateManyInput {
|
|||||||
@Field(() => StringFieldUpdateOperationsInput, { nullable: true })
|
@Field(() => StringFieldUpdateOperationsInput, { nullable: true })
|
||||||
userId?: StringFieldUpdateOperationsInput;
|
userId?: StringFieldUpdateOperationsInput;
|
||||||
|
|
||||||
@Field(() => StringFieldUpdateOperationsInput, { nullable: true })
|
@HideField()
|
||||||
workspaceId?: StringFieldUpdateOperationsInput;
|
workspaceId?: StringFieldUpdateOperationsInput;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { InputType } from '@nestjs/graphql';
|
|||||||
import { StringFieldUpdateOperationsInput } from '../prisma/string-field-update-operations.input';
|
import { StringFieldUpdateOperationsInput } from '../prisma/string-field-update-operations.input';
|
||||||
import { DateTimeFieldUpdateOperationsInput } from '../prisma/date-time-field-update-operations.input';
|
import { DateTimeFieldUpdateOperationsInput } from '../prisma/date-time-field-update-operations.input';
|
||||||
import { NullableDateTimeFieldUpdateOperationsInput } from '../prisma/nullable-date-time-field-update-operations.input';
|
import { NullableDateTimeFieldUpdateOperationsInput } from '../prisma/nullable-date-time-field-update-operations.input';
|
||||||
|
import { HideField } from '@nestjs/graphql';
|
||||||
|
|
||||||
@InputType()
|
@InputType()
|
||||||
export class WorkspaceMemberUncheckedUpdateWithoutUserInput {
|
export class WorkspaceMemberUncheckedUpdateWithoutUserInput {
|
||||||
@ -18,6 +19,6 @@ export class WorkspaceMemberUncheckedUpdateWithoutUserInput {
|
|||||||
@Field(() => NullableDateTimeFieldUpdateOperationsInput, { nullable: true })
|
@Field(() => NullableDateTimeFieldUpdateOperationsInput, { nullable: true })
|
||||||
deletedAt?: NullableDateTimeFieldUpdateOperationsInput;
|
deletedAt?: NullableDateTimeFieldUpdateOperationsInput;
|
||||||
|
|
||||||
@Field(() => StringFieldUpdateOperationsInput, { nullable: true })
|
@HideField()
|
||||||
workspaceId?: StringFieldUpdateOperationsInput;
|
workspaceId?: StringFieldUpdateOperationsInput;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { InputType } from '@nestjs/graphql';
|
|||||||
import { StringFieldUpdateOperationsInput } from '../prisma/string-field-update-operations.input';
|
import { StringFieldUpdateOperationsInput } from '../prisma/string-field-update-operations.input';
|
||||||
import { DateTimeFieldUpdateOperationsInput } from '../prisma/date-time-field-update-operations.input';
|
import { DateTimeFieldUpdateOperationsInput } from '../prisma/date-time-field-update-operations.input';
|
||||||
import { NullableDateTimeFieldUpdateOperationsInput } from '../prisma/nullable-date-time-field-update-operations.input';
|
import { NullableDateTimeFieldUpdateOperationsInput } from '../prisma/nullable-date-time-field-update-operations.input';
|
||||||
|
import { HideField } from '@nestjs/graphql';
|
||||||
|
|
||||||
@InputType()
|
@InputType()
|
||||||
export class WorkspaceMemberUncheckedUpdateInput {
|
export class WorkspaceMemberUncheckedUpdateInput {
|
||||||
@ -21,6 +22,6 @@ export class WorkspaceMemberUncheckedUpdateInput {
|
|||||||
@Field(() => StringFieldUpdateOperationsInput, { nullable: true })
|
@Field(() => StringFieldUpdateOperationsInput, { nullable: true })
|
||||||
userId?: StringFieldUpdateOperationsInput;
|
userId?: StringFieldUpdateOperationsInput;
|
||||||
|
|
||||||
@Field(() => StringFieldUpdateOperationsInput, { nullable: true })
|
@HideField()
|
||||||
workspaceId?: StringFieldUpdateOperationsInput;
|
workspaceId?: StringFieldUpdateOperationsInput;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import { StringFieldUpdateOperationsInput } from '../prisma/string-field-update-
|
|||||||
import { DateTimeFieldUpdateOperationsInput } from '../prisma/date-time-field-update-operations.input';
|
import { DateTimeFieldUpdateOperationsInput } from '../prisma/date-time-field-update-operations.input';
|
||||||
import { NullableDateTimeFieldUpdateOperationsInput } from '../prisma/nullable-date-time-field-update-operations.input';
|
import { NullableDateTimeFieldUpdateOperationsInput } from '../prisma/nullable-date-time-field-update-operations.input';
|
||||||
import { WorkspaceUpdateOneRequiredWithoutWorkspaceMemberNestedInput } from '../workspace/workspace-update-one-required-without-workspace-member-nested.input';
|
import { WorkspaceUpdateOneRequiredWithoutWorkspaceMemberNestedInput } from '../workspace/workspace-update-one-required-without-workspace-member-nested.input';
|
||||||
|
import { HideField } from '@nestjs/graphql';
|
||||||
|
|
||||||
@InputType()
|
@InputType()
|
||||||
export class WorkspaceMemberUpdateWithoutUserInput {
|
export class WorkspaceMemberUpdateWithoutUserInput {
|
||||||
@ -19,8 +20,6 @@ export class WorkspaceMemberUpdateWithoutUserInput {
|
|||||||
@Field(() => NullableDateTimeFieldUpdateOperationsInput, { nullable: true })
|
@Field(() => NullableDateTimeFieldUpdateOperationsInput, { nullable: true })
|
||||||
deletedAt?: NullableDateTimeFieldUpdateOperationsInput;
|
deletedAt?: NullableDateTimeFieldUpdateOperationsInput;
|
||||||
|
|
||||||
@Field(() => WorkspaceUpdateOneRequiredWithoutWorkspaceMemberNestedInput, {
|
@HideField()
|
||||||
nullable: true,
|
|
||||||
})
|
|
||||||
workspace?: WorkspaceUpdateOneRequiredWithoutWorkspaceMemberNestedInput;
|
workspace?: WorkspaceUpdateOneRequiredWithoutWorkspaceMemberNestedInput;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import { DateTimeFieldUpdateOperationsInput } from '../prisma/date-time-field-up
|
|||||||
import { NullableDateTimeFieldUpdateOperationsInput } from '../prisma/nullable-date-time-field-update-operations.input';
|
import { NullableDateTimeFieldUpdateOperationsInput } from '../prisma/nullable-date-time-field-update-operations.input';
|
||||||
import { UserUpdateOneRequiredWithoutWorkspaceMemberNestedInput } from '../user/user-update-one-required-without-workspace-member-nested.input';
|
import { UserUpdateOneRequiredWithoutWorkspaceMemberNestedInput } from '../user/user-update-one-required-without-workspace-member-nested.input';
|
||||||
import { WorkspaceUpdateOneRequiredWithoutWorkspaceMemberNestedInput } from '../workspace/workspace-update-one-required-without-workspace-member-nested.input';
|
import { WorkspaceUpdateOneRequiredWithoutWorkspaceMemberNestedInput } from '../workspace/workspace-update-one-required-without-workspace-member-nested.input';
|
||||||
|
import { HideField } from '@nestjs/graphql';
|
||||||
|
|
||||||
@InputType()
|
@InputType()
|
||||||
export class WorkspaceMemberUpdateInput {
|
export class WorkspaceMemberUpdateInput {
|
||||||
@ -25,8 +26,6 @@ export class WorkspaceMemberUpdateInput {
|
|||||||
})
|
})
|
||||||
user?: UserUpdateOneRequiredWithoutWorkspaceMemberNestedInput;
|
user?: UserUpdateOneRequiredWithoutWorkspaceMemberNestedInput;
|
||||||
|
|
||||||
@Field(() => WorkspaceUpdateOneRequiredWithoutWorkspaceMemberNestedInput, {
|
@HideField()
|
||||||
nullable: true,
|
|
||||||
})
|
|
||||||
workspace?: WorkspaceUpdateOneRequiredWithoutWorkspaceMemberNestedInput;
|
workspace?: WorkspaceUpdateOneRequiredWithoutWorkspaceMemberNestedInput;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { InputType } from '@nestjs/graphql';
|
|||||||
import { StringFilter } from '../prisma/string-filter.input';
|
import { StringFilter } from '../prisma/string-filter.input';
|
||||||
import { DateTimeFilter } from '../prisma/date-time-filter.input';
|
import { DateTimeFilter } from '../prisma/date-time-filter.input';
|
||||||
import { DateTimeNullableFilter } from '../prisma/date-time-nullable-filter.input';
|
import { DateTimeNullableFilter } from '../prisma/date-time-nullable-filter.input';
|
||||||
|
import { HideField } from '@nestjs/graphql';
|
||||||
import { UserRelationFilter } from '../user/user-relation-filter.input';
|
import { UserRelationFilter } from '../user/user-relation-filter.input';
|
||||||
import { WorkspaceRelationFilter } from '../workspace/workspace-relation-filter.input';
|
import { WorkspaceRelationFilter } from '../workspace/workspace-relation-filter.input';
|
||||||
|
|
||||||
@ -32,12 +33,12 @@ export class WorkspaceMemberWhereInput {
|
|||||||
@Field(() => StringFilter, { nullable: true })
|
@Field(() => StringFilter, { nullable: true })
|
||||||
userId?: StringFilter;
|
userId?: StringFilter;
|
||||||
|
|
||||||
@Field(() => StringFilter, { nullable: true })
|
@HideField()
|
||||||
workspaceId?: StringFilter;
|
workspaceId?: StringFilter;
|
||||||
|
|
||||||
@Field(() => UserRelationFilter, { nullable: true })
|
@Field(() => UserRelationFilter, { nullable: true })
|
||||||
user?: UserRelationFilter;
|
user?: UserRelationFilter;
|
||||||
|
|
||||||
@Field(() => WorkspaceRelationFilter, { nullable: true })
|
@HideField()
|
||||||
workspace?: WorkspaceRelationFilter;
|
workspace?: WorkspaceRelationFilter;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import { Company } from '../company/company.model';
|
|||||||
import { Person } from '../person/person.model';
|
import { Person } from '../person/person.model';
|
||||||
import { WorkspaceCount } from './workspace-count.output';
|
import { WorkspaceCount } from './workspace-count.output';
|
||||||
|
|
||||||
@ObjectType()
|
@ObjectType({})
|
||||||
export class Workspace {
|
export class Workspace {
|
||||||
@Field(() => ID, { nullable: false })
|
@Field(() => ID, { nullable: false })
|
||||||
id!: string;
|
id!: string;
|
||||||
|
|||||||
@ -3,15 +3,16 @@ import { GraphQLModule } from '@nestjs/graphql';
|
|||||||
import { ApolloDriver, ApolloDriverConfig } from '@nestjs/apollo';
|
import { ApolloDriver, ApolloDriverConfig } from '@nestjs/apollo';
|
||||||
import { CompanyResolver } from './resolvers/company.resolver';
|
import { CompanyResolver } from './resolvers/company.resolver';
|
||||||
import { UserResolver } from './resolvers/user.resolver';
|
import { UserResolver } from './resolvers/user.resolver';
|
||||||
import { PeopleResolver } from './resolvers/people.resolver';
|
import { PersonResolver } from './resolvers/person.resolver';
|
||||||
|
|
||||||
import { PersonRelationsResolver } from './resolvers/relations/people-relations.resolver';
|
import { PersonRelationsResolver } from './resolvers/relations/person-relations.resolver';
|
||||||
import { UserRelationsResolver } from './resolvers/relations/user-relations.resolver';
|
import { UserRelationsResolver } from './resolvers/relations/user-relations.resolver';
|
||||||
import { WorkspaceMemberRelationsResolver } from './resolvers/relations/workspace-member-relations.resolver';
|
import { WorkspaceMemberRelationsResolver } from './resolvers/relations/workspace-member-relations.resolver';
|
||||||
import { ConfigService } from '@nestjs/config';
|
import { ConfigService } from '@nestjs/config';
|
||||||
import { AuthModule } from 'src/auth/auth.module';
|
import { AuthModule } from 'src/auth/auth.module';
|
||||||
import { CompanyRelationsResolver } from './resolvers/relations/company-relations.resolver';
|
import { CompanyRelationsResolver } from './resolvers/relations/company-relations.resolver';
|
||||||
import { PrismaModule } from 'src/database/prisma.module';
|
import { PrismaModule } from 'src/database/prisma.module';
|
||||||
|
import { ArgsService } from './resolvers/services/args.service';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
@ -25,9 +26,10 @@ import { PrismaModule } from 'src/database/prisma.module';
|
|||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
ConfigService,
|
ConfigService,
|
||||||
|
ArgsService,
|
||||||
|
|
||||||
CompanyResolver,
|
CompanyResolver,
|
||||||
PeopleResolver,
|
PersonResolver,
|
||||||
UserResolver,
|
UserResolver,
|
||||||
|
|
||||||
CompanyRelationsResolver,
|
CompanyRelationsResolver,
|
||||||
|
|||||||
@ -1,37 +1,39 @@
|
|||||||
import { Resolver, Query, Args, Mutation } from '@nestjs/graphql';
|
import { Resolver, Query, Args, Mutation } from '@nestjs/graphql';
|
||||||
import { JwtAuthGuard } from 'src/auth/guards/jwt.auth.guard';
|
import { JwtAuthGuard } from 'src/auth/guards/jwt.auth.guard';
|
||||||
import { UseGuards } from '@nestjs/common';
|
import { UseGuards } from '@nestjs/common';
|
||||||
import { User, UserType } from './decorators/user.decorator';
|
import { AuthWorkspace } from './decorators/auth-workspace.decorator';
|
||||||
import { PrismaService } from 'src/database/prisma.service';
|
import { PrismaService } from 'src/database/prisma.service';
|
||||||
import { Company } from '../@generated/company/company.model';
|
import { Company } from '../@generated/company/company.model';
|
||||||
import { FindManyCompanyArgs } from '../@generated/company/find-many-company.args';
|
import { FindManyCompanyArgs } from '../@generated/company/find-many-company.args';
|
||||||
import { DeleteOneCompanyArgs } from '../@generated/company/delete-one-company.args';
|
|
||||||
import { UpdateOneCompanyArgs } from '../@generated/company/update-one-company.args';
|
import { UpdateOneCompanyArgs } from '../@generated/company/update-one-company.args';
|
||||||
import { CreateOneCompanyArgs } from '../@generated/company/create-one-company.args';
|
import { CreateOneCompanyArgs } from '../@generated/company/create-one-company.args';
|
||||||
import { AffectedRows } from '../@generated/prisma/affected-rows.output';
|
import { AffectedRows } from '../@generated/prisma/affected-rows.output';
|
||||||
import { DeleteManyCompanyArgs } from '../@generated/company/delete-many-company.args';
|
import { DeleteManyCompanyArgs } from '../@generated/company/delete-many-company.args';
|
||||||
|
import { Workspace } from '@prisma/client';
|
||||||
|
import { ArgsService } from './services/args.service';
|
||||||
|
import { CheckWorkspaceOwnership } from 'src/auth/guards/check-workspace-ownership.guard';
|
||||||
|
|
||||||
|
@UseGuards(JwtAuthGuard, CheckWorkspaceOwnership)
|
||||||
@Resolver(() => Company)
|
@Resolver(() => Company)
|
||||||
export class CompanyResolver {
|
export class CompanyResolver {
|
||||||
constructor(private readonly prismaService: PrismaService) {}
|
constructor(
|
||||||
|
private readonly prismaService: PrismaService,
|
||||||
|
private readonly argsService: ArgsService,
|
||||||
|
) {}
|
||||||
|
|
||||||
@UseGuards(JwtAuthGuard)
|
|
||||||
@Query(() => [Company])
|
@Query(() => [Company])
|
||||||
async companies(@Args() args: FindManyCompanyArgs) {
|
async findManyCompany(
|
||||||
return this.prismaService.company.findMany(args);
|
@Args() args: FindManyCompanyArgs,
|
||||||
|
@AuthWorkspace() workspace: Workspace,
|
||||||
|
) {
|
||||||
|
const preparedArgs =
|
||||||
|
await this.argsService.prepareFindManyArgs<FindManyCompanyArgs>(
|
||||||
|
args,
|
||||||
|
workspace,
|
||||||
|
);
|
||||||
|
return this.prismaService.company.findMany(preparedArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UseGuards(JwtAuthGuard)
|
|
||||||
@Mutation(() => Company, {
|
|
||||||
nullable: true,
|
|
||||||
})
|
|
||||||
async deleteOneCompany(
|
|
||||||
@Args() args: DeleteOneCompanyArgs,
|
|
||||||
): Promise<Company | null> {
|
|
||||||
return this.prismaService.company.delete(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@UseGuards(JwtAuthGuard)
|
|
||||||
@Mutation(() => Company, {
|
@Mutation(() => Company, {
|
||||||
nullable: true,
|
nullable: true,
|
||||||
})
|
})
|
||||||
@ -46,23 +48,6 @@ export class CompanyResolver {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@UseGuards(JwtAuthGuard)
|
|
||||||
@Mutation(() => Company, {
|
|
||||||
nullable: false,
|
|
||||||
})
|
|
||||||
async createOneCompany(
|
|
||||||
@Args() args: CreateOneCompanyArgs,
|
|
||||||
@User() user: UserType,
|
|
||||||
): Promise<Company> {
|
|
||||||
return this.prismaService.company.create({
|
|
||||||
data: {
|
|
||||||
...args.data,
|
|
||||||
...{ workspace: { connect: { id: user.workspaceId } } },
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@UseGuards(JwtAuthGuard)
|
|
||||||
@Mutation(() => AffectedRows, {
|
@Mutation(() => AffectedRows, {
|
||||||
nullable: false,
|
nullable: false,
|
||||||
})
|
})
|
||||||
@ -73,4 +58,19 @@ export class CompanyResolver {
|
|||||||
...args,
|
...args,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Mutation(() => Company, {
|
||||||
|
nullable: false,
|
||||||
|
})
|
||||||
|
async createOneCompany(
|
||||||
|
@Args() args: CreateOneCompanyArgs,
|
||||||
|
@AuthWorkspace() workspace: Workspace,
|
||||||
|
): Promise<Company> {
|
||||||
|
return this.prismaService.company.create({
|
||||||
|
data: {
|
||||||
|
...args.data,
|
||||||
|
...{ workspace: { connect: { id: workspace.id } } },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,14 +1,10 @@
|
|||||||
import { ExecutionContext, createParamDecorator } from '@nestjs/common';
|
import { ExecutionContext, createParamDecorator } from '@nestjs/common';
|
||||||
import { GqlExecutionContext } from '@nestjs/graphql';
|
import { GqlExecutionContext } from '@nestjs/graphql';
|
||||||
|
|
||||||
export const User = createParamDecorator(
|
export const AuthUser = createParamDecorator(
|
||||||
(data: unknown, ctx: ExecutionContext) => {
|
(data: unknown, ctx: ExecutionContext) => {
|
||||||
const gqlContext = GqlExecutionContext.create(ctx);
|
const gqlContext = GqlExecutionContext.create(ctx);
|
||||||
const request = gqlContext.getContext().req;
|
const request = gqlContext.getContext().req;
|
||||||
return request.user;
|
return request.user;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
export type UserType = {
|
|
||||||
workspaceId: string;
|
|
||||||
};
|
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
import { ExecutionContext, createParamDecorator } from '@nestjs/common';
|
||||||
|
import { GqlExecutionContext } from '@nestjs/graphql';
|
||||||
|
|
||||||
|
export const AuthWorkspace = createParamDecorator(
|
||||||
|
(data: unknown, ctx: ExecutionContext) => {
|
||||||
|
const gqlContext = GqlExecutionContext.create(ctx);
|
||||||
|
const request = gqlContext.getContext().req;
|
||||||
|
return request.workspace;
|
||||||
|
},
|
||||||
|
);
|
||||||
@ -1,7 +1,6 @@
|
|||||||
import { Resolver, Query, Args, Mutation } from '@nestjs/graphql';
|
import { Resolver, Query, Args, Mutation } from '@nestjs/graphql';
|
||||||
import { UseGuards } from '@nestjs/common';
|
import { UseGuards } from '@nestjs/common';
|
||||||
import { JwtAuthGuard } from 'src/auth/guards/jwt.auth.guard';
|
import { JwtAuthGuard } from 'src/auth/guards/jwt.auth.guard';
|
||||||
import { User, UserType } from './decorators/user.decorator';
|
|
||||||
import { PrismaService } from 'src/database/prisma.service';
|
import { PrismaService } from 'src/database/prisma.service';
|
||||||
import { Person } from '../@generated/person/person.model';
|
import { Person } from '../@generated/person/person.model';
|
||||||
import { FindManyPersonArgs } from '../@generated/person/find-many-person.args';
|
import { FindManyPersonArgs } from '../@generated/person/find-many-person.args';
|
||||||
@ -9,22 +8,36 @@ import { UpdateOnePersonArgs } from '../@generated/person/update-one-person.args
|
|||||||
import { CreateOnePersonArgs } from '../@generated/person/create-one-person.args';
|
import { CreateOnePersonArgs } from '../@generated/person/create-one-person.args';
|
||||||
import { AffectedRows } from '../@generated/prisma/affected-rows.output';
|
import { AffectedRows } from '../@generated/prisma/affected-rows.output';
|
||||||
import { DeleteManyPersonArgs } from '../@generated/person/delete-many-person.args';
|
import { DeleteManyPersonArgs } from '../@generated/person/delete-many-person.args';
|
||||||
|
import { Workspace } from '../@generated/workspace/workspace.model';
|
||||||
|
import { AuthWorkspace } from './decorators/auth-workspace.decorator';
|
||||||
|
import { ArgsService } from './services/args.service';
|
||||||
|
import { CheckWorkspaceOwnership } from 'src/auth/guards/check-workspace-ownership.guard';
|
||||||
|
|
||||||
|
@UseGuards(JwtAuthGuard, CheckWorkspaceOwnership)
|
||||||
@Resolver(() => Person)
|
@Resolver(() => Person)
|
||||||
export class PeopleResolver {
|
export class PersonResolver {
|
||||||
constructor(private readonly prismaService: PrismaService) {}
|
constructor(
|
||||||
|
private readonly prismaService: PrismaService,
|
||||||
|
private readonly argsService: ArgsService,
|
||||||
|
) {}
|
||||||
|
|
||||||
@UseGuards(JwtAuthGuard)
|
|
||||||
@Query(() => [Person], {
|
@Query(() => [Person], {
|
||||||
nullable: false,
|
nullable: false,
|
||||||
})
|
})
|
||||||
async people(@Args() args: FindManyPersonArgs): Promise<Person[]> {
|
async findManyPerson(
|
||||||
|
@Args() args: FindManyPersonArgs,
|
||||||
|
@AuthWorkspace() workspace: Workspace,
|
||||||
|
): Promise<Person[]> {
|
||||||
|
const preparedArgs =
|
||||||
|
await this.argsService.prepareFindManyArgs<FindManyPersonArgs>(
|
||||||
|
args,
|
||||||
|
workspace,
|
||||||
|
);
|
||||||
return this.prismaService.person.findMany({
|
return this.prismaService.person.findMany({
|
||||||
...args,
|
...preparedArgs,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@UseGuards(JwtAuthGuard)
|
|
||||||
@Mutation(() => Person, {
|
@Mutation(() => Person, {
|
||||||
nullable: true,
|
nullable: true,
|
||||||
})
|
})
|
||||||
@ -34,28 +47,12 @@ export class PeopleResolver {
|
|||||||
if (!args.data.company?.connect?.id) {
|
if (!args.data.company?.connect?.id) {
|
||||||
args.data.company = { disconnect: true };
|
args.data.company = { disconnect: true };
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.prismaService.person.update({
|
return this.prismaService.person.update({
|
||||||
...args,
|
...args,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@UseGuards(JwtAuthGuard)
|
|
||||||
@Mutation(() => Person, {
|
|
||||||
nullable: false,
|
|
||||||
})
|
|
||||||
async createOnePerson(
|
|
||||||
@Args() args: CreateOnePersonArgs,
|
|
||||||
@User() user: UserType,
|
|
||||||
): Promise<Person> {
|
|
||||||
return this.prismaService.person.create({
|
|
||||||
data: {
|
|
||||||
...args.data,
|
|
||||||
...{ workspace: { connect: { id: user.workspaceId } } },
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@UseGuards(JwtAuthGuard)
|
|
||||||
@Mutation(() => AffectedRows, {
|
@Mutation(() => AffectedRows, {
|
||||||
nullable: false,
|
nullable: false,
|
||||||
})
|
})
|
||||||
@ -66,4 +63,19 @@ export class PeopleResolver {
|
|||||||
...args,
|
...args,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Mutation(() => Person, {
|
||||||
|
nullable: false,
|
||||||
|
})
|
||||||
|
async createOnePerson(
|
||||||
|
@Args() args: CreateOnePersonArgs,
|
||||||
|
@AuthWorkspace() workspace: Workspace,
|
||||||
|
): Promise<Person> {
|
||||||
|
return this.prismaService.person.create({
|
||||||
|
data: {
|
||||||
|
...args.data,
|
||||||
|
...{ workspace: { connect: { id: workspace.id } } },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
18
server/src/api/resolvers/services/args.service.ts
Normal file
18
server/src/api/resolvers/services/args.service.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { Injectable } from '@nestjs/common';
|
||||||
|
import { Workspace } from '@prisma/client';
|
||||||
|
|
||||||
|
type FindManyArgsType = { where?: object; orderBy?: object };
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class ArgsService {
|
||||||
|
async prepareFindManyArgs<T extends FindManyArgsType>(
|
||||||
|
args: T,
|
||||||
|
workspace: Workspace,
|
||||||
|
): Promise<T> {
|
||||||
|
args.where = {
|
||||||
|
...args.where,
|
||||||
|
...{ workspace: { is: { id: { equals: workspace.id } } } },
|
||||||
|
};
|
||||||
|
return args;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,31 +2,39 @@ import { Resolver, Query, Args } from '@nestjs/graphql';
|
|||||||
import { PrismaService } from 'src/database/prisma.service';
|
import { PrismaService } from 'src/database/prisma.service';
|
||||||
import { UseGuards } from '@nestjs/common';
|
import { UseGuards } from '@nestjs/common';
|
||||||
import { JwtAuthGuard } from 'src/auth/guards/jwt.auth.guard';
|
import { JwtAuthGuard } from 'src/auth/guards/jwt.auth.guard';
|
||||||
|
|
||||||
import { User } from '../@generated/user/user.model';
|
import { User } from '../@generated/user/user.model';
|
||||||
import { FindManyUserArgs } from '../@generated/user/find-many-user.args';
|
import { FindManyUserArgs } from '../@generated/user/find-many-user.args';
|
||||||
import { FindUniqueUserOrThrowArgs } from '../@generated/user/find-unique-user-or-throw.args';
|
import { Workspace } from '@prisma/client';
|
||||||
|
import { AuthWorkspace } from './decorators/auth-workspace.decorator';
|
||||||
|
import { ArgsService } from './services/args.service';
|
||||||
|
import { CheckWorkspaceOwnership } from 'src/auth/guards/check-workspace-ownership.guard';
|
||||||
|
|
||||||
|
@UseGuards(JwtAuthGuard, CheckWorkspaceOwnership)
|
||||||
@Resolver(() => User)
|
@Resolver(() => User)
|
||||||
export class UserResolver {
|
export class UserResolver {
|
||||||
constructor(private readonly prismaService: PrismaService) {}
|
constructor(
|
||||||
|
private readonly prismaService: PrismaService,
|
||||||
|
private readonly argsService: ArgsService,
|
||||||
|
) {}
|
||||||
|
|
||||||
@UseGuards(JwtAuthGuard)
|
|
||||||
@Query(() => [User], {
|
@Query(() => [User], {
|
||||||
nullable: false,
|
nullable: false,
|
||||||
})
|
})
|
||||||
async users(@Args() args: FindManyUserArgs): Promise<User[]> {
|
async findManyUser(
|
||||||
|
@Args() args: FindManyUserArgs,
|
||||||
|
@AuthWorkspace() workspace: Workspace,
|
||||||
|
): Promise<User[]> {
|
||||||
|
args.where = {
|
||||||
|
...args.where,
|
||||||
|
...{
|
||||||
|
WorkspaceMember: {
|
||||||
|
is: { workspace: { is: { id: { equals: workspace.id } } } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
return await this.prismaService.user.findMany({
|
return await this.prismaService.user.findMany({
|
||||||
...args,
|
...args,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@UseGuards(JwtAuthGuard)
|
|
||||||
@Query(() => User, {
|
|
||||||
nullable: false,
|
|
||||||
})
|
|
||||||
async user(@Args() args: FindUniqueUserOrThrowArgs): Promise<User | null> {
|
|
||||||
return await this.prismaService.user.findUnique({
|
|
||||||
...args,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,8 +8,9 @@ import {
|
|||||||
UseGuards,
|
UseGuards,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import { AuthGuard } from '@nestjs/passport';
|
import { AuthGuard } from '@nestjs/passport';
|
||||||
import { Request, Response } from 'express';
|
import { Response } from 'express';
|
||||||
import { AuthService } from './services/auth.service';
|
import { AuthService } from './services/auth.service';
|
||||||
|
import { GoogleRequest } from './strategies/google.auth.strategy';
|
||||||
|
|
||||||
@Controller('auth/google')
|
@Controller('auth/google')
|
||||||
export class GoogleAuthController {
|
export class GoogleAuthController {
|
||||||
@ -24,10 +25,8 @@ export class GoogleAuthController {
|
|||||||
|
|
||||||
@Get('redirect')
|
@Get('redirect')
|
||||||
@UseGuards(AuthGuard('google'))
|
@UseGuards(AuthGuard('google'))
|
||||||
async googleAuthRedirect(@Req() req: Request, @Res() res: Response) {
|
async googleAuthRedirect(@Req() req: GoogleRequest, @Res() res: Response) {
|
||||||
const user = await this.authService.upsertUser(
|
const user = await this.authService.upsertUser(req.user);
|
||||||
req.user as { firstName: string; lastName: string; email: string },
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
throw new HttpException(
|
throw new HttpException(
|
||||||
|
|||||||
85
server/src/auth/guards/check-workspace-ownership.guard.ts
Normal file
85
server/src/auth/guards/check-workspace-ownership.guard.ts
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
import {
|
||||||
|
CanActivate,
|
||||||
|
ExecutionContext,
|
||||||
|
HttpException,
|
||||||
|
HttpStatus,
|
||||||
|
Injectable,
|
||||||
|
} from '@nestjs/common';
|
||||||
|
import { GqlExecutionContext } from '@nestjs/graphql';
|
||||||
|
import { Request } from 'express';
|
||||||
|
import { PrismaService } from 'src/database/prisma.service';
|
||||||
|
|
||||||
|
type OperationEntity = {
|
||||||
|
operation?: string;
|
||||||
|
entity?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class CheckWorkspaceOwnership implements CanActivate {
|
||||||
|
constructor(private prismaService: PrismaService) {}
|
||||||
|
|
||||||
|
async canActivate(context: ExecutionContext): Promise<boolean> {
|
||||||
|
const gqlContext = GqlExecutionContext.create(context);
|
||||||
|
const request = gqlContext.getContext().req;
|
||||||
|
|
||||||
|
const { operation, entity } = this.fetchOperationAndEntity(request);
|
||||||
|
const variables = request.body.variables;
|
||||||
|
const workspace = await request.workspace;
|
||||||
|
|
||||||
|
if (!entity || !operation) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (operation === 'updateOne') {
|
||||||
|
const object = await this.prismaService[entity].findUniqueOrThrow({
|
||||||
|
where: { id: variables.id },
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!object) {
|
||||||
|
throw new HttpException(
|
||||||
|
{ reason: 'Record not found' },
|
||||||
|
HttpStatus.NOT_FOUND,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (object.workspaceId !== workspace.id) {
|
||||||
|
throw new HttpException(
|
||||||
|
{ reason: 'Record not found' },
|
||||||
|
HttpStatus.NOT_FOUND,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (operation === 'deleteMany') {
|
||||||
|
// TODO: write this logic
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (operation === 'findMany') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (operation === 'createOne') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private fetchOperationAndEntity(request: Request): OperationEntity {
|
||||||
|
if (!request.body.operationName) {
|
||||||
|
return { operation: undefined, entity: undefined };
|
||||||
|
}
|
||||||
|
|
||||||
|
const regex =
|
||||||
|
/(updateOne|deleteMany|createOne|findMany)(Person|Company|User)/i;
|
||||||
|
const match = request.body.query.match(regex);
|
||||||
|
if (match) {
|
||||||
|
return {
|
||||||
|
operation: match[1],
|
||||||
|
entity: match[2].toLowerCase(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return { operation: undefined, entity: undefined };
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,6 +1,8 @@
|
|||||||
import {
|
import {
|
||||||
CanActivate,
|
CanActivate,
|
||||||
ExecutionContext,
|
ExecutionContext,
|
||||||
|
HttpException,
|
||||||
|
HttpStatus,
|
||||||
Injectable,
|
Injectable,
|
||||||
UnauthorizedException,
|
UnauthorizedException,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
@ -8,12 +10,15 @@ import { JwtService } from '@nestjs/jwt';
|
|||||||
import { GqlExecutionContext } from '@nestjs/graphql';
|
import { GqlExecutionContext } from '@nestjs/graphql';
|
||||||
import { Request } from 'express';
|
import { Request } from 'express';
|
||||||
import { ConfigService } from '@nestjs/config';
|
import { ConfigService } from '@nestjs/config';
|
||||||
|
import { PrismaService } from 'src/database/prisma.service';
|
||||||
|
import { JwtPayload } from '../strategies/jwt.auth.strategy';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class JwtAuthGuard implements CanActivate {
|
export class JwtAuthGuard implements CanActivate {
|
||||||
constructor(
|
constructor(
|
||||||
private jwtService: JwtService,
|
private jwtService: JwtService,
|
||||||
private configService: ConfigService,
|
private configService: ConfigService,
|
||||||
|
private prismaService: PrismaService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async canActivate(context: ExecutionContext): Promise<boolean> {
|
async canActivate(context: ExecutionContext): Promise<boolean> {
|
||||||
@ -24,10 +29,34 @@ export class JwtAuthGuard implements CanActivate {
|
|||||||
throw new UnauthorizedException();
|
throw new UnauthorizedException();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const payload = await this.jwtService.verifyAsync(token, {
|
const payload: JwtPayload = await this.jwtService.verifyAsync(token, {
|
||||||
secret: this.configService.get('JWT_SECRET'),
|
secret: this.configService.get('JWT_SECRET'),
|
||||||
});
|
});
|
||||||
request['user'] = payload;
|
|
||||||
|
const user = this.prismaService.user.findUniqueOrThrow({
|
||||||
|
where: { id: payload.userId },
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!user) {
|
||||||
|
throw new HttpException(
|
||||||
|
{ reason: 'User does not exist' },
|
||||||
|
HttpStatus.FORBIDDEN,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const workspace = this.prismaService.workspace.findUniqueOrThrow({
|
||||||
|
where: { id: payload.workspaceId },
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!workspace) {
|
||||||
|
throw new HttpException(
|
||||||
|
{ reason: 'Workspace does not exist' },
|
||||||
|
HttpStatus.FORBIDDEN,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
request.user = user;
|
||||||
|
request.workspace = workspace;
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
throw new UnauthorizedException();
|
throw new UnauthorizedException();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,12 @@ import { RefreshTokenRepository } from 'src/entities/refresh-token/refresh-token
|
|||||||
import { v4 } from 'uuid';
|
import { v4 } from 'uuid';
|
||||||
import { RefreshToken, User } from '@prisma/client';
|
import { RefreshToken, User } from '@prisma/client';
|
||||||
|
|
||||||
|
export type UserPayload = {
|
||||||
|
firstName: string;
|
||||||
|
lastName: string;
|
||||||
|
email: string;
|
||||||
|
};
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AuthService {
|
export class AuthService {
|
||||||
constructor(
|
constructor(
|
||||||
@ -18,11 +24,7 @@ export class AuthService {
|
|||||||
private refreshTokenRepository: RefreshTokenRepository,
|
private refreshTokenRepository: RefreshTokenRepository,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async upsertUser(rawUser: {
|
async upsertUser(rawUser: UserPayload) {
|
||||||
firstName: string;
|
|
||||||
lastName: string;
|
|
||||||
email: string;
|
|
||||||
}) {
|
|
||||||
if (!rawUser.email) {
|
if (!rawUser.email) {
|
||||||
throw new HttpException(
|
throw new HttpException(
|
||||||
{ reason: 'Email is missing' },
|
{ reason: 'Email is missing' },
|
||||||
|
|||||||
@ -3,6 +3,11 @@ import { Strategy, VerifyCallback } from 'passport-google-oauth20';
|
|||||||
|
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { ConfigService } from '@nestjs/config';
|
import { ConfigService } from '@nestjs/config';
|
||||||
|
import { Request } from 'express';
|
||||||
|
|
||||||
|
export type GoogleRequest = Request & {
|
||||||
|
user: { firstName: string; lastName: string; email: string };
|
||||||
|
};
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class GoogleStrategy extends PassportStrategy(Strategy, 'google') {
|
export class GoogleStrategy extends PassportStrategy(Strategy, 'google') {
|
||||||
|
|||||||
@ -24,7 +24,7 @@ export class JwtAuthStrategy extends PassportStrategy(Strategy, 'jwt') {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async validate(payload: JwtPayload) {
|
async validate(payload: JwtPayload): Promise<JwtPayload> {
|
||||||
return { userId: payload.userId, workspaceId: payload.workspaceId };
|
return { userId: payload.userId, workspaceId: payload.workspaceId };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,6 +35,7 @@ model User {
|
|||||||
@@map("users")
|
@@map("users")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @TypeGraphQL.omit(input: true)
|
||||||
model Workspace {
|
model Workspace {
|
||||||
id String @id
|
id String @id
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
@ -57,7 +58,9 @@ model WorkspaceMember {
|
|||||||
deletedAt DateTime?
|
deletedAt DateTime?
|
||||||
userId String @unique
|
userId String @unique
|
||||||
user User @relation(fields: [userId], references: [id])
|
user User @relation(fields: [userId], references: [id])
|
||||||
|
/// @TypeGraphQL.omit(input: true)
|
||||||
workspaceId String
|
workspaceId String
|
||||||
|
/// @TypeGraphQL.omit(input: true)
|
||||||
workspace Workspace @relation(fields: [workspaceId], references: [id])
|
workspace Workspace @relation(fields: [workspaceId], references: [id])
|
||||||
|
|
||||||
@@map("workspace_members")
|
@@map("workspace_members")
|
||||||
@ -105,6 +108,7 @@ model Person {
|
|||||||
@@map("people")
|
@@map("people")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @TypeGraphQL.omit(input: true)
|
||||||
model RefreshToken {
|
model RefreshToken {
|
||||||
id String @id
|
id String @id
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
|
|||||||
@ -147,4 +147,16 @@ export const seedCompanies = async (prisma: PrismaClient) => {
|
|||||||
address: '',
|
address: '',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await prisma.company.upsert({
|
||||||
|
where: { id: 'a674fa6c-1455-4c57-afaf-dd5dc086361e' },
|
||||||
|
update: {},
|
||||||
|
create: {
|
||||||
|
id: 'a674fa6c-1455-4c57-afaf-dd5dc086361e',
|
||||||
|
name: 'Instagram',
|
||||||
|
domainName: 'instagram.com',
|
||||||
|
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea420',
|
||||||
|
address: '',
|
||||||
|
},
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@ -209,4 +209,19 @@ export const seedPeople = async (prisma: PrismaClient) => {
|
|||||||
email: 'louis.duss@google.com',
|
email: 'louis.duss@google.com',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await prisma.person.upsert({
|
||||||
|
where: { id: '240da2ec-2d40-4e49-8df4-9c6a049190dh' },
|
||||||
|
update: {},
|
||||||
|
create: {
|
||||||
|
id: '240da2ec-2d40-4e49-8df4-9c6a049190dh',
|
||||||
|
firstname: 'Lorie',
|
||||||
|
lastname: 'Vladim',
|
||||||
|
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea420',
|
||||||
|
phone: '+33788901235',
|
||||||
|
city: 'Seattle',
|
||||||
|
companyId: 'a674fa6c-1455-4c57-afaf-dd5dc086361e',
|
||||||
|
email: 'lorie.vladim@google.com',
|
||||||
|
},
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user