Add possibility to invite members to workspace (#579)

* Add possibility to invite members to workspace

* Update endpoints

* Wrap up front end

* Fix according to review

* Fix lint
This commit is contained in:
Charles Bochet
2023-07-10 23:33:15 -07:00
committed by GitHub
parent e1161e96a9
commit 55576cb638
75 changed files with 629 additions and 63 deletions

View File

@ -46,6 +46,7 @@ export class UserService {
// Customs
async createUser<T extends Prisma.UserCreateArgs>(
args: Prisma.SelectSubset<T, Prisma.UserCreateArgs>,
workspaceId?: string,
): Promise<Prisma.UserGetPayload<T>> {
assert(args.data.email, 'email is missing', BadRequestException);
@ -55,14 +56,23 @@ export class UserService {
},
create: {
...(args.data as Prisma.UserCreateInput),
// Assign the user to a new workspace by default
workspaceMember: {
create: {
workspace: {
create: {},
workspaceMember: workspaceId
? {
create: {
workspace: {
connect: { id: workspaceId },
},
},
}
: // Assign the user to a new workspace by default
{
create: {
workspace: {
create: {},
},
},
},
},
},
locale: 'en',
},
update: {},