diff --git a/.env-template b/.env-template index 75dcba021..67b1bda30 100644 --- a/.env-template +++ b/.env-template @@ -1,4 +1,4 @@ -# Old and New PIMS +# API API_HTTP_PORT= # For Postgres Container @@ -13,10 +13,11 @@ FRONTEND_URL= BACKEND_URL= # Express Keycloak Settings - SSO_CLIENT_ID= # Keycloak client_id SSO_CLIENT_SECRET= # Keycloak client_secret SSO_AUTH_SERVER_URL= # Keycloak auth URL +DEBUG= # (optional) Set to 'true' to get useful debug statements in api console. +VERBOSE_DEBUG= # (optional) Set to 'true' to get extra details from DEBUG. # CSS Keycloak API CSS_API_CLIENT_ID= # Keycloak CSS API Service Account client_id @@ -48,3 +49,7 @@ LTSA_INTEGRATOR_USERNAME= LTSA_INTEGRATOR_PASSWORD= LTSA_USERNAME= LTSA_PASSWORD= + +# Debug Options +RAW_TYPEORM_DEBUG= # Boolean. Will not print queries to logger +LOG_QUERIES= # Boolean diff --git a/.gitattributes b/.gitattributes index f8aa37e5a..e3e629918 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,19 +3,18 @@ # Declare files that will always have LF line endings on checkout. text eol=lf -*.cs text eol=lf -*.csproj text eol=lf -*.sln text eol=lf *.sql text eol=lf *.tsx text eol=lf *.ts text eol=lf *.js text eol=lf +*.mjs text eol=lf +*.cjs text eol=lf *.jsx text eol=lf *.css text eol=lf *.scss text eol=lf *.sh text eol=lf *.md text eol=lf *.json text eol=lf +*.yaml text eol=lf +*.yml text eol=lf *.conf text eol=lf -**/s2i/bin/* text eol=lf -**/root/**/* text eol=lf diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 416f86c04..000000000 --- a/.prettierignore +++ /dev/null @@ -1,7 +0,0 @@ -package-lock.json -**/vendor -*.html -*.md -*.yaml -node_modules -build diff --git a/.prettierrc.json b/.prettierrc.json deleted file mode 100644 index 6db856271..000000000 --- a/.prettierrc.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "semi": true, - "trailingComma": "all", - "singleQuote": true, - "printWidth": 100, - "tabWidth": 2, - "endOfLine": "lf" -} diff --git a/README.md b/README.md index 7ecf2698a..ceeebff06 100644 --- a/README.md +++ b/README.md @@ -1,65 +1,71 @@ -[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE) -[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/bcgov/pims/issues) -![API (.Net Core)]() -![APP (React)]() +# Property Inventory Management System (PIMS) +[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE) [![img](https://img.shields.io/badge/Lifecycle-Stable-97ca00)](https://github.com/bcgov/repomountie/blob/master/doc/lifecycle-badges.md) -# PIMS +PIMS offers an inventory management system that supports the Strategic Real Estate Services (SRES) branch of the Real Property Division (RPD) in managing and overseeing the disposal of assets surplus to government. It aids staff in optimizing the benefits of managing public real-estate assets for government and BC citizens, and aims to be a trusted source for accurate information on government-owned titled property. -Property Inventory Management System +The system supports the management of titled properties through the government property ownership life cycle from acquisition to disposal (transfer to another ministry or sale outside of the government). This includes the ability to manage internal workflows. PIMS assists with the collection, analysis, and reporting of spatial data and related asset information from multiple data sources. -## Introduction +## Why PIMS? -Strategic Real Estate Services (SRES), comprised of professionals from a variety of backgrounds (sales, marketing, First Nations consultation, environmental management and communications) was formed to dispose of assets surplus to government, in order to help government meet its commitment to balance the provincial budget, and to generate economic activity in communities throughout BC. The SRES team is tasked with coordinating the province-wide management of this initiative ensuring that all issues are addressed appropriately and the return to government is maximized. +Strategic Real Estate Services (SRES), comprised of professionals from a variety of backgrounds (sales, marketing, First Nations consultation, environmental management and communications) was formed to dispose of assets surplus to government in order to help government meet its commitment to balance the provincial budget and to generate economic activity in communities throughout BC. The SRES team is tasked with coordinating the province-wide management of this initiative, ensuring that all issues are addressed appropriately and that the return to government is maximized. SRES is responsible for: - Maintaining a complete inventory of the Province’s real estate assets -- Tracking Ministry organizations compliance with policies related to disposition of real estate assets +- Tracking Ministry organizations' compliance with policies related to disposition of real-estate assets - Marketing property internally for repurposing (transfer to another ministry) - Oversight of sales process from pre-marketing to completion -- First Nations Consultation real estate development and dispositions -- Providing strategic real estate analysis and advice to Ministries and Broader Public Sectors +- First Nations Consultation on real estate development and dispositions +- Providing strategic real estate analysis and advice to ministries and broader public sectors - Reporting to Treasury Board -To support SRES’s overall strategic real estate initiatives a modern Information Management System is required that will aid in strategic decision making, support its client Ministries and the Broader Public Sector, and remain compliant with current Inventory Policies (CPPM Policy Chapter 8: Asset Management). Ideally the system will be flexible to allow for ad hoc customized reporting and adaptable to support unforeseen future real estate strategies. - -## Problem Statement - -The Province is not able to make the most informed, timely, and strategic decisions on the optimal use of its real property assets on behalf of the people and priorities of British Columbia. +To support SRES’s overall strategic real estate initiatives, a modern Inventory Management System was required that would aid in strategic decision making, support its client ministries and the Broader Public Sector, and remain compliant with current Inventory Policies (CPPM Policy Chapter 8: Asset Management). The system must be flexible to allow for ad hoc customized reporting and adaptable to support unforeseen future real-estate strategies. -## Hypothesis +## Documentation -If we have a modern easy to use system built in collaboration with, and for the benefit of, clients they will want to use it to provide Strategic Real Estate Services (SRES) with the data required to support real time executive decision making and to remain compliant with core policy. +All public-facing documentation is found in the [GitHub Wiki](https://github.com/bcgov/PIMS/wiki). Here are some common pages you may want to visit: -## Goal +- [Development](https://github.com/bcgov/PIMS/wiki/Development) +- [Glossary](https://github.com/bcgov/PIMS/wiki/Glossary) +- [PIMS Team](https://github.com/bcgov/PIMS/wiki/PIMS-Development-Team) -The goal of the PIMS project team is to create a Geo-spatial Client Relationship Management System to support the Strategic Real Estate Services branch of Real Property Division to manage and oversee the disposal of assets surplus to government, optimize the benefits to the government and citizens of BC related to the management of public real estate assets, and be a trusted source for accurate information for Government owned titled property. +## Report an Issue -The system will support the management of titled properties through the government property ownership life cycle from acquisition to disposal (transfer to another ministry or sale outside of the government). This would include the ability to manage internal workflows. PIMS will be capable of collection, analysis, and reporting of spatial data and related asset information from multiple data sources. +Having issues with PIMS? See a problem in the GitHub repository? -Ideally reporting and query requirements would allow SRES staff to run technical detailed reports through the GIS and linked database. Simple query, collaboration and reporting should be available to non-technical users such as external stakeholders. - -Objectives include: - -- Increase the total amount of properties in the inventory Map -- Ensure data validation occurs at time of project submission – BC Assessment and/or Land Title Survey Authority -- Increase client satisfaction with system -- Allow for portals for clients to add, edit, and report on properties in the system -- Accurate, customizable, instant financial reporting -- Seamless data migration from clients to PIMS +Report your issue using the [Issues](https://github.com/bcgov/PIMS/issues/new/choose) page. Fill out the form and report your findings to help improve PIMS. ## Development -> We are actively adding new features and enhancements. - -Read the documentation [here](https://github.com/bcgov/PIMS/wiki) +PIMS is primarily in its maintenance phase. Security and stability updates will continue to be addressed, but additional features are not actively being developed. + +If you need to start an instance of PIMS on your local machine, see the [Development](https://github.com/bcgov/PIMS/wiki/Development) page. + +## Directory + +| Item | Description | +| --- | --- | +|`.github`| Files related to GitHub. Includes workflows, templates, etc. | +|`database`| Files related to PostgreSQL. May include documentation aids and database-related scripts. | +|`express-api`| The Express API for PIMS. | +|`react-app`|The React/Vite frontend for PIMS.| +|`tools`| Manually run scripts, security tools, etc.| +|`.codeclimate.yml`| Configuration file for Code Climate checks.| +|`.env-template`| The template file for locally created `.env` files.| +|`.gitignore`|File that defines exclusions for git tracking.| +|`.gitattributes`|Defines end of line requirements for files.| +|`CODE_OF_CONDUCT.md`| A set of standards and guidelines for contributors to PIMS.| +|`COMPLIANCE.yaml`|Recording of PIA and STRA dates.| +|`LICENSE`|The Apache 2.0 license documentation.| +|`README.md`|The README file containing this information.| +|`docker-compose.yml`|A Docker compose file that creates containers for the PIMS application. | ## License -``` -Copyright 2020 Province of British Columbia +```md +Copyright 2024 Province of British Columbia Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/express-api/README.md b/express-api/README.md index bde9e2634..c00c97beb 100644 --- a/express-api/README.md +++ b/express-api/README.md @@ -8,62 +8,66 @@ The backend uses a `.env` located in the project root folder. This `.env` is sha Recommended values used with this API that match with the current API and Docker options are shown below. -| Key | Example | Description | -| --- | --- | --- | -| API_HTTP_PORT | 5000 | API port used during local development. | -| FRONTEND_URL | https://... | The URL of the frontend component. Used with CORS and Keycloak integration. | -|BACKEND_URL| https://... |Used with Keycloak integration.| -|POSTGRES_USER|username|The Postgres user account name. Not the admin account.| -|POSTGRES_PASSWORD|password|The password used with the POSTGRES_USER.| -|POSTGRES_DB|dbname|The name of the database in Postgres.| -|POSTGRES_PORT|5432|The port Postgres is listening on.| -|POSTGRES_SERVICE|postgres|The name of the postgres container if used. Defaults to localhost when the API is not containerized.| -|SSO_CLIENT_ID|abc123|The client ID from the Keycloak integration.| -|SSO_CLIENT_SECRET|def456|The client secret provided from the Keycloak integration.| -|SSO_AUTH_SERVER_URL|https://...|URL to reach Keycloak auth server. Example is for dev URL.| -|SSO_INTEGRATION_ID|1234|See Keycloak integration. Used for CSS API.| -|SSO_ENVIRONMENT|dev|Target environment of Keycloak integration. Used for CSS API.| -|GEOCODER_KEY|abc123|API key for BC Geocoder use.| -|CONTACT_EMAIL||Destination email for frontend error reporting and help.| -|CHES_USERNAME|abc123|Username for CHES service.| -|CHES_PASSWORD|def456|Password for CHES service.| -|CHES_AUTH_URL|https://...|URL where authorization tokens for CHES are obtained.| -|CHES_HOST_URL|https://...|URL where CHES API is reached.| -|CHES_EMAIL_ENABLED|true|Boolean value that enables/disables CHES service calls.| -|CHES_ALWAYS_BCC||Emails that will be included in BCC field of every email. Semicolon separated.| -|CHES_DEFAULT_FROM|Sender Name |Email used as the sender for CHES notifications when not specified in service call.| -|CHES_BCC_USER|true|If true, CHES_ALWAYS_BCC addresses are included in all emails. | -|CHES_OVERRIDE_TO||Email address that overrides any *To* field on CHES requests. Used for non-prod environments.| -|CHES_SECONDS_TO_DELAY|1000|Number of seconds to delay before email is actually sent via CHES.| -|CHES_SEND_TO_LIVE|true|If true, will send emails to live agencies/users. Otherwise, sends emails back to the requesting user. Good for test purposes.| -|LTSA_AUTH_URL|https://...|URL where LTSA tokens are retrieved from.| -|LTSA_HOST_URL|https://...|URL where LTSA API calls are made to.| -|LTSA_INTEGRATOR_USERNAME|username|The username used to obtain tokens from LTSA_AUTH_URL.| -|LTSA_INTEGRATOR_PASSWORD|password|The password used to obtain tokens from LTSA_AUTH_URL.| -|LTSA_USERNAME|username|The username used to make calls to the API at LTSA_HOST_URL.| -|LTSA_PASSWORD|password|The password used to make calls to the API at LTSA_HOST_URL.| +| Key | Example | Description | +| ------------------------ | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | +| API_HTTP_PORT | 5000 | API port used during local development. | +| POSTGRES_USER | username | The Postgres user account name. Not the admin account. | +| POSTGRES_PASSWORD | password | The password used with the POSTGRES_USER. | +| POSTGRES_DB | dbname | The name of the database in Postgres. | +| POSTGRES_PORT | 5432 | The port Postgres is listening on. | +| POSTGRES_SERVICE | postgres | The name of the postgres container if used. Defaults to localhost when the API is not containerized. | +| SSO_CLIENT_ID | abc123 | The client ID from the Keycloak integration. | +| SSO_CLIENT_SECRET | def456 | The client secret provided from the Keycloak integration. | +| SSO_AUTH_SERVER_URL | https://... | URL to reach Keycloak auth server. Example is for dev URL. | +| FRONTEND_URL | https://... | The URL of the frontend component. Used with CORS and Keycloak integration. | +| BACKEND_URL | https://... | Used with Keycloak integration. | +| CSS_API_CLIENT_ID | integration-1234 | See Keycloak integration full name. Used for CSS API. | +| CSS_API_CLIENT_SECRET | mysecret | Secret used with CSS API access. | +| GEOCODER_KEY | abc123 | API key for BC Geocoder use. | +| CONTACT_EMAIL | | Destination email for frontend error reporting and help. | +| CHES_USERNAME | abc123 | Username for CHES service. | +| CHES_PASSWORD | def456 | Password for CHES service. | +| CHES_AUTH_URL | https://... | URL where authorization tokens for CHES are obtained. | +| CHES_HOST_URL | https://... | URL where CHES API is reached. | +| CHES_EMAIL_ENABLED | true | Boolean value that enables/disables CHES service calls. | +| CHES_ALWAYS_BCC | | Emails that will be included in BCC field of every email. Semicolon separated. | +| CHES_DEFAULT_FROM | Sender Name | Email used as the sender for CHES notifications when not specified in service call. | +| CHES_BCC_USER | true | If true, CHES_ALWAYS_BCC addresses are included in all emails. | +| CHES_OVERRIDE_TO | | Email address that overrides any _To_ field on CHES requests. Used for non-prod environments. | +| CHES_SECONDS_TO_DELAY | 1000 | Number of seconds to delay before email is actually sent via CHES. | +| CHES_SECONDS_TO_DELAY | 30 | Seconds to add to all CHES emails. Emails will be sent with their template delay time plus this time. | +| CHES_SEND_TO_LIVE | true | If true, will send emails to live agencies/users. Otherwise, sends emails back to the requesting user. Good for test purposes. | +| LTSA_AUTH_URL | https://... | URL where LTSA tokens are retrieved from. | +| LTSA_HOST_URL | https://... | URL where LTSA API calls are made to. | +| LTSA_INTEGRATOR_USERNAME | username | The username used to obtain tokens from LTSA_AUTH_URL. | +| LTSA_INTEGRATOR_PASSWORD | password | The password used to obtain tokens from LTSA_AUTH_URL. | +| LTSA_USERNAME | username | The username used to make calls to the API at LTSA_HOST_URL. | +| LTSA_PASSWORD | password | The password used to make calls to the API at LTSA_HOST_URL. | +| RAW_TYPEORM_DEBUG | true | Prints database query logs directly to the console instead of through the Winston logger. | +| LOG_QUERIES | true | Pipes database queries through the logger. If not `true`, queries will not be logged or printed. | ## Commands -These commands are specific to the `/express-api` folder. For additional commands involving other components or Docker containers, see the Makefile available in the project root. +These commands are specific to the `/express-api` folder. + +For additional commands involving other components or Docker containers, see the [Development](https://github.com/bcgov/PIMS/wiki/Development) wiki page. The available commands for the backend are shown below. Every command should be prefixed with `npm run`. (e.g. `npm run dev`) -| Command | Description | -| -------------------------- | ------------------------------------------------------------------------ | -| `dev` | Runs app in development mode using nodemon and ts-node. | -| `build` | Builds the app into runnable JavaScript. | -|`lint`|Identifies linting errors from `eslint` and `prettier` packages.| -|`lint:fix`|Fixes found linting errors where possible.| -|`check`|Identifies linting errors from the `prettier` package. Use `lint` instead.| -|`format`|Only fixes errors found by `prettier`. Use `lint:fix` instead.| -|`test`|Runs all test cases and generates coverage reports.| -|`test:unit`|Only runs unit tests.| -|`test:integration`|Only runs integration tests.| -|`swagger`|Re-generates Swagger documentation.| -|`typeorm`|Accesses the TypeORM CLI. Use this with other TypeORM commands.| -|`migration`|Runs the migrations control script. See the wiki for more information.| +| Command | Description | +| ------------------ | -------------------------------------------------------------------------- | +| `dev` | Runs app in development mode using nodemon and ts-node. | +| `build` | Builds the app into runnable JavaScript. | +| `lint` | Identifies linting errors from `eslint` and `prettier` packages. | +| `lint:fix` | Fixes found linting errors where possible. | +| `check` | Identifies linting errors from the `prettier` package. Use `lint` instead. | +| `format` | Only fixes errors found by `prettier`. Use `lint:fix` instead. | +| `test` | Runs all test cases and generates coverage reports. | +| `test:unit` | Only runs unit tests. | +| `test:integration` | Only runs integration tests. | +| `typeorm` | Accesses the TypeORM CLI. Use this with other TypeORM commands. | +| `migration` | Runs the migrations control script. See the wiki for more information. | ## Usage diff --git a/react-app/README.md b/react-app/README.md index 12c5a7947..e99d777f6 100644 --- a/react-app/README.md +++ b/react-app/README.md @@ -2,13 +2,28 @@ This service runs using Node and is built using the Vite development environment and the React framework. +It displays the UI for the PIMS application. + +Additional information on the service can be found on the [React App Wiki page](https://github.com/bcgov/PIMS/wiki/React-App). + ## Commands These commands are specific to the `/react-app` folder. -The available commands for the frontend app are as follows: +The available commands for the frontend are shown below. +Every command should be prefixed with `npm run`. (e.g. `npm run dev`) + +| Command | Description | +| ----------- | ----------------------------------------------------------------------------------------- | +| `dev` | Runs app in development mode. | +| `build` | Builds the app into runnable JavaScript, located in the `/dist` folder. | +| `lint` | Identifies linting errors from `eslint` and `prettier` packages. | +| `lint:fix` | Fixes found linting errors where possible. | +| `check` | Identifies linting errors from the `prettier` package. Use `lint` instead. | +| `format` | Only fixes errors found by `prettier`. Use `lint:fix` instead. | +| `test` | Runs all test cases. | +| `snapshots` | Runs all test cases. Snapshot tests that do not match existing snapshots will be updated. | + +## Usage -| Command | Description | -| -------------------------- | ------------------------------------------------------------------------ | -| `npm run dev` | Runs app in development mode. | -| `npm run build` | Builds the app into runnable JavaScript, located in the `/dist` folder. | +With the application running, either in development mode or in a Docker container, visit the URL where it is being exposed. By default, this is [http://localhost:3000](http://localhost:3000).