Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: change columns module types for constants #1428

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d220545
refactor: change type for constants on team module
CatiaAntunes96 Apr 14, 2023
53af6a4
fix: fix imports of team constants on tests
CatiaAntunes96 Apr 14, 2023
0690329
refactor: change type for constants on team module
CatiaAntunes96 Apr 14, 2023
0dc8771
Merge branch 'main'
CatiaAntunes96 Apr 19, 2023
3fdb349
feat: remove CODEOWNERS file
CatiaAntunes96 Apr 19, 2023
7ff9a81
Merge branch 'main' into refactor/change-teamUser-module-types-for-co…
CatiaAntunes96 Apr 19, 2023
d65910f
refactor: extract types from interfaces
CatiaAntunes96 Apr 19, 2023
d47a65f
refactor: change TYPES to constants(services)
CatiaAntunes96 Apr 19, 2023
75e061e
refactor: change TYPES to CONSTANTS(useCases)
CatiaAntunes96 Apr 19, 2023
f83c0bc
refactor: change TYPES from CONSTANTS subscribers
CatiaAntunes96 Apr 19, 2023
a64f381
Merge branch 'main'
CatiaAntunes96 Apr 19, 2023
9906b04
refactor: change Document to Entity
CatiaAntunes96 Apr 19, 2023
e9ba35b
refactor: change TYPES for CONSTANTS (boardUser)
CatiaAntunes96 Apr 20, 2023
cadbfa3
Merge branch 'main'
CatiaAntunes96 Apr 20, 2023
0a98951
refactor: change filename to constants
CatiaAntunes96 Apr 20, 2023
b1d4046
refactor: change TYPES for CONSTANTS (cards)
CatiaAntunes96 Apr 20, 2023
c8bab15
Merge branch 'main'
CatiaAntunes96 Apr 20, 2023
e9bc588
refactor: change filename to constants
CatiaAntunes96 Apr 20, 2023
61f8d76
refactor: change TYPES for CONSTANTS (votes)
CatiaAntunes96 Apr 20, 2023
9dbbc7b
Merge branch 'main'
CatiaAntunes96 Apr 24, 2023
cbc33c7
refactor: change TYPES for CONSTANTS (column)
CatiaAntunes96 Apr 24, 2023
944d76c
fix: fix import on test file
CatiaAntunes96 Apr 24, 2023
cebeb5e
fix: remove column.controller.spec.ts file
CatiaAntunes96 Apr 24, 2023
25136d4
Merge branch 'main' into refactor/change-columns-module-types-for-con…
CatiaAntunes96 Apr 24, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { ColumnDeleteCardsDto } from '../dto/colum.deleteCards.dto';
import { UpdateColumnDto } from '../dto/update-column.dto';
import { UpdateColumnApplicationInterface } from '../interfaces/applications/update.comment.application.interface';
import { UpdateColumnServiceInterface } from '../interfaces/services/update.column.service.interface';
import { TYPES } from '../interfaces/types';
import { UPDATE_COLUMN_SERVICE } from 'src/modules/columns/constants';

