Skip to content

Commit 022398c

Browse files
authored
Merge pull request #132 from tcet-opensource/development
[minor] schema refactoring and APIDOC setup
2 parents d23d09f + d0a4462 commit 022398c

34 files changed

+2679
-722
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
apidoc
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
name: Bug Report
3+
about: Use this template for reporting bugs.
4+
title: "[Bug]: [DATE]"
5+
labels: bug, needs triage
6+
assignees: [your GitHub username]
7+
8+
---
9+
10+
11+
12+
<!--
13+
🐞 Welcome to the Bug Report! 🐛
14+
15+
Please provide detailed information to help us identify and reproduce the issue you encountered.
16+
17+
Before you proceed, make sure to search existing issues to avoid duplicates.
18+
19+
Fill in the sections below. You can remove any sections that are not applicable to your bug report.
20+
21+
Please use the following format for the title: [Bug] Brief description of the issue
22+
23+
-->
24+
25+
## Description 📝
26+
27+
[Write a brief description of the issue here]
28+
29+
## Steps to Reproduce 🔄
30+
31+
[Outline the steps to reproduce the issue]
32+
33+
1. [Step 1]
34+
2. [Step 2]
35+
3. [Step 3]
36+
...
37+
38+
## Expected Behavior ✨
39+
40+
[Describe what you expected to happen]
41+
42+
## Actual Behavior ❌
43+
44+
[Describe what actually happened]
45+
46+
## Screenshots 📷
47+
48+
[If applicable, add screenshots to help explain the issue]
49+
50+
## Environment 🌍
51+
52+
- Operating System: [e.g., Windows 10, macOS Big Sur]
53+
- Browser/Device: [e.g., Chrome, iPhone 12]
54+
- Version/Build: [e.g., 1.0.0, 2021-09-30]
55+
56+
## Additional Information ℹ️
57+
58+
[Add any additional information about the issue here]
59+
60+
<!--
61+
🚨 Thank you for reporting the bug!
62+
Your input helps us improve our application.
63+
We will investigate the issue and provide updates as soon as possible.
64+
-->
65+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
3+
name: Feature Request
4+
about: Use this template for submitting new feature requests.
5+
title: "[FEATURE NAME]: [DATE]"
6+
labels: feature request, needs review
7+
assignees: [your GitHub username]
8+
9+
---
10+
11+
# Feature Request
12+
13+
🎉 Thank you for taking the time to submit a feature request! 🎉
14+
15+
To help us better understand and prioritize your request, please provide the following information:
16+
17+
## Description
18+
19+
❓ Please provide a clear and concise description of the feature you are requesting. What problem does it solve or what improvement does it bring?
20+
21+
## Use Case
22+
23+
📚 Please provide a use case or scenario where this feature would be beneficial. How would you envision using this feature in your workflow?
24+
25+
## Proposed Solution
26+
27+
💡 If you have any ideas or suggestions on how this feature could be implemented, please share them here.
28+
29+
## Alternatives Considered
30+
31+
🔍 Have you considered any alternatives or workarounds to achieve the same goal? If so, please describe them.
32+
33+
## Additional Context
34+
35+
📝 Please provide any additional information, screenshots, or examples that can help us better understand your request.
36+
37+
---
38+
39+
Thank you for submitting your feature request! We appreciate your feedback and will carefully review your suggestions. Your input helps us improve our product and better meet the needs of our users.

.github/workflows/test.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Testing Services
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- development
8+
9+
10+
env:
11+
TOKEN_SECRET: ${{ secrets.TOKEN_SECRET }}
12+
DB_URL: ${{ secrets.DB_URL }}
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
test:
19+
name: Testing files
20+
timeout-minutes: 30
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v3
25+
- name: Set up Node
26+
uses: actions/setup-node@v3
27+
with:
28+
node-version: '18'
29+
cache: npm
30+
- name: Installation
31+
run: npm ci
32+
- name: Running Tests
33+
run: npm run test

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,5 @@ dist
129129
.yarn/install-state.gz
130130
.pnp.*
131131

132+
# ingore genrated APIdocs
133+
apidoc

