mirror of
https://github.com/Shadowfita/docmost.git
synced 2025-11-19 03:01:10 +10:00
fix workspace setup
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
import { Injectable, UnauthorizedException } from '@nestjs/common';
|
||||
import { LoginDto } from '../dto/login.dto';
|
||||
import { CreateUserDto } from '../dto/create-user.dto';
|
||||
import { UserService } from '../../user/user.service';
|
||||
import { TokenService } from './token.service';
|
||||
import { TokensDto } from '../dto/tokens.dto';
|
||||
import { SignupService } from './signup.service';
|
||||
@ -12,14 +11,17 @@ import { comparePasswordHash } from '../../../helpers/utils';
|
||||
@Injectable()
|
||||
export class AuthService {
|
||||
constructor(
|
||||
private userService: UserService,
|
||||
private signupService: SignupService,
|
||||
private tokenService: TokenService,
|
||||
private userRepo: UserRepo,
|
||||
) {}
|
||||
|
||||
async login(loginDto: LoginDto, workspaceId: string) {
|
||||
const user = await this.userRepo.findByEmail(loginDto.email, workspaceId);
|
||||
const user = await this.userRepo.findByEmail(
|
||||
loginDto.email,
|
||||
workspaceId,
|
||||
true,
|
||||
);
|
||||
|
||||
if (
|
||||
!user ||
|
||||
|
||||
@ -2,7 +2,6 @@ import { BadRequestException, Injectable } from '@nestjs/common';
|
||||
import { CreateUserDto } from '../dto/create-user.dto';
|
||||
import { WorkspaceService } from '../../workspace/services/workspace.service';
|
||||
import { CreateWorkspaceDto } from '../../workspace/dto/create-workspace.dto';
|
||||
import { SpaceService } from '../../space/services/space.service';
|
||||
import { CreateAdminUserDto } from '../dto/create-admin-user.dto';
|
||||
import { GroupUserService } from '../../group/services/group-user.service';
|
||||
import { UserRepo } from '@docmost/db/repos/user/user.repo';
|
||||
@ -16,7 +15,6 @@ export class SignupService {
|
||||
constructor(
|
||||
private userRepo: UserRepo,
|
||||
private workspaceService: WorkspaceService,
|
||||
private spaceService: SpaceService,
|
||||
private groupUserService: GroupUserService,
|
||||
@InjectKysely() private readonly db: KyselyDB,
|
||||
) {}
|
||||
@ -63,7 +61,11 @@ export class SignupService {
|
||||
);
|
||||
}
|
||||
|
||||
async createWorkspace(user, workspaceName, trx?: KyselyTransaction) {
|
||||
async createWorkspace(
|
||||
user: User,
|
||||
workspaceName: string,
|
||||
trx?: KyselyTransaction,
|
||||
) {
|
||||
return await executeTx(
|
||||
this.db,
|
||||
async (trx) => {
|
||||
|
||||
Reference in New Issue
Block a user