Skip to content

Commit

Permalink
feat(CC-69): add NestjsCreatePsychologistService extends CreatePsycho…
Browse files Browse the repository at this point in the history
…logistService
  • Loading branch information
luana-v-santos committed Oct 6, 2023
1 parent e0af32c commit bd2c300
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import { DatabaseRepositoriesModule } from '../../database/repositories/reposito
import { envSchema } from '../../env/env';
import { EnvModule } from '../../env/env.module';
import { CreatePsychologistController } from './use-case/create-psychologist/create-psychologist.controller';
import { NestjsCreatePsychologistService } from './use-case/create-psychologist/nestjs-create-psychologist.service';

@Module({
imports: [DatabaseRepositoriesModule, EnvModule, AuthModule, ConfigModule.forRoot({
validate: (env) => envSchema.parse(env),
isGlobal: true
})],
controllers: [CreatePsychologistController],
providers: [PostgreSqlPrismaOrmService, CreatePsychologistService],
providers: [PostgreSqlPrismaOrmService, CreatePsychologistService, NestjsCreatePsychologistService],
})
export class ApiModule {}
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
// eslint-disable-next-line @nx/enforce-module-boundaries
import { PostgreSqlPrismaOrmService } from '@clinicControl/core-rest-api/adapters/src/database/infra/prisma/prisma.service';
import { CreatePsychologistDto } from '@clinicControl/core-rest-api/core/src/domains/psychologist/use-cases/create-psychologist/create-psychologist-dto';
// import { CreatePsychologistService } from '@clinicControl/core-rest-api/core/src/domains/psychologist/use-cases/create-psychologist/create-psychologist.service';
import { CreatePsychologistService } from '@clinicControl/core-rest-api/core/src/domains/psychologist/use-cases/create-psychologist/create-psychologist.service';
import { GlobalAppHttpException } from '@clinicControl/core-rest-api/core/src/shared/errors/globalAppHttpException';
import { applicationValidateOrReject } from '@clinicControl/core-rest-api/core/src/shared/validators/validate-or-reject';
import { Body, Controller, Post, UseGuards } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { plainToInstance } from 'class-transformer';
import { ApiKeyGuard } from '../../guards/api-key.guard';
import { NestjsCreatePsychologistService } from './nestjs-create-psychologist.service';

@ApiTags()
@Controller({
Expand All @@ -17,13 +16,14 @@ import { ApiKeyGuard } from '../../guards/api-key.guard';
export class CreatePsychologistController {
constructor(
private prisma: PostgreSqlPrismaOrmService,
private createPsychologistService: CreatePsychologistService
private createPsychologistService: NestjsCreatePsychologistService
) {}
@Post('create')
@UseGuards(ApiKeyGuard)
async execute(
@Body() createPsychologistDto: CreatePsychologistDto
): Promise<null | undefined | void> {

try {
const createPsychologistDtoInstance = plainToInstance(
CreatePsychologistDto,
Expand Down

0 comments on commit bd2c300

Please sign in to comment.