Skip to content

Commit ec3a327

Browse files
added documentation
1 parent 6f7d4fb commit ec3a327

File tree

5 files changed

+23
-6
lines changed

5 files changed

+23
-6
lines changed

docs/how-to-manage-api-products.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ The route used to create a product is named `create_product`. This route expects
2323
The route used to update a product is named `update_product.` This route expects to recieve a product id (integer) in the url, as raw as json, specifying which column needs to be changed. The exact data required and corresponding types allowed can be seen in `/src/schemas.py`, under the class ProductBase.
2424

2525
**Delete ->**
26-
The route used to delete one product is named `get_product.` This route expects to recieve a product id (integer) in the url.
26+
The route used to delete one product is named `delete_product.` This route expects to recieve a product id (integer) in the url.

docs/how-to-manage-api-sales.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ The route used to create a sale is named `create_sale`. This route expects to re
2323
The route used to update a sale is named `update_sale.` This route expects to recieve a sale id (integer) in the url, as raw as json, specifying which column needs to be changed. The exact data required and corresponding types allowed can be seen in `/src/schemas.py`, under the class SaleBase.
2424

2525
**Delete ->**
26-
The route used to delete one sale is named `get_sale.` This route expects to recieve a sale id (integer) in the url.
26+
The route used to delete one sale is named `delete_sale.` This route expects to recieve a sale id (integer) in the url.

docs/how-to-migrate-db.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# How to Migrate DB
22

3-
The database migration tool we are using is `Alembic.`
3+
The database migration tool we are using is `Alembic.` Alembic will help use manage various states of the database, including migrating the database strcuture from an sqlite database to a mysql database. We will go step by step, from beginning a fresh sqlite database, adding the base structure of the database, and finally migrating it over to mysql. All of the commands are to be run in the root folder.
4+
5+
1. To create your first revision (database version): `alembic revision --autogenerate -m "some information about the update"`
6+
7+
2. A new entry will appear in the `/alembic/versions` folder.
8+
9+
3. The entry will have two functions, upgrade and downgrade. If you used the `--autogenerate` flag, Alembic will attempt to fill in these 2 functions. If Alembic can't autogenerate, you will have to write in the changes to your database manually.
10+
11+
4. After the function is filled in with the proper set of changes. You will run the command: `alembic upgrade head` to upgrade your database to the latest revision. If you have issues,`alembic downgrade <revision number>` will set your database back to an older revision.
12+
13+
14+
## Migrating to Mysql
15+
16+
5. After you have a revision created, it is fairly easy to switch over mysql. First, you will have to change what database Alembic is pointing to. This is done is the `alembic/env.py` file, line 14. Line 14 is the uri for sqllite, line 15 (commented out) is for mysql. Simply comment out 14, comment in 15. Now alembic is pointing to your database.
17+
18+
6. Now that Alembic is pointing to your database, migrating your structure over to that database is as simple as running `alembic upgrade head`.
19+
20+
421

522

docs/how-to-secure-api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# How the API is secured
1+
# How the API is Secured
22

33
The application is secured using jwt, or `json web tokens`. Communicating to the api that you are authorized occurs in two ways, differing on whether you're manually making requests or trying to access pages that require authentication.
44

docs/how-to-use-mysql.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# How to create initial DB
1+
# How to Use Mysql DB
22

33
Switching the application over from SQLITE to Mysql is as simple as changing the projects environment variable `DEBUGGING` to 0, which means false. The application will automatically look for a mysql server with the proper authentication. However, it's very important that you already have mysql installed and an empty schema.
44

5-
Furthermore, the Alembic configuration should be changed so that it is pointing to the correct url. The config for alembic is `/alembic/env.py`.
5+
Furthermore, the Alembic configuration should be changed so that it is pointing to the correct url. The config for alembic is `/alembic/env.py`.

0 commit comments

Comments
 (0)