team join with link and member admin
This commit is contained in:
@@ -2,6 +2,7 @@ import { ACCOUNT_ACCESS } from '@prisma/client';
|
||||
import prisma_client from '~~/prisma/prisma.client';
|
||||
import { fullDBUser, FullDBUser } from './service.types';
|
||||
import { UtilService } from './util.service';
|
||||
import generator from 'generate-password-ts';
|
||||
|
||||
const config = useRuntimeConfig();
|
||||
|
||||
@@ -22,6 +23,10 @@ export default class AuthService {
|
||||
|
||||
async createUser( supabase_uid: string, display_name: string, email: string ): Promise<FullDBUser | null> {
|
||||
const trialPlan = await prisma_client.plan.findFirstOrThrow({ where: { name: config.initialPlanName}});
|
||||
const join_password: string = generator.generate({
|
||||
length: 10,
|
||||
numbers: true
|
||||
});
|
||||
return prisma_client.user.create({
|
||||
data:{
|
||||
supabase_uid: supabase_uid,
|
||||
@@ -38,6 +43,7 @@ export default class AuthService {
|
||||
max_notes: trialPlan.max_notes,
|
||||
max_members: trialPlan.max_members,
|
||||
plan_name: trialPlan.name,
|
||||
join_password: join_password,
|
||||
}
|
||||
},
|
||||
access: ACCOUNT_ACCESS.OWNER
|
||||
|
||||
Reference in New Issue
Block a user