Skip to content

Commit

Permalink
update filtering on property table
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarkowsky committed Sep 6, 2024
1 parent 4d5bbca commit a99ba4c
Show file tree
Hide file tree
Showing 6 changed files with 250 additions and 274 deletions.
1 change: 1 addition & 0 deletions express-api/src/controllers/properties/propertiesSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const PropertyUnionFilterSchema = z.object({
administrativeArea: z.string().optional(),
landArea: z.string().optional(),
updatedOn: z.string().optional(),
projectStatus: z.string().optional(),
quickFilter: z.string().optional(),
sortKey: z.string().optional(),
sortOrder: z.string().optional(),
Expand Down
2 changes: 2 additions & 0 deletions express-api/src/services/properties/propertiesServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,8 @@ const collectFindOptions = (filter: PropertyUnionFilter) => {
);
if (filter.propertyType)
options.push(constructFindOptionFromQuerySingleSelect('PropertyType', filter.propertyType));
if (filter.projectStatus)
options.push(constructFindOptionFromQuerySingleSelect('ProjectStatus', filter.projectStatus));
return options;
};

Expand Down
9 changes: 7 additions & 2 deletions express-api/src/typeorm/Entities/views/PropertyUnionView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,13 @@ SELECT
property.*,
agc."name" AS agency_name,
aa."name" AS administrative_area_name,
pc."name" AS property_classification_name
pc."name" AS property_classification_name,
ps."name" AS project_status_name
FROM property
LEFT JOIN agency agc ON property.agency_id = agc.id
LEFT JOIN administrative_area aa ON property.administrative_area_id = aa.id
LEFT JOIN property_classification pc ON property.classification_id = pc.id;`,
LEFT JOIN property_classification pc ON property.classification_id = pc.id
LEFT JOIN project_status ps ON property.project_status_id = ps.id;`,
})
export class PropertyUnion {
@ViewColumn({ name: 'id' })
Expand Down Expand Up @@ -131,4 +133,7 @@ export class PropertyUnion {

@ViewColumn({ name: 'project_status_id' })
ProjectStatusId: number;

@ViewColumn({ name: 'project_status_name' })
ProjectStatus: string;
}

This file was deleted.

Loading

0 comments on commit a99ba4c

Please sign in to comment.