backend/src/cities/cities.service.ts   A
last analyzed

Complexity

Total Complexity 2
Complexity/F 1

Size

Lines of Code 22
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 22
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0
wmc 2
mnd 0
bc 0
fnc 2
bpm 0
cpm 1
noi 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A CitiesService.createCity 0 4 1
A CitiesService.findAll 0 3 1
1 9
import { Injectable } from '@nestjs/common';
2 9
import { InjectRepository } from '@nestjs/typeorm';
3 9
import { Repository } from 'typeorm';
4 9
import { City } from './entities/city.entity';
5
6
@Injectable()
7 9
export class CitiesService {
8
  constructor(
9
    @InjectRepository(City)
10 8
    private readonly cityRepository: Repository<City>,
11
  ) {}
12
13
  async findAll(): Promise<City[]> {
14 1
    return await this.cityRepository.find();
15
  }
16
17
  async createCity(data?: Partial<City>): Promise<City> {
18 1
    const city = this.cityRepository.create(data);
19 1
    return await this.cityRepository.save(city);
20
  }
21
}
22