Skip to content

Commit

Permalink
docs: Add project description
Browse files Browse the repository at this point in the history
  • Loading branch information
GuningShen authored Aug 6, 2024
1 parent 9398cf8 commit 4491778
Showing 1 changed file with 14 additions and 59 deletions.
73 changes: 14 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,50 +7,37 @@ This api give Greenstand the ability to `like` anything, for example: like a tre
This repository was created from Greenstand's template for microservice projects. This means it comes with many development tools that we use for development and deployment. As a contributor to this repository, you should learn and use these tools. They are outlined below.

- NestJS
- Nx
- Yarn
- Prisma
- Conventional Commits
- husky
- prettier / lint
- github actions
- GitHub actions
- Jest
- TypeScript

# Getting Started

## Project Setup



Please join our slack channel to get help with setting up the database.

# Workflow with Github

[check out here](https://github.com/Greenstand/treetracker-web-map-client#workflow-with-github)

# Development Specification

- Every endpoint should have a e2e test to cover the main use cases.

- For edge cases, we can use unit tests to test the edge cases, don't need to use e2e test to cover all cases, e2e just cover main workflow.

- Class name should be capitalized.
[check out the workflow guide](https://github.com/Greenstand/treetracker-web-map-client#workflow-with-github)

- Do not write SQL directly in `router` and `model` files, there is a function called `delegateRepository` can help to simplify some simple cases;
# Project architecture
The TreeTracker Like System is Greenstand's new experiment using a monorepo structure. A monorepo is a single repository containing multiple distinct projects with well-defined relationships.

- Please use `loglevel` to replace `console.log`, and always use appropriate log level to log.
In the Like System, both the backend and frontend implementations are located in the `apps` folder. The backend is built on the NestJS framework. Shared resources for the backend and frontend are placed in the `libs` folder. Shared resources include objects, utilities, constants, etc.

# Architecture of this project
# Database Design
The database design for the backend like project could be find [here](https://github.com/Greenstand/treetracker-like/blob/main/prisma/schema.prisma).
![Treetracker like ER Diagram](https://github.com/user-attachments/assets/48c74d6d-5a15-40a2-bcd4-9725ae3e1107)


# About the documentation/specification

We use OpenAPI 3.0 to document the API.

You can copy the yaml file and import to swagger-ui to see the API.
We are using Prisma to implement our database and the DBMS is Postgres.

# How to test

In Greenstand, we value test driven development.
## Unit test

To run the unit tests:
Expand All @@ -59,46 +46,14 @@ To run the unit tests:
npm run test-unit
```

## End to End test
## Integration test

All the end to end tests are located under folder `__tests__/e2e`, the test will run against the dev database.
All the integration tests are located under folder `__tests__`

To run the integration test:

Run tests:

```
npm run test-e2e
```

**If errors:**

npm run test-integration
```
DATABASE_URL is undefined
or
{ "code": 500,"message": "Unknown error (self signed certificate in certificate chain)" }
```

**Follows those steps:**

1- Go to the .env file, copy the DATABASE_URL with its value.

2- Add it with NODE_TLS_REJECT_UNAUTHORIZED='0' , npm run test-e2e, and run the tests.

For example:

```
DATABASE_URL=[the link provided] NODE_TLS_REJECT_UNAUTHORIZED='0' npm run test-e2e
```

.
.
.
.
.
.
.

0 comments on commit 4491778

Please sign in to comment.