Lucas/t 231 timebox i can create a company at the same time im creating (#140)
This PR is a bit messy: adding graphql schema adding create company creation on company select on People page some frontend refactoring to be continued --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
co-authored by
Charles Bochet
parent
fecf45f3bc
commit
b0044ed1a2
@@ -0,0 +1,74 @@
|
||||
import * as TypeGraphQL from "type-graphql";
|
||||
import * as GraphQLScalars from "graphql-scalars";
|
||||
import { Prisma } from "@prisma/client";
|
||||
import { DecimalJSScalar } from "../scalars";
|
||||
import { Person } from "../models/Person";
|
||||
import { User } from "../models/User";
|
||||
import { Workspace } from "../models/Workspace";
|
||||
import { CompanyCount } from "../resolvers/outputs/CompanyCount";
|
||||
|
||||
@TypeGraphQL.ObjectType("Company", {
|
||||
isAbstract: true
|
||||
})
|
||||
export class Company {
|
||||
@TypeGraphQL.Field(_type => String, {
|
||||
nullable: false
|
||||
})
|
||||
id!: string;
|
||||
|
||||
@TypeGraphQL.Field(_type => Date, {
|
||||
nullable: false
|
||||
})
|
||||
createdAt!: Date;
|
||||
|
||||
@TypeGraphQL.Field(_type => Date, {
|
||||
nullable: false
|
||||
})
|
||||
updatedAt!: Date;
|
||||
|
||||
@TypeGraphQL.Field(_type => Date, {
|
||||
nullable: true
|
||||
})
|
||||
deletedAt?: Date | null;
|
||||
|
||||
@TypeGraphQL.Field(_type => String, {
|
||||
nullable: false
|
||||
})
|
||||
name!: string;
|
||||
|
||||
@TypeGraphQL.Field(_type => String, {
|
||||
nullable: false
|
||||
})
|
||||
domainName!: string;
|
||||
|
||||
@TypeGraphQL.Field(_type => String, {
|
||||
nullable: false
|
||||
})
|
||||
address!: string;
|
||||
|
||||
@TypeGraphQL.Field(_type => TypeGraphQL.Int, {
|
||||
nullable: true
|
||||
})
|
||||
employees?: number | null;
|
||||
|
||||
@TypeGraphQL.Field(_type => String, {
|
||||
nullable: true
|
||||
})
|
||||
accountOwnerId?: string | null;
|
||||
|
||||
accountOwner?: User | null;
|
||||
|
||||
people?: Person[];
|
||||
|
||||
@TypeGraphQL.Field(_type => String, {
|
||||
nullable: false
|
||||
})
|
||||
workspaceId!: string;
|
||||
|
||||
workspace?: Workspace;
|
||||
|
||||
@TypeGraphQL.Field(_type => CompanyCount, {
|
||||
nullable: true
|
||||
})
|
||||
_count?: CompanyCount | null;
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
import * as TypeGraphQL from "type-graphql";
|
||||
import * as GraphQLScalars from "graphql-scalars";
|
||||
import { Prisma } from "@prisma/client";
|
||||
import { DecimalJSScalar } from "../scalars";
|
||||
import { Company } from "../models/Company";
|
||||
import { Workspace } from "../models/Workspace";
|
||||
|
||||
@TypeGraphQL.ObjectType("Person", {
|
||||
isAbstract: true
|
||||
})
|
||||
export class Person {
|
||||
@TypeGraphQL.Field(_type => String, {
|
||||
nullable: false
|
||||
})
|
||||
id!: string;
|
||||
|
||||
@TypeGraphQL.Field(_type => Date, {
|
||||
nullable: false
|
||||
})
|
||||
createdAt!: Date;
|
||||
|
||||
@TypeGraphQL.Field(_type => Date, {
|
||||
nullable: false
|
||||
})
|
||||
updatedAt!: Date;
|
||||
|
||||
@TypeGraphQL.Field(_type => Date, {
|
||||
nullable: true
|
||||
})
|
||||
deletedAt?: Date | null;
|
||||
|
||||
@TypeGraphQL.Field(_type => String, {
|
||||
nullable: false
|
||||
})
|
||||
firstname!: string;
|
||||
|
||||
@TypeGraphQL.Field(_type => String, {
|
||||
nullable: false
|
||||
})
|
||||
lastname!: string;
|
||||
|
||||
@TypeGraphQL.Field(_type => String, {
|
||||
nullable: false
|
||||
})
|
||||
email!: string;
|
||||
|
||||
@TypeGraphQL.Field(_type => String, {
|
||||
nullable: false
|
||||
})
|
||||
phone!: string;
|
||||
|
||||
@TypeGraphQL.Field(_type => String, {
|
||||
nullable: false
|
||||
})
|
||||
city!: string;
|
||||
|
||||
@TypeGraphQL.Field(_type => String, {
|
||||
nullable: true
|
||||
})
|
||||
companyId?: string | null;
|
||||
|
||||
company?: Company | null;
|
||||
|
||||
@TypeGraphQL.Field(_type => String, {
|
||||
nullable: false
|
||||
})
|
||||
workspaceId!: string;
|
||||
|
||||
workspace?: Workspace;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import * as TypeGraphQL from "type-graphql";
|
||||
import * as GraphQLScalars from "graphql-scalars";
|
||||
import { Prisma } from "@prisma/client";
|
||||
import { DecimalJSScalar } from "../scalars";
|
||||
import { User } from "../models/User";
|
||||
|
||||
@TypeGraphQL.ObjectType("RefreshToken", {
|
||||
isAbstract: true
|
||||
})
|
||||
export class RefreshToken {
|
||||
@TypeGraphQL.Field(_type => String, {
|
||||
nullable: false
|
||||
})
|
||||
id!: string;
|
||||
|
||||
@TypeGraphQL.Field(_type => Date, {
|
||||
nullable: false
|
||||
})
|
||||
createdAt!: Date;
|
||||
|
||||
@TypeGraphQL.Field(_type => Date, {
|
||||
nullable: false
|
||||
})
|
||||
updatedAt!: Date;
|
||||
|
||||
@TypeGraphQL.Field(_type => Date, {
|
||||
nullable: true
|
||||
})
|
||||
deletedAt?: Date | null;
|
||||
|
||||
@TypeGraphQL.Field(_type => String, {
|
||||
nullable: false
|
||||
})
|
||||
refreshToken!: string;
|
||||
|
||||
@TypeGraphQL.Field(_type => String, {
|
||||
nullable: false
|
||||
})
|
||||
userId!: string;
|
||||
|
||||
user?: User;
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
import * as TypeGraphQL from "type-graphql";
|
||||
import * as GraphQLScalars from "graphql-scalars";
|
||||
import { Prisma } from "@prisma/client";
|
||||
import { DecimalJSScalar } from "../scalars";
|
||||
import { Company } from "../models/Company";
|
||||
import { RefreshToken } from "../models/RefreshToken";
|
||||
import { WorkspaceMember } from "../models/WorkspaceMember";
|
||||
import { UserCount } from "../resolvers/outputs/UserCount";
|
||||
|
||||
@TypeGraphQL.ObjectType("User", {
|
||||
isAbstract: true
|
||||
})
|
||||
export class User {
|
||||
@TypeGraphQL.Field(_type => String, {
|
||||
nullable: false
|
||||
})
|
||||
id!: string;
|
||||
|
||||
@TypeGraphQL.Field(_type => Date, {
|
||||
nullable: false
|
||||
})
|
||||
createdAt!: Date;
|
||||
|
||||
@TypeGraphQL.Field(_type => Date, {
|
||||
nullable: false
|
||||
})
|
||||
updatedAt!: Date;
|
||||
|
||||
@TypeGraphQL.Field(_type => Date, {
|
||||
nullable: true
|
||||
})
|
||||
deletedAt?: Date | null;
|
||||
|
||||
@TypeGraphQL.Field(_type => Date, {
|
||||
nullable: true
|
||||
})
|
||||
lastSeen?: Date | null;
|
||||
|
||||
@TypeGraphQL.Field(_type => Boolean, {
|
||||
nullable: false
|
||||
})
|
||||
disabled!: boolean;
|
||||
|
||||
@TypeGraphQL.Field(_type => String, {
|
||||
nullable: false
|
||||
})
|
||||
displayName!: string;
|
||||
|
||||
@TypeGraphQL.Field(_type => String, {
|
||||
nullable: false
|
||||
})
|
||||
email!: string;
|
||||
|
||||
@TypeGraphQL.Field(_type => String, {
|
||||
nullable: true
|
||||
})
|
||||
avatarUrl?: string | null;
|
||||
|
||||
@TypeGraphQL.Field(_type => String, {
|
||||
nullable: false
|
||||
})
|
||||
locale!: string;
|
||||
|
||||
@TypeGraphQL.Field(_type => String, {
|
||||
nullable: true
|
||||
})
|
||||
phoneNumber?: string | null;
|
||||
|
||||
@TypeGraphQL.Field(_type => String, {
|
||||
nullable: true
|
||||
})
|
||||
passwordHash?: string | null;
|
||||
|
||||
@TypeGraphQL.Field(_type => Boolean, {
|
||||
nullable: false
|
||||
})
|
||||
emailVerified!: boolean;
|
||||
|
||||
@TypeGraphQL.Field(_type => GraphQLScalars.JSONResolver, {
|
||||
nullable: true
|
||||
})
|
||||
metadata?: Prisma.JsonValue | null;
|
||||
|
||||
WorkspaceMember?: WorkspaceMember | null;
|
||||
|
||||
companies?: Company[];
|
||||
|
||||
RefreshTokens?: RefreshToken[];
|
||||
|
||||
@TypeGraphQL.Field(_type => UserCount, {
|
||||
nullable: true
|
||||
})
|
||||
_count?: UserCount | null;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
import * as TypeGraphQL from "type-graphql";
|
||||
import * as GraphQLScalars from "graphql-scalars";
|
||||
import { Prisma } from "@prisma/client";
|
||||
import { DecimalJSScalar } from "../scalars";
|
||||
import { Company } from "../models/Company";
|
||||
import { Person } from "../models/Person";
|
||||
import { WorkspaceMember } from "../models/WorkspaceMember";
|
||||
import { WorkspaceCount } from "../resolvers/outputs/WorkspaceCount";
|
||||
|
||||
@TypeGraphQL.ObjectType("Workspace", {
|
||||
isAbstract: true
|
||||
})
|
||||
export class Workspace {
|
||||
@TypeGraphQL.Field(_type => String, {
|
||||
nullable: false
|
||||
})
|
||||
id!: string;
|
||||
|
||||
@TypeGraphQL.Field(_type => Date, {
|
||||
nullable: false
|
||||
})
|
||||
createdAt!: Date;
|
||||
|
||||
@TypeGraphQL.Field(_type => Date, {
|
||||
nullable: false
|
||||
})
|
||||
updatedAt!: Date;
|
||||
|
||||
@TypeGraphQL.Field(_type => Date, {
|
||||
nullable: true
|
||||
})
|
||||
deletedAt?: Date | null;
|
||||
|
||||
@TypeGraphQL.Field(_type => String, {
|
||||
nullable: false
|
||||
})
|
||||
domainName!: string;
|
||||
|
||||
@TypeGraphQL.Field(_type => String, {
|
||||
nullable: false
|
||||
})
|
||||
displayName!: string;
|
||||
|
||||
WorkspaceMember?: WorkspaceMember[];
|
||||
|
||||
companies?: Company[];
|
||||
|
||||
people?: Person[];
|
||||
|
||||
@TypeGraphQL.Field(_type => WorkspaceCount, {
|
||||
nullable: true
|
||||
})
|
||||
_count?: WorkspaceCount | null;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
import * as TypeGraphQL from "type-graphql";
|
||||
import * as GraphQLScalars from "graphql-scalars";
|
||||
import { Prisma } from "@prisma/client";
|
||||
import { DecimalJSScalar } from "../scalars";
|
||||
import { User } from "../models/User";
|
||||
import { Workspace } from "../models/Workspace";
|
||||
|
||||
@TypeGraphQL.ObjectType("WorkspaceMember", {
|
||||
isAbstract: true
|
||||
})
|
||||
export class WorkspaceMember {
|
||||
@TypeGraphQL.Field(_type => String, {
|
||||
nullable: false
|
||||
})
|
||||
id!: string;
|
||||
|
||||
@TypeGraphQL.Field(_type => Date, {
|
||||
nullable: false
|
||||
})
|
||||
createdAt!: Date;
|
||||
|
||||
@TypeGraphQL.Field(_type => Date, {
|
||||
nullable: false
|
||||
})
|
||||
updatedAt!: Date;
|
||||
|
||||
@TypeGraphQL.Field(_type => Date, {
|
||||
nullable: true
|
||||
})
|
||||
deletedAt?: Date | null;
|
||||
|
||||
@TypeGraphQL.Field(_type => String, {
|
||||
nullable: false
|
||||
})
|
||||
userId!: string;
|
||||
|
||||
user?: User;
|
||||
|
||||
@TypeGraphQL.Field(_type => String, {
|
||||
nullable: false
|
||||
})
|
||||
workspaceId!: string;
|
||||
|
||||
workspace?: Workspace;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export { Company } from "./Company";
|
||||
export { Person } from "./Person";
|
||||
export { RefreshToken } from "./RefreshToken";
|
||||
export { User } from "./User";
|
||||
export { Workspace } from "./Workspace";
|
||||
export { WorkspaceMember } from "./WorkspaceMember";
|
||||
Reference in New Issue
Block a user