Contribution.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Welcome to TCET Open Source contributing guide
2+
3+
Thank you for investing your time in contributing to our project!
4+
5+
In this guide you will get an overview of the contribution workflow from opening an issue, creating a PR, and merging the PR.
6+
7+
8+
## New contributor guide
9+
10+
To get an overview and installation of the project, read the [README](README.md). Here are some resources to help you get started with open source contributions:
11+
12+
- [Finding ways to contribute to open source on GitHub](https://docs.github.com/en/get-started/exploring-projects-on-github/finding-ways-to-contribute-to-open-source-on-github)
13+
- [Set up Git](https://docs.github.com/en/get-started/quickstart/set-up-git)
14+
- [GitHub flow](https://docs.github.com/en/get-started/quickstart/github-flow)
15+
- [Collaborating with pull requests](https://docs.github.com/en/github/collaborating-with-pull-requests)
16+
17+
18+
## Getting started
19+
20+
To navigate our codebase with confidence, see our [Github Repository](https://github.com/tcet-opensource/erp-backend)
21+
22+
## Issues
23+
24+
25+
#### Asking to work on an issue
26+
27+
Scan through our [existing issues](https://github.com/tcet-opensource/erp-backend/issues) to find one that interests you. You can narrow down the search using `labels` as filters. See [Labels](https://github.com/tcet-opensource/erp-backend/labels) for more information. For contributing comment on that specific issue that you want to work on it and we will assign that specific issue to you. Please remember only start working on the issue after it is assigned to you.
28+
29+
#### Create a new issue
30+
31+
If you find a bug or want to add any sort of feature in the repository , [search if an issue already exists](https://github.com/tcet-opensource/erp-backend/issues). If a related issue doesn't exist, you can open a new issue using a relevant [issue form](https://github.com/tcet-opensource/erp-backend/issues/new). Please note that the name of the issue title should be relevant and should give an idea about what you are working on.
32+
33+
34+
## Make Changes
35+
36+
### Make changes in the UI
37+
38+
Click **Make a contribution** at the bottom of erp-backend to make small changes such as a typo, sentence fix, or a broken link. This takes you to the `.md` file where you can make your changes and [create a pull request](#pull-request) for a review.
39+
40+
41+
### Make changes locally
42+
43+
1. External Contributors , Fork the repository
44+
- Using GitHub Desktop:
45+
- [Getting started with GitHub Desktop](https://docs.github.com/en/desktop/installing-and-configuring-github-desktop/getting-started-with-github-desktop) will guide you through setting up Desktop.
46+
- Once Desktop is set up, you can use it to fork the repo
47+
- Using the command line:
48+
- [Fork the repo](https://github.com/tcet-opensource/erp-backend/fork), so that you can make your changes without affecting the original project until you're ready to merge them.
49+
- After forking clone the forked repository
50+
- Switch from main branch to development branch in your cloned repository
51+
- To switch to development write command `git remote add upstream <link of original repo>` and `git fetch upstream` in the terminal
52+
- To install node modules use command `npm ci`
53+
- Switch to Development Branch and create a working branch for each issue.
54+
- To create a branch use command `git branch <name of the branch>`
55+
- NOTE: The name of the branch should in the format of -> Issue number-name of the issue (eg: 50-create_CRUD_for_infra_model)
56+
- Then from the development branch move to the branch created by using command `git checkout <branch name>`
57+
- All changes on the code should be done on your specific branch
58+
- Test your changes: After making your changes, it is crucial to thoroughly test them to ensure they function as intended and do not introduce any new bugs. Run any relevant tests or simulations and verify that the modified code performs correctly.
59+
- Before pushing the changes sync fork in the forked repo and pull the changes before pushing
60+
- After pushing go to the forked repository and press contribute and make a pull request
61+
62+
2. Internal Contributors, Clone the Repository
63+
&nbsp;
64+
`git clone -b development https://github.com/tcet-opensource/erp-backend.git`
65+
- To install node modules use command `npm ci`
66+
- Switch to Development Branch and create a working branch for each issue.
67+
- To create a branch use command `git branch <name of the branch>`
68+
- NOTE: The name of the branch should in the format of -> Issue number-name of the issue (eg: 50-create_CRUD_for_infra_model)
69+
- Then from the development branch move to the branch created by using command `git checkout <branch name>`
70+
- All changes on the code should be done on your specific branch
71+
- Test your changes: After making your changes, it is crucial to thoroughly test them to ensure they function as intended and do not introduce any new bugs. Run any relevant tests or simulations and verify that the modified code performs correctly.
72+
73+
74+
### Commit your changes
75+
- Stage your changes: Use the git add command to stage the modified files for the commit. This marks the changes as ready to be included in the next commit.
76+
`git add <file1> <file2> ...` or `git add .`
77+
- Commit your changes: Create a commit to record your modifications with a meaningful commit message. This helps in tracking and understanding the purpose of the changes.
78+
`git commit -m "relevant info of the change"`
79+
- Before pushing the changes on the repository always remember to pull the code to avoid any merge conflicts
80+
`git pull origin development`
81+
- try pushing the code on the development branch and not directly to the main branch
82+
83+
### Push your Changes
84+
- After committing your changes, you push them to a remote repository (in this case, your forked repository on GitHub) using the git push command. Pushing your changes uploads them to the remote repository, making them visible to others and allowing you to share your work.
85+
`git push origin <branch name>`
86+
87+
88+
### Pull Request
89+
90+
When you're finished with the changes, create a pull request, also known as a PR.
91+
- Don't forget to link PR to issue by using "#" issue number , if you are solving one.
92+
- Once you submit your PR, a team member will review your proposal. We may ask questions or request additional information.
93+
- We may ask for changes to be made before a PR can be merged, either using suggested changes or pull request comments. You can apply suggested changes directly through the UI. You can make any other changes in your fork, then commit them to your branch.
94+
- As you update your PR and apply changes, mark each conversation as resolved
95+
- If you run into any merge issues, checkout this [git merge conflicts](https://github.com/skills/resolve-merge-conflicts) to help you resolve merge conflicts and other issues.
96+
97+
### Your PR is merged!
98+
99+
Congratulations , The TCET Open Source team thanks you.

Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,3 @@ EXPOSE 3500
1212
CMD ["npm", "run", "start"]
1313

1414

15-

README.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,38 @@ All the dependencies used in this project will be listed in the `package.json` f
1212

1313
## Installation
1414

15-
To start working on this project, follow the steps given above until you complete Step 4, then make a MongoDB Atlas database, get the connection URI, and save it as `DB_URL` in your `.env` file. Also, make sure to use
15+
To start working on this project first you need to create `.env` file. This .env file will contain:
16+
17+
`PORT`
18+
You can set it on any port number you want. `eg: 4000`
19+
20+
`TOKEN_SECRET` which you will get by running following line in terminal
1621
```
1722
node -e "console.log(require('crypto').randomBytes(256).toString('base64'));
1823
```
19-
to generate a token secret that you will use for JWT authentication, save it as `TOKEN_SECRET` in your `.env` file.
24+
`ENVIRONMENT`
25+
Set this on 'local'
26+
27+
`DB_URL`
28+
For this parameter you will need to open your account on MongoDB Atlas, don't forget to note down you account password, then create new cluster and through that you will get your connection string which will be your DB_URL in .env, make sure instead of "password" in connection string, you enter your own account password.
29+
30+
`EMAIL_HOST`,
31+
`EMAIL_PORT`,
32+
`EMAIL_USER`,
33+
`EMAIL_PASS`
2034

21-
Once you are done with this, install the packages through `npm i` and run the server with `npm run serverstart` or `npm run serverstartWin` depending on your operating system.
35+
For these above parameters, first you need to open an account on any SMTP server, we use mailtrap, then start testing where you will see show credentials in which you will get all the values we need which are host, port, username and password.
36+
37+
You don't need to assign values to these parameters in double or single quotes, just write directly, .env automatically converts it into quoted string.
38+
39+
Once you are done with this, install the packages through `npm ci` which stands for clean install.
40+
Also, you need to run 'setup.js' file. You can do that by running following command in your terminal
41+
```
42+
node setup.js
43+
```
44+
And finally, run the server with `npm run serverstart` or `npm run serverstartWin` depending on your operating system.
2245

23-
## Contributing
46+
## How to Contribute
2447

2548
1. Choose an issue, bug, exploit, or feature to work on: Start by identifying an issue or feature in the repository that you would like to work on. If you can't find an existing issue or feature, you can create a new one.
2649

_apidoc.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// ------------------------------------------------------------------------------------------
2+
// General apiDoc documentation blocks and old history blocks.
3+
// ------------------------------------------------------------------------------------------
4+
5+
// ------------------------------------------------------------------------------------------
6+
// Current Success.
7+
// ------------------------------------------------------------------------------------------
8+
9+
// ------------------------------------------------------------------------------------------
10+
// Current Errors.
11+
// ------------------------------------------------------------------------------------------
12+
13+
// ------------------------------------------------------------------------------------------
14+
// Current Permissions.
15+
// ------------------------------------------------------------------------------------------
16+
17+
// ------------------------------------------------------------------------------------------
18+
// History.
19+
// ------------------------------------------------------------------------------------------

apidoc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "ERP-backend",
3+
"version": "0.1.0",
4+
"description": "TCET ERP System is a project that aims to simplify and automate daily operation in TCET."
5+
}

0 commit comments

Comments
 (0)