This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Test, TestingModule } from '@nestjs/testing'; | |
| import { TypeOrmModule } from '@nestjs/typeorm'; | |
| import { Connection } from 'typeorm'; | |
| import { TaskSeedService } from '../../infrastructure/database/seeds/task-seed-service'; | |
| import { TaskService } from './task.service'; | |
| import { Task } from '../../infrastructure/database/entities/task.entity'; | |
| import { DatabaseModule } from '@/infrastructure/database/database.module'; | |
| describe('TaskService', () => { | |
| let service: TaskService; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Test, TestingModule } from '@nestjs/testing'; | |
| import { HttpStatus, INestApplication } from '@nestjs/common'; | |
| import * as request from 'supertest'; | |
| import { Connection } from 'typeorm'; | |
| import { ModulesModule } from '@/modules/modules.module'; | |
| import { TaskSeedService } from '@/infrastructure/database/seeds/task-seed-service'; | |
| describe('TaskController (e2e)', () => { | |
| let app: INestApplication; | |
| let taskSeedService: TaskSeedService; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Test, TestingModule } from '@nestjs/testing'; | |
| import { TaskController } from './task.controller'; | |
| import { TaskService } from './task.service'; | |
| import { ModulesModule } from '../modules.module'; | |
| import { DatabaseModule } from '@/infrastructure/database/database.module'; | |
| describe('TaskController', () => { | |
| let controller: TaskController; | |
| beforeEach(async () => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Module } from '@nestjs/common'; | |
| import { DatabaseModule } from '@/infrastructure/database/database.module'; | |
| import { TaskController } from '@/modules/task/task.controller'; | |
| import { TaskService } from '@/modules/task/task.service'; | |
| @Module({ | |
| imports: [DatabaseModule.forRoot()], | |
| controllers: [TaskController], | |
| providers: [TaskService], | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Injectable } from '@nestjs/common'; | |
| import { TaskRepository } from '@/infrastructure/database/repositories/task.repository'; | |
| @Injectable() | |
| export class TaskService { | |
| constructor(private readonly taskRepository: TaskRepository) {} | |
| async execute(done: number) { | |
| const data = await this.taskRepository.findByState(done); | |
| if (data.length) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Controller, Get, Query, Req, Res, HttpStatus } from '@nestjs/common'; | |
| import type { Request, Response } from 'express'; | |
| import { TaskService } from '@/modules/task/task.service'; | |
| @Controller('tasks') | |
| export class TaskController { | |
| constructor(private readonly taskService: TaskService) {} | |
| @Get() | |
| async searchTaskByState( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Test, TestingModule } from '@nestjs/testing'; | |
| import { TypeOrmModule } from '@nestjs/typeorm'; | |
| import { Connection } from 'typeorm'; | |
| import { TaskSeedService } from '../../infrastructure/database/seeds/task-seed-service'; | |
| import { TaskService } from './task.service'; | |
| import { Task } from '../../infrastructure/database/entities/task.entity'; | |
| import { DatabaseModule } from '../../infrastructure/database/database.module'; | |
| describe('TaskService', () => { | |
| let service: TaskService; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Module } from '@nestjs/common'; | |
| import { TypeOrmModule, TypeOrmModuleOptions } from '@nestjs/typeorm'; | |
| import { ConfigModule, ConfigService } from '@nestjs/config'; | |
| import { mysqlDatabaseConfig } from '@/main/config/database/mysql-database.config'; | |
| import { TaskRepository } from '@/infrastructure/database/repositories/task.repository'; | |
| import { TaskSeedService } from '@/infrastructure/database/seeds/task-seed-service'; | |
| import { Task } from '@/infrastructure/database/entities/task.entity'; | |
| @Module({ | |
| imports: [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Module } from '@nestjs/common'; | |
| import { TypeOrmModule, TypeOrmModuleOptions } from '@nestjs/typeorm'; | |
| import { ConfigModule, ConfigService } from '@nestjs/config'; | |
| import { inMemoryDatabaseConfig } from '@/main/config/database/in-memory-database.config'; | |
| import { TaskRepository } from '@/infrastructure/database/repositories/task.repository'; | |
| import { TaskSeedService } from '@/infrastructure/database/seeds/task-seed-service'; | |
| import { Task } from '@/infrastructure/database/entities/task.entity'; | |
| @Module({ | |
| imports: [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Injectable } from '@nestjs/common'; | |
| import { InjectRepository } from '@nestjs/typeorm'; | |
| import { Repository } from 'typeorm'; | |
| import { Task } from '../entities/task.entity'; | |
| @Injectable() | |
| export class TaskRepository { | |
| constructor( | |
| @InjectRepository(Task) | |
| private repository: Repository<Task>, |
NewerOlder