-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop', remote-tracking branch 'origin' into dir
- Loading branch information
Showing
26 changed files
with
745 additions
and
313 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export enum CodeficatorCategories { | ||
Region = 'O', // Автономна Республіка Крим, області. | ||
SpecialStatusCity = 'K', // Міста, що мають спеціальний статус. | ||
Level1 = 'OK', // Автономна Республіка Крим, області та міста, що мають спеціальний статус. | ||
District = 'P', // Райони в областях та Автономній Республіці Крим. | ||
TerritorialCommunity = 'H', // Території територіальних громад (назви територіальних громад) в областях, територіальні громади Автономної Республіки Крим. | ||
City = 'M', // Міста. | ||
UrbanSettlement = 'T', // Селища міського типу. | ||
Village = 'C', // Села. | ||
Settlement = 'X', // Селища. | ||
Level4 = 'MTCX', // Міста, селища міського типу, села та селища | ||
CityDistrict = 'B', // Райони в містах. | ||
Level2 = 'PB', // Райони в областях та Автономній Республіці Крим та райони в містах. | ||
SearchableCategories = 'MTCXK', // Міста, що мають спеціальний статус, міста, селища міського типу, села та селища | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { CodeficatorCategories } from '../enum/codeficator-categories'; | ||
|
||
export interface Codeficator { | ||
id: number; | ||
category: CodeficatorCategories; | ||
region: string; | ||
district: string; | ||
territorialCommunity: string; | ||
settlement: string; | ||
cityDistrict: string; | ||
latitude: number; | ||
longitude: number; | ||
fullName: string; | ||
fullAddress?: string; | ||
} | ||
|
||
export interface CodeficatorCityDistrict { | ||
id: number; | ||
parentId: number; | ||
category: string; | ||
name: string; | ||
} |
This file contains 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
20 changes: 20 additions & 0 deletions
20
src/app/shared/services/codeficator/codeficator.service.spec.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { TestBed } from '@angular/core/testing'; | ||
import { HttpClientTestingModule } from '@angular/common/http/testing'; | ||
import { CodeficatorService } from './codeficator.service'; | ||
|
||
describe('CodeficatorService', () => { | ||
let service: CodeficatorService; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [ | ||
HttpClientTestingModule | ||
] | ||
}); | ||
service = TestBed.inject(CodeficatorService); | ||
}); | ||
|
||
it('should be created', () => { | ||
expect(service).toBeTruthy(); | ||
}); | ||
}); |
37 changes: 37 additions & 0 deletions
37
src/app/shared/services/codeficator/codeficator.service.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { HttpClient } from '@angular/common/http'; | ||
import { Observable } from 'rxjs'; | ||
import { Codeficator, CodeficatorCityDistrict } from '../../models/codeficator.model'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class CodeficatorService { | ||
|
||
constructor(private http: HttpClient) { | ||
} | ||
|
||
/** | ||
* This method to get all Codeficators from the database | ||
* @param settlement string | ||
*/ | ||
searchCodeficator(settlement: string): Observable<Codeficator[]> { | ||
return this.http.get<Codeficator[]>(`/api/v1/Codeficator/search?Name=${settlement}`); | ||
} | ||
|
||
/** | ||
* This method to get Codeficator by id | ||
* @param id number | ||
*/ | ||
getCodeficatorById(id: number): Observable<Codeficator> { | ||
return this.http.get<Codeficator>(`/api/v1/Codeficator/${id}/parents`); | ||
} | ||
|
||
/** | ||
* This method to get all Codeficator City Districts from the database | ||
* @param id number | ||
*/ | ||
searchCodeficatorCityDistrict(id: number): Observable<CodeficatorCityDistrict[]> { | ||
return this.http.get<CodeficatorCityDistrict[]>(`/api/v1/Codeficator/children?id=${id}`); | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.