Skip to content
Open
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: 2 additions & 0 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { ProfileModule } from './components/profile/profile.module';
import { MailerModule } from '@nest-modules/mailer';
import config from './config';
import { HandlebarsAdapter } from '@nest-modules/mailer';
import { QuestionTypeModule } from './components/question-type/question-type.module';
@Module({
imports: [
AdminModule,
Expand All @@ -27,6 +28,7 @@ import { HandlebarsAdapter } from '@nest-modules/mailer';
MulterModule.register({
dest: './files/upload',
}),
QuestionTypeModule,
],
})
export class AppModule {}
18 changes: 18 additions & 0 deletions src/components/question-type/question-type.controller.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Test, TestingModule } from '@nestjs/testing';
import { QuestionTypeController } from './question-type.controller';

describe('QuestionTypeController', () => {
let controller: QuestionTypeController;

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [QuestionTypeController],
}).compile();

controller = module.get<QuestionTypeController>(QuestionTypeController);
});

it('should be defined', () => {
expect(controller).toBeDefined();
});
});
16 changes: 16 additions & 0 deletions src/components/question-type/question-type.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Controller, Post } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { QuestionTypeService } from './question-type.service';

@ApiTags('question-type')
@Controller('api/question-type')
export class QuestionTypeController {
constructor(
private readonly questionTypeService: QuestionTypeService
) {};

@Post()
async create() {
return 1;
}
}
12 changes: 12 additions & 0 deletions src/components/question-type/question-type.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Module } from '@nestjs/common';
import { QuestionTypeController } from './question-type.controller';
import { QuestionTypeService } from './question-type.service';
import { TypeOrmModule } from '@nestjs/typeorm';
import { QuestionType } from 'src/entities';

@Module({
imports: [TypeOrmModule.forFeature([QuestionType])],
controllers: [QuestionTypeController],
providers: [QuestionTypeService]
})
export class QuestionTypeModule {}
18 changes: 18 additions & 0 deletions src/components/question-type/question-type.service.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Test, TestingModule } from '@nestjs/testing';
import { QuestionTypeService } from './question-type.service';

describe('QuestionTypeService', () => {
let service: QuestionTypeService;

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [QuestionTypeService],
}).compile();

service = module.get<QuestionTypeService>(QuestionTypeService);
});

it('should be defined', () => {
expect(service).toBeDefined();
});
});
4 changes: 4 additions & 0 deletions src/components/question-type/question-type.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Injectable } from '@nestjs/common';

@Injectable()
export class QuestionTypeService {}
1 change: 0 additions & 1 deletion src/components/users/users.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ export class UsersController {
return this.userService.updatePassword(Number(id), body.password, authUser);
}

@ApiBearerAuth()
@Post()
create(@Body() body: CreateNewUser) {
return this.userService.create(body);
Expand Down
3 changes: 2 additions & 1 deletion src/entities/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './user.entity';
export * from './profile.entity';
export * from './profile.entity';
export * from './question-type';
14 changes: 14 additions & 0 deletions src/entities/question-type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Entity, PrimaryGeneratedColumn } from "typeorm";
import { ColumnDate, ColumnPhone, ColumnString, ColumnText, ColumnTinyInt } from "./columns";

@Entity('question-type')
export class QuestionType {
@PrimaryGeneratedColumn()
id: number;

@ColumnString()
name: string;

@ColumnText()
description: string;
}