To get the server running locally:
git clone <REPO>
npm install
- Install PostgreSQL
- If you're on Mac:
createdb propman
this creates the development databasecreatedb propman-test
this creates the test database
- If you're on Windows:
-
a. Open pgadmin b. Create database named
propman
-
Run
npm run res
(which runsnpx knex migrate:latest
andnpx knex seed:run
)
npm start
to start the local servernpm start:dev
to start local server in development environment with nodemonnpm test
to run test suite oncenpm run test:watch
to run test suite in watch modenpm run migrate:latest
a convenient wrapper around knexnpm run seed:run
a convenient wrapper around knexnpm run migrate:test
runs migrations against the test database
🚫 READMEoriginal.md has the original README to reference.
🚫 Sections have been commented out that need to be updated.
🚫 Why did you choose this framework?
Method | Endpoint | Access Control | Description |
---|---|---|---|
POST | /api/auth/register |
all users | Registers a new landlord |
POST | /api/auth/login |
landlords, tenants | Logs in an existing user. Tenants require invitation from landlord. |
Method | Endpoint | Access Control | Description |
---|---|---|---|
GET | /api/tenant/bylandlord/:id |
landlord | Returns all tenants tied to the landlord |
GET | /api/tenant/byunit/:id |
landlords | Returns all tenants tied to specified unit |
Method | Endpoint | Access Control | Description |
---|---|---|---|
POST | /api/properties/ |
landlords | Adds a property to the database |
GET | /api/properties/:id |
landlords, tenants | Returns a specific property |
GET | /api/properties/ |
Returns all properties. | |
PUT | /api/properties/:id |
landlords | Modify an existing property. |
Method | Endpoint | Access Control | Description |
---|---|---|---|
POST | /api/workorders/ |
landlords, tenants | Adds a work order to the database |
GET | /api/workorders/:id |
landlords, tenants | Returns a specific work order |
PUT | /api/workorders/:id |
landlords, tenants | Updates an existing work order |
Method | Endpoint | Access Control | Description |
---|---|---|---|
POST | /api/media/ |
landlords, tenants | Adds media info to database |
GET | /api/media/:id |
landlords, tenants | Returns a specified media's info |
PUT | /api/media/:id |
landlords, tenants | Updates specified media |
DELETE | /api/media/:id |
landlords, tenants | Deletes specified media info |
Method | Endpoint | Access Control | Description |
---|---|---|---|
POST | /api/message/ |
landlords, tenants | Adds a message to the database |
GET | /api/message/:id |
landlords, tenants | Gets a specific message |
GET | /api/message/conversation/:id |
landlords, tenants | Gets all message associated with the specified conversation |
Method | Endpoint | Access Control | Description |
---|---|---|---|
POST | /api/payments/ |
landlords, tenants | Adds payment info to database |
GET | /api/payments/:id |
landlords, tenants | Gets the specified payments info |
{
id: STRING,
landlord: BOOLEAN,
landlord_id: STRING
}
{
id: UUID,
name: STRING,
street_address: STRING,
city: STRING,
state: STRING,
zip: STRING,
occupied: INTEGER,
rent: INTEGER
}
{
unit_id: FOREIGN KEY REFERENCES id IN unit TABLE,
user_id: FOREIGN KEY REFERENCES id IN user TABLE,
lease_start: DATE,
lease_end: DATE
}
{
id: UUID,
name: STRING,
description: STRING,
type: STRING,
status: STRING,
comment: STRING,
start_date: TIMESTAMP,
update_date: TIMESTAMP,
unit_id: FOREIGN KEY REFERENCES id IN unit TABLE,
user_id: FOREIGN KEY REFERENCES id IN user TABLE,
in_house: BOOLEAN
}
{
id: UUID,
link: STRING,
title: STRING,
timestamp: TIMESTAMP,
work_order_id: FOREIGN KEY REFERENCES id IN work_order TABLE,
unit_id: FOREIGN KEY REFERENCES id IN unit TABLE,
user_id: FOREIGN KEY REFERENCES id IN user TABLE,
}
{
id: UUID,
unit_id: FOREIGN KEY REFERENCES id IN unit TABLE,
user_id: FOREIGN KEY REFERENCES id IN user TABLE,
type: STRING,
amount: INTEGER,
payment_date: DATE,
late: BOOLEAN,
due_date: INTEGER
}
{
id: UUID,
conversation_id: INTEGER,
message: STRING
}
{
user_id: FOREIGN KEY REFERENCES id IN user TABLE,
message_id: FOREIGN KEY REFERENCES id IN message TABLE
}
🚫 This is an example, replace this with the actions that pertain to your backend
In order for the app to function correctly, the user must set up their own environment variables.
create a .env file that includes the following:
PORT=4000 // Port number for express server to run on
NODE_ENV // set to "development" until ready for "production"
DB_HOST=localhost // Location of the database
DB_PORT=5432 // Port the database is running on
DB_USER=postgres // THIS IS YOUR LOCAL DB USER NAME (probably postgres)
DB_PASSWORD=pass // THIS IS YOUR LOCAL DATABASE/PSQL PASSWORD
DB_NAME=propman // THIS IS YOUR LOCAL DATABASE NAME
TEST_DB_HOST=localhost
TEST_DB_PORT=5432
TEST_DB_USER=postgres
TEST_DB_PASSWORD=postgres
TEST_DB_NAME=propman-test
GOOGLE_APPLICATION_CREDENTIALS=./firebase/admin.json
FIREBASE_URL=example-url
FIREBASE_API_KEY=examplekey
FIREBASE_AUTH_DOMAIN=exampleapp.firebaseapp.com
FIREBASE_DATABASE_URL=exampledb.firebaseio.com
FIREBASE_PROJECT_ID=example-project
FIREBASE_STORAGE_BUCKET=exmaple.appspot.com
FIREBASE_MESSAGING_SENDER_ID=1234
FIREBASE_APP_ID=1234
FIREABASE_MEASUREMENT_ID=example-g-id
JWT_SECRET="Your Secret." // you can generate this by using a python shell or add in a temporary secret.
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
Please note we have a code of conduct. Please follow it in all your interactions with the project.
This codebase uses Eslint and Prettier to enforce styling. When you go to commit code, Husky will lint and format your code, failing to commit if there is something that cannot be automatically fixed.
If you are having an issue with the existing project code, please submit a bug report under the following guidelines:
- Check first to see if your issue has already been reported.
- Check to see if the issue has recently been fixed by attempting to reproduce the issue using the latest master branch in the repository.
- Create a live example of the problem.
- Submit a detailed bug report including your environment & browser, steps to reproduce the issue, actual and expected outcomes, where you believe the issue is originating from, and any potential solutions you have considered.
We would love to hear from you about new features which would improve this app and further the aims of our project. Please provide as much detail and information as possible to show us why you think your new feature should be implemented.
If you have developed a patch, bug fix, or new feature that would improve this app, please submit a pull request. It is best to communicate your ideas with the developers first before investing a great deal of time into a pull request to ensure that it will mesh smoothly with the project.
Remember that this project is licensed under the MIT license, and by submitting a pull request, you agree that your work will be, too.
- Ensure any install or build dependencies are removed before the end of the layer when doing a build.
- Update the README.md with details of changes to the interface, including new plist variables, exposed ports, useful file locations and container parameters.
- Ensure that your code conforms to our existing code conventions and test coverage.
- Include the relevant issue number, if applicable.
- You may merge the Pull Request in once you have the sign-off of two other developers, or if you do not have permission to do that, you may request the second reviewer to merge it for you.
These contribution guidelines have been adapted from this good-Contributing.md-template.
See Frontend Documentation for details on the fronend of our project.