mirror of
https://github.com/Shadowfita/docmost.git
synced 2025-11-13 08:12:32 +10:00
move environment module to integrations
This commit is contained in:
@ -2,7 +2,7 @@ import { Module } from '@nestjs/common';
|
||||
import { AppController } from './app.controller';
|
||||
import { AppService } from './app.service';
|
||||
import { CoreModule } from './core/core.module';
|
||||
import { EnvironmentModule } from './environment/environment.module';
|
||||
import { EnvironmentModule } from './integrations/environment/environment.module';
|
||||
import { CollaborationModule } from './collaboration/collaboration.module';
|
||||
import { DatabaseModule } from './database/database.module';
|
||||
import { WsModule } from './ws/ws.module';
|
||||
|
||||
@ -12,7 +12,7 @@ import { LoginDto } from './dto/login.dto';
|
||||
import { AuthService } from './services/auth.service';
|
||||
import { CreateUserDto } from './dto/create-user.dto';
|
||||
import { SetupGuard } from './guards/setup.guard';
|
||||
import { EnvironmentService } from '../../environment/environment.service';
|
||||
import { EnvironmentService } from '../../integrations/environment/environment.service';
|
||||
import { CreateAdminUserDto } from './dto/create-admin-user.dto';
|
||||
|
||||
@Controller('auth')
|
||||
|
||||
@ -2,7 +2,7 @@ import { Module } from '@nestjs/common';
|
||||
import { AuthController } from './auth.controller';
|
||||
import { AuthService } from './services/auth.service';
|
||||
import { JwtModule } from '@nestjs/jwt';
|
||||
import { EnvironmentService } from '../../environment/environment.service';
|
||||
import { EnvironmentService } from '../../integrations/environment/environment.service';
|
||||
import { TokenService } from './services/token.service';
|
||||
import { JwtStrategy } from './strategies/jwt.strategy';
|
||||
import { WorkspaceModule } from '../workspace/workspace.module';
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { JwtService } from '@nestjs/jwt';
|
||||
import { EnvironmentService } from '../../../environment/environment.service';
|
||||
import { EnvironmentService } from '../../../integrations/environment/environment.service';
|
||||
import { User } from '../../user/entities/user.entity';
|
||||
import { TokensDto } from '../dto/tokens.dto';
|
||||
import { JwtPayload, JwtRefreshPayload, JwtType } from '../dto/jwt-payload';
|
||||
|
||||
@ -5,7 +5,7 @@ import {
|
||||
} from '@nestjs/common';
|
||||
import { PassportStrategy } from '@nestjs/passport';
|
||||
import { ExtractJwt, Strategy } from 'passport-jwt';
|
||||
import { EnvironmentService } from '../../../environment/environment.service';
|
||||
import { EnvironmentService } from '../../../integrations/environment/environment.service';
|
||||
import { JwtPayload, JwtType } from '../dto/jwt-payload';
|
||||
import { AuthService } from '../services/auth.service';
|
||||
import { UserRepository } from '../../user/repositories/user.repository';
|
||||
|
||||
@ -10,7 +10,7 @@ import { WorkspaceModule } from './workspace/workspace.module';
|
||||
import { PageModule } from './page/page.module';
|
||||
import { StorageModule } from '../integrations/storage/storage.module';
|
||||
import { AttachmentModule } from './attachment/attachment.module';
|
||||
import { EnvironmentModule } from '../environment/environment.module';
|
||||
import { EnvironmentModule } from '../integrations/environment/environment.module';
|
||||
import { CommentModule } from './comment/comment.module';
|
||||
import { SearchModule } from './search/search.module';
|
||||
import { SpaceModule } from './space/space.module';
|
||||
|
||||
@ -148,6 +148,17 @@ export class SpaceService {
|
||||
.skip(paginationOptions.skip)
|
||||
.getManyAndCount();
|
||||
|
||||
|
||||
const getUserSpacesViaGroup = this.spaceRepository
|
||||
.createQueryBuilder('space')
|
||||
.leftJoin('space.spaceGroups', 'spaceGroup')
|
||||
.leftJoin('spaceGroup.group', 'group')
|
||||
.leftJoin('group.groupUsers', 'groupUser')
|
||||
.where('groupUser.userId = :userId', { userId })
|
||||
.andWhere('space.workspaceId = :workspaceId', { workspaceId }).getManyAndCount();
|
||||
|
||||
console.log(await getUserSpacesViaGroup);
|
||||
|
||||
const spaces = userSpaces.map((userSpace) => userSpace.space);
|
||||
|
||||
const paginationMeta = new PaginationMetaDto({ count, paginationOptions });
|
||||
|
||||
@ -30,12 +30,6 @@ export class UserController {
|
||||
return user;
|
||||
}
|
||||
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@Post('info')
|
||||
async getUserInfo(@AuthUser() user: User) {
|
||||
return await this.userService.getUserInstance(user.id);
|
||||
}
|
||||
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@Post('update')
|
||||
async updateUser(
|
||||
|
||||
@ -15,21 +15,6 @@ export class UserService {
|
||||
return this.userRepository.findById(userId);
|
||||
}
|
||||
|
||||
async getUserInstance(userId: string): Promise<any> {
|
||||
const user: User = await this.userRepository.findOne({
|
||||
relations: ['workspace'],
|
||||
where: {
|
||||
id: userId,
|
||||
},
|
||||
});
|
||||
|
||||
if (!user) {
|
||||
throw new NotFoundException('User not found');
|
||||
}
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
async update(userId: string, updateUserDto: UpdateUserDto) {
|
||||
const user = await this.userRepository.findById(userId);
|
||||
if (!user) {
|
||||
|
||||
@ -16,7 +16,7 @@ import { CreateSpaceDto } from '../../space/dto/create-space.dto';
|
||||
import { UserRepository } from '../../user/repositories/user.repository';
|
||||
import { SpaceRole, UserRole } from '../../../helpers/types/permission';
|
||||
import { User } from '../../user/entities/user.entity';
|
||||
import { EnvironmentService } from '../../../environment/environment.service';
|
||||
import { EnvironmentService } from '../../../integrations/environment/environment.service';
|
||||
import { GroupService } from '../../group/services/group.service';
|
||||
import { GroupUserService } from '../../group/services/group-user.service';
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ import {
|
||||
STORAGE_CONFIG_TOKEN,
|
||||
STORAGE_DRIVER_TOKEN,
|
||||
} from '../constants/storage.constants';
|
||||
import { EnvironmentService } from '../../../environment/environment.service';
|
||||
import { EnvironmentService } from '../../environment/environment.service';
|
||||
import {
|
||||
LocalStorageConfig,
|
||||
S3StorageConfig,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { Injectable, NestMiddleware, NotFoundException } from '@nestjs/common';
|
||||
import { FastifyRequest, FastifyReply } from 'fastify';
|
||||
import { WorkspaceRepository } from '../core/workspace/repositories/workspace.repository';
|
||||
import { EnvironmentService } from '../environment/environment.service';
|
||||
import { EnvironmentService } from '../integrations/environment/environment.service';
|
||||
|
||||
@Injectable()
|
||||
export class DomainMiddleware implements NestMiddleware {
|
||||
|
||||
Reference in New Issue
Block a user