Skip to content

Commit e031260

Browse files
committed
Merge branch 'main' into feat/inv-list-actions-pt2
# Conflicts: # src/@seed/api/mapping/mapping.service.ts # src/@seed/api/organization/organization.types.ts # src/@seed/api/user/user.service.ts # src/app/modules/datasets/data-mappings/data-mapping.component.ts # src/app/modules/inventory-list/list/grid/actions.component.ts # src/app/modules/inventory-list/list/inventory.component.ts # src/app/modules/inventory/actions/export-modal.component.ts # src/app/modules/organizations/email-templates/email-templates.component.ts # src/styles/styles.scss
2 parents 32de800 + 8989c9e commit e031260

43 files changed

Lines changed: 2456 additions & 118 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@
5151
"@jsverse/transloco": "^7.5.1",
5252
"ag-grid-angular": "^33.1.1",
5353
"ag-grid-community": "^33.1.1",
54+
"chart.js": "^4.5.0",
55+
"chartjs-plugin-annotation": "^3.1.0",
56+
"chartjs-plugin-zoom": "^2.2.0",
5457
"crypto-es": "^2.1.0",
5558
"cspell": "^8.17.3",
5659
"file-saver": "^2.0.5",

pnpm-lock.yaml

Lines changed: 53 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import type { HttpErrorResponse } from '@angular/common/http'
2+
import { HttpClient } from '@angular/common/http'
3+
import { inject, Injectable } from '@angular/core'
4+
import type { Observable } from 'rxjs'
5+
import { catchError } from 'rxjs'
6+
import { ErrorService } from '@seed/services'
7+
8+
@Injectable({ providedIn: 'root' })
9+
export class CacheService {
10+
private _errorService = inject(ErrorService)
11+
private _httpClient = inject(HttpClient)
12+
13+
getCacheEntry(orgId: number, uniqueId: number): Observable<unknown> {
14+
const url = `/api/v3/cache_entries/${uniqueId}/?organization_id=${orgId}`
15+
return this._httpClient.get<unknown>(url).pipe(
16+
catchError((error: HttpErrorResponse) => {
17+
return this._errorService.handleError(error, 'Error fetching cache entry')
18+
}),
19+
)
20+
}
21+
}

src/@seed/api/cache/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './cache.service'

src/@seed/api/dataset/dataset.types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export type DataMappingRow = {
6767
omit?: boolean; // optional, used for omitting columns
6868
isExtraData?: boolean; // used internally, not part of the API
6969
isNewColumn?: boolean; // used internally, not part of the API
70+
hasDuplicate?: boolean; // used internally, not part of the API
7071
}
7172

7273
export type MappedData = {
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import type { HttpErrorResponse } from '@angular/common/http'
2+
import { HttpClient } from '@angular/common/http'
3+
import { inject, Injectable } from '@angular/core'
4+
import { BehaviorSubject, catchError, map, take, tap } from 'rxjs'
5+
import { ErrorService } from '@seed/services'
6+
import { naturalSort } from '@seed/utils'
7+
import { UserService } from '../user'
8+
import type { FilterGroup, FilterGroupInventoryType, FilterGroupsResponse } from './filter-group.types'
9+
10+
@Injectable({ providedIn: 'root' })
11+
export class FilterGroupService {
12+
private _errorService = inject(ErrorService)
13+
private _filterGroups = new BehaviorSubject<FilterGroup[]>([])
14+
private _httpClient = inject(HttpClient)
15+
private _userService = inject(UserService)
16+
17+
filterGroups$ = this._filterGroups.asObservable()
18+
19+
constructor() {
20+
this._userService.currentOrganizationId$
21+
.pipe(
22+
tap((orgId) => {
23+
this.list(orgId, 'Property')
24+
}),
25+
)
26+
.subscribe()
27+
}
28+
29+
list(orgId: number, inventoryType: FilterGroupInventoryType = 'Property') {
30+
const url = `/api/v3/filter_groups/?organization_id=${orgId}&inventory_type=${inventoryType}`
31+
this._httpClient
32+
.get<FilterGroupsResponse>(url)
33+
.pipe(
34+
take(1),
35+
map(({ data }) => {
36+
const filterGroups = data.toSorted((a, b) => naturalSort(a.name, b.name))
37+
this._filterGroups.next(filterGroups)
38+
return filterGroups
39+
}),
40+
catchError((error: HttpErrorResponse) => {
41+
return this._errorService.handleError(error, 'Error fetching filter groups')
42+
}),
43+
)
44+
.subscribe()
45+
}
46+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
export type FilterGroupInventoryType = 'Property' | 'Tax Lot'
2+
3+
// TODO there are more fields returned that could be added here
4+
export type FilterGroup = {
5+
id: number;
6+
name: string;
7+
organization_id: number;
8+
inventory_type: FilterGroupInventoryType;
9+
}
10+
11+
// TODO this has unhandled pagination
12+
export type FilterGroupsResponse = {
13+
status: string;
14+
data: FilterGroup[];
15+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './filter-group.service'
2+
export * from './filter-group.types'

src/@seed/api/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export * from './analysis'
22
export * from './audit-template'
3+
export * from './cache'
34
export * from './column'
45
export * from './column-mapping-profile'
56
export * from './config'
@@ -8,6 +9,7 @@ export * from './data-quality'
89
export * from './dataset'
910
export * from './derived-column'
1011
export * from './geocode'
12+
export * from './filter-group'
1113
export * from './groups'
1214
export * from './inventory'
1315
export * from './label'
@@ -18,6 +20,7 @@ export * from './notes'
1820
export * from './organization'
1921
export * from './pairing'
2022
export * from './postoffice'
23+
export * from './program'
2124
export * from './progress'
2225
export * from './salesforce'
2326
export * from './scenario'

src/@seed/api/inventory/inventory.service.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -354,19 +354,9 @@ export class InventoryService {
354354
)
355355
}
356356

357-
startInventoryExport(orgId: number): Observable<ProgressResponse> {
357+
startInventoryExport(orgId: number, data: InventoryExportData): Observable<ProgressResponse> {
358358
const url = `/api/v3/tax_lot_properties/start_export/?organization_id=${orgId}`
359-
return this._httpClient.get<ProgressResponse>(url).pipe(
360-
take(1),
361-
catchError((error: HttpErrorResponse) => {
362-
return this._errorService.handleError(error, 'Error starting export')
363-
}),
364-
)
365-
}
366-
367-
exportInventory(orgId: number, type: InventoryType, data: InventoryExportData): Observable<Blob> {
368-
const url = `/api/v3/tax_lot_properties/export/?inventory_type=${type}&organization_id=${orgId}`
369-
return this._httpClient.post(url, data, { responseType: 'blob' }).pipe(
359+
return this._httpClient.post<ProgressResponse>(url, data).pipe(
370360
take(1),
371361
catchError((error: HttpErrorResponse) => {
372362
return this._errorService.handleError(error, 'Error starting export')

0 commit comments

Comments
 (0)