Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { FastifyAdapter } from '@bull-board/fastify';
import { BullModule } from '@nestjs/bullmq';
import { MailModule } from '@shared/adapters/mail';
import { MigrationService } from '@shared/migration';
import { TeamsModule } from './modules/teams';
import { TeamsModule } from './teams';
import { ProjectsModule } from './modules/projects';

@Module({
Expand Down
6 changes: 3 additions & 3 deletions src/modules/projects/commands/find-project.command.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { HttpStatus, Inject, Injectable } from '@nestjs/common';
import { IProjectsRepository } from '../repository';
import { FindTeamMemberCommand } from '@core/modules/teams';
import { FindTeamMemberQuery } from '@core/teams';
import { createHash } from 'crypto';
import type { Project } from '../entities';
import { BaseException } from '@shared/error';
Expand All @@ -10,7 +10,7 @@ export class FindProjectCommand {
constructor(
@Inject('IProjectsRepository')
private readonly projectsRepo: IProjectsRepository,
private readonly findTeamMemberCommand: FindTeamMemberCommand,
private readonly findTeamMemberQ: FindTeamMemberQuery,
) {}

public async execute(projectId: string, userId?: string, shareToken?: string) {
Expand Down Expand Up @@ -45,7 +45,7 @@ export class FindProjectCommand {
);
}

const member = await this.findTeamMemberCommand.execute(project.teamId, userId);
const member = await this.findTeamMemberQ.execute(project.teamId, userId);

if (!member) {
throw new BaseException(
Expand Down
2 changes: 1 addition & 1 deletion src/modules/projects/mappers/projects.mapper.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { RawMemberRow } from '@core/modules/teams/repository';
import type { Project } from '@shared/entities';
import { ROLE_PRIORITY } from '@shared/constants';
import { RawMemberRow } from '@core/teams/domain/repository';

export class ProjectsMapper {
public static toDetailResponse(project: Project, member?: RawMemberRow, token?: string) {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/projects/projects.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { forwardRef, Module } from '@nestjs/common';
import { ProjectsService } from './services';
import { ProjectsController } from './controller';
import { ProjectsRepository } from './repository';
import { TeamsModule } from '../teams';
import { TeamsModule } from '../../teams';
import { FindProjectCommand } from './commands';

const REPOSITORY = {
Expand Down
10 changes: 5 additions & 5 deletions src/modules/projects/services/projects.service.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import { HttpStatus, Inject, Injectable } from '@nestjs/common';
import { IProjectsRepository } from '../repository';
import type { CreateProjectDto, CreateShareTokenDto, UpdateProjectDto } from '../dtos';
import { FindTeamCommand, FindTeamMemberCommand } from '@core/modules/teams';
import { ROLE_PRIORITY } from '@shared/constants';
import { ProjectStatus } from '../entities';
import { ProjectsMapper } from '../mappers';
import { createHash, randomBytes } from 'crypto';
import { BaseException } from '@shared/error';
import { FindTeamMemberQuery, FindTeamQuery } from '@core/teams';

@Injectable()
export class ProjectsService {
constructor(
@Inject('IProjectsRepository')
private readonly projectsRepo: IProjectsRepository,
private readonly findTeamCommand: FindTeamCommand,
private readonly findTeamMemberCommand: FindTeamMemberCommand,
private readonly findTeamQ: FindTeamQuery,
private readonly findTeamMemberQ: FindTeamMemberQuery,
) {}

public create = async (userId: string, slug: string, dto: CreateProjectDto) => {
Expand Down Expand Up @@ -254,7 +254,7 @@ export class ProjectsService {
userId: string,
minRole: keyof typeof ROLE_PRIORITY = 'viewer',
) {
const team = await this.findTeamCommand.execute(slug);
const team = await this.findTeamQ.execute(slug);
if (!team) {
throw new BaseException(
{
Expand All @@ -265,7 +265,7 @@ export class ProjectsService {
);
}

const member = await this.findTeamMemberCommand.execute(team.id, userId);
const member = await this.findTeamMemberQ.execute(team.id, userId);
if (!member) {
throw new BaseException(
{
Expand Down
2 changes: 0 additions & 2 deletions src/modules/teams/commands/index.ts

This file was deleted.

5 changes: 0 additions & 5 deletions src/modules/teams/controller/index.ts

This file was deleted.

Loading
Loading