@Injectable()
export class UpdateColumnApplication implements UpdateColumnApplicationInterface {
constructor(
@Inject(TYPES.services.UpdateColumnService)
@Inject(UPDATE_COLUMN_SERVICE)
private updateColumnService: UpdateColumnServiceInterface
) {}

Expand Down
12 changes: 8 additions & 4 deletions backend/src/modules/columns/columns.providers.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
import {
COLUMN_REPOSITORY,
UPDATE_COLUMN_APPLICATION,
UPDATE_COLUMN_SERVICE
} from 'src/modules/columns/constants';
import { UpdateColumnApplication } from './applications/update.columns.application';
import { TYPES } from './interfaces/types';
import { ColumnRepository } from './repositories/column.repository';
import UpdateColumnService from './services/update.column.service';

export const updateColumnService = {
provide: TYPES.services.UpdateColumnService,
provide: UPDATE_COLUMN_SERVICE,
useClass: UpdateColumnService
};

export const updateColumnApplication = {
provide: TYPES.applications.UpdateColumnApplication,
provide: UPDATE_COLUMN_APPLICATION,
useClass: UpdateColumnApplication
};

export const columnRepository = {
provide: TYPES.repositories.ColumnRepository,
provide: COLUMN_REPOSITORY,
useClass: ColumnRepository
};
8 changes: 8 additions & 0 deletions backend/src/modules/columns/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* SERVICE */
export const UPDATE_COLUMN_SERVICE = 'UpdateColumnService';

/* APPLICATION */
export const UPDATE_COLUMN_APPLICATION = 'UpdateColumnApplication';

/* REPOSITORY */
export const COLUMN_REPOSITORY = 'ColumnRepository';
33 changes: 0 additions & 33 deletions backend/src/modules/columns/controller/columns.controller.spec.ts

This file was deleted.

4 changes: 2 additions & 2 deletions backend/src/modules/columns/controller/columns.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { BadRequestResponse } from 'src/libs/swagger/errors/bad-request.swagger'
import { InternalServerErrorResponse } from 'src/libs/swagger/errors/internal-server-error.swagger';
import { UnauthorizedResponse } from 'src/libs/swagger/errors/unauthorized.swagger';
import BoardDto from 'src/modules/boards/dto/board.dto';
import { TYPES } from '../interfaces/types';
import { BoardRoles } from 'src/libs/enum/board.roles';
import { TeamRoles } from 'src/libs/enum/team.roles';
import { BoardUserGuard } from 'src/libs/guards/boardRoles.guard';
Expand All @@ -28,6 +27,7 @@ import ColumnDto from '../dto/column.dto';
import { UpdateColumnDto } from '../dto/update-column.dto';
import { ColumnDeleteCardsDto } from '../dto/colum.deleteCards.dto';
import { UpdateColumnApplicationInterface } from '../interfaces/applications/update.comment.application.interface';
import { UPDATE_COLUMN_APPLICATION } from 'src/modules/columns/constants';

const BoardUser = (permissions: string[]) => SetMetadata('permissions', permissions);

Expand All @@ -37,7 +37,7 @@ const BoardUser = (permissions: string[]) => SetMetadata('permissions', permissi
@Controller('columns')
export default class ColumnsController {
constructor(
@Inject(TYPES.applications.UpdateColumnApplication)
@Inject(UPDATE_COLUMN_APPLICATION)
private updateColumnApp: UpdateColumnApplicationInterface
) {}

Expand Down
11 changes: 0 additions & 11 deletions backend/src/modules/columns/interfaces/types.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import { BadRequestException, Logger, NotFoundException } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import { BoardFactory } from 'src/libs/test-utils/mocks/factories/board-factory.mock';
import SocketGateway from 'src/modules/socket/gateway/socket.gateway';
import * as Columns from '../interfaces/types';
import { ColumnRepository } from '../repositories/column.repository';
import GetBoardService from 'src/modules/boards/services/get.board.service';
import UpdateColumnService from './update.column.service';
import DeleteVoteService from 'src/modules/votes/services/delete.vote.service';
import { DeleteVoteServiceInterface } from 'src/modules/votes/interfaces/services/delete.vote.service.interface';
import { GET_BOARD_SERVICE } from 'src/modules/boards/constants';
import { DELETE_VOTE_SERVICE } from 'src/modules/votes/constants';
import { COLUMN_REPOSITORY } from 'src/modules/columns/constants';

const fakeBoards = BoardFactory.createMany(2);

Expand All @@ -30,7 +30,7 @@ describe('UpdateColumnService', () => {
providers: [
UpdateColumnService,
{
provide: Columns.TYPES.repositories.ColumnRepository,
provide: COLUMN_REPOSITORY,
useValue: createMock<ColumnRepository>()
},
{
Expand All @@ -50,7 +50,7 @@ describe('UpdateColumnService', () => {

columnService = module.get(UpdateColumnService);
deleteVoteService = module.get(DELETE_VOTE_SERVICE);
repositoryColumn = module.get(Columns.TYPES.repositories.ColumnRepository);
repositoryColumn = module.get(COLUMN_REPOSITORY);
socketService = module.get(SocketGateway);
getBoardServiceImpl = module.get(GET_BOARD_SERVICE);

Expand Down
4 changes: 2 additions & 2 deletions backend/src/modules/columns/services/update.column.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { BadRequestException, Inject, Injectable, NotFoundException } from '@nestjs/common';
import { COLUMN_NOT_FOUND, UPDATE_FAILED } from 'src/libs/exceptions/messages';
import * as Columns from '../interfaces/types';
import { UpdateColumnServiceInterface } from '../interfaces/services/update.column.service.interface';
import { UpdateColumnDto } from '../dto/update-column.dto';
import { ColumnDeleteCardsDto } from 'src/modules/columns/dto/colum.deleteCards.dto';
Expand All @@ -10,11 +9,12 @@ import { GetBoardServiceInterface } from 'src/modules/boards/interfaces/services
import { DeleteVoteServiceInterface } from 'src/modules/votes/interfaces/services/delete.vote.service.interface';
import { GET_BOARD_SERVICE } from 'src/modules/boards/constants';
import { DELETE_VOTE_SERVICE } from 'src/modules/votes/constants';
import { COLUMN_REPOSITORY } from 'src/modules/columns/constants';

@Injectable()
export default class UpdateColumnService implements UpdateColumnServiceInterface {
constructor(
@Inject(Columns.TYPES.repositories.ColumnRepository)
@Inject(COLUMN_REPOSITORY)
private readonly columnRepository: ColumnRepositoryInterface,
private readonly socketService: SocketGateway,
@Inject(GET_BOARD_SERVICE)
Expand Down