Skip to content

Commit

Permalink
moves roles.enum file from API domain to shared
Browse files Browse the repository at this point in the history
  • Loading branch information
andresgnlez committed Oct 7, 2024
1 parent 55aed51 commit edea0d2
Show file tree
Hide file tree
Showing 10 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion api/src/modules/admin/admin.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { tsRestHandler, TsRestHandler } from '@ts-rest/nest';
import { ControllerResponse } from '@api/types/controller-response.type';
import { adminContract } from '@shared/contracts/admin.contract';
import { AuthenticationService } from '@api/modules/auth/authentication.service';
import { ROLES } from '@api/modules/auth/roles.enum';
import { ROLES } from '@shared/entities/users/roles.enum';

@Controller()
@UseGuards(JwtAuthGuard, RolesGuard)
Expand Down
2 changes: 1 addition & 1 deletion api/src/modules/auth/decorators/roles.decorator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SetMetadata } from '@nestjs/common';
import { ROLES } from '@api/modules/auth/roles.enum';
import { ROLES } from '@shared/entities/users/roles.enum';

export const ROLES_KEY = 'roles';
export const RequiredRoles = (...roles: ROLES[]) =>
Expand Down
2 changes: 1 addition & 1 deletion api/src/modules/auth/guards/roles.guard.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable, CanActivate, ExecutionContext } from '@nestjs/common';
import { Reflector } from '@nestjs/core';
import { ROLES_KEY } from '@api/modules/auth/decorators/roles.decorator';
import { ROLES } from '@api/modules/auth/roles.enum';
import { ROLES } from '@shared/entities/users/roles.enum';

@Injectable()
export class RolesGuard implements CanActivate {
Expand Down
3 changes: 2 additions & 1 deletion api/src/modules/import/import.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import { FileInterceptor } from '@nestjs/platform-express';
import { JwtAuthGuard } from '@api/modules/auth/guards/jwt-auth.guard';
import { RolesGuard } from '@api/modules/auth/guards/roles.guard';
import { RequiredRoles } from '@api/modules/auth/decorators/roles.decorator';
import { ROLES } from '@api/modules/auth/roles.enum';
import { ROLES } from '@shared/entities/users/roles.enum';
import { UploadXlsm } from '@api/modules/import/decorators/xlsm-upload.decorator';
import { ImportService } from '@api/modules/import/import.service';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Multer } from 'multer';

@Controller()
Expand Down
2 changes: 1 addition & 1 deletion api/test/integration/auth/create-user.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { User } from '@shared/entities/users/user.entity';
import { HttpStatus } from '@nestjs/common';
import { MockEmailService } from '../../utils/mocks/mock-email.service';
import { IEmailServiceToken } from '@api/modules/notifications/email/email-service.interface';
import { ROLES } from '@api/modules/auth/roles.enum';
import { ROLES } from '@shared/entities/users/roles.enum';

//create-user.feature

Expand Down
2 changes: 1 addition & 1 deletion api/test/integration/auth/sign-up.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { TestManager } from '../../utils/test-manager';
import { HttpStatus } from '@nestjs/common';
import { TOKEN_TYPE_ENUM } from '@shared/schemas/auth/token-type.schema';
import { authContract } from '@shared/contracts/auth.contract';
import { ROLES } from '@api/modules/auth/roles.enum';
import { ROLES } from '@shared/entities/users/roles.enum';
import { JwtManager } from '@api/modules/auth/services/jwt.manager';
import { User } from '@shared/entities/users/user.entity';

Expand Down
2 changes: 1 addition & 1 deletion api/test/utils/test-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { createUser } from './mocks/entity-mocks';
import { User } from '@shared/entities/users/user.entity';
import { IEmailServiceToken } from '@api/modules/notifications/email/email-service.interface';
import { MockEmailService } from './mocks/mock-email.service';
import { ROLES } from '@api/modules/auth/roles.enum';
import { ROLES } from '@shared/entities/users/roles.enum';

/**
* @description: Abstraction for NestJS testing workflow. For now its a basic implementation to create a test app, but can be extended to encapsulate
Expand Down
1 change: 0 additions & 1 deletion client/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"baseUrl": ".",
"paths": {
"@shared/*": ["../shared/*"],
"@api/*": ["../api/src/*"],
"@/*": [
"./src/*"
]
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion shared/entities/users/user.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
PrimaryGeneratedColumn,
} from "typeorm";
import { Exclude } from "class-transformer";
import { ROLES } from "@api/modules/auth/roles.enum";
import { ROLES } from "@shared/entities/users/roles.enum";

@Entity({ name: "users" })
export class User {
Expand Down

0 comments on commit edea0d2

Please sign in to comment.