Skip to content

Commit

Permalink
Merge pull request #2 from Lissone/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Lissone authored Nov 4, 2022
2 parents 06d8014 + b70d68b commit 3a402f8
Show file tree
Hide file tree
Showing 59 changed files with 4,611 additions and 1,771 deletions.
3 changes: 3 additions & 0 deletions .commitlintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["@commitlint/config-conventional"]
}
9 changes: 0 additions & 9 deletions .env

This file was deleted.

17 changes: 17 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# DEFAULT
PORT=5000
SECRET_KEY=super_scret

# REDIS
REDIS_HOST=localhost
REDIS_PORT=6379

# DATABASE
DB_USERNAME=sa
DB_PASSWORD=123456
DB_NAME=dbPointControl
DB_HOST=localhost

# NODEMAILER
NODEMAILER_USER=
NODEMAILER_PASS=
7 changes: 4 additions & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*.js
node_modules
dist
[Bb]uild*
[Dd]ist*
[Bb]in*
package-lock.json
61 changes: 61 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"env": {
"es2021": true,
"node": true
},
"extends": ["plugin:@typescript-eslint/recommended", "airbnb-base", "eslint-config-prettier", "prettier"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": ["@typescript-eslint", "prettier", "eslint-plugin-import-helpers"],
"rules": {
"prettier/prettier": [
"error",
{
"semi": false,
"singleQuote": true,
"printWidth": 120,
"trailingComma": "none",
"tabWidth": 2,
"arrowParens": "avoid",
"endOfLine": "auto"
}
],
"class-methods-use-this": "off",
"no-unused-vars": "off",
"lines-between-class-members": "off",
"no-shadow": "off",
"@typescript-eslint/no-shadow": ["error"],
"import/prefer-default-export": "off",
"import/no-unresolved": "off",
"import/order": "off",
"import/extensions": [
"error",
{
"ts": "never"
}
],
"import-helpers/order-imports": [
"warn",
{
"newlinesBetween": "always",
"groups": [
"module",
"/^@external/",
"/^@middlewares/",
"/^@repositories/",
"/^@useCases/",
"/^@controllers/",
"/^@entities/",
"/^@shared/",
["parent", "sibling", "index"],
"/^~/",
"/^@interfaces/"
],
"alphabetize": { "order": "asc", "ignoreCase": true }
}
]
}
}
42 changes: 0 additions & 42 deletions .eslintrc.json

This file was deleted.

4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ typings/
.yarn-integrity

# dotenv environment variables file
# .env
# .env.test
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache
Expand Down
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn commitlint --edit
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn lint-staged
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[Bb]uild*
[Dd]ist*
[Bb]in*
package-lock.json
10 changes: 7 additions & 3 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"semi": false,
"singleQuote": true,
"trailingComma": "all",
"arrowParens": "avoid"
}
"printWidth": 120,
"trailingComma": "none",
"tabWidth": 2,
"arrowParens": "avoid",
"endOfLine": "auto"
}
96 changes: 84 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@

<p align="center">
<a href="#description">Description</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;
<a href="#demonstrations">Demonstrations</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;
<a href="#requirements">Requirements</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;
<a href="#technologies">Technologies</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;
<a href="#usage">Usage</a>
<a href="#usage">Usage</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;
<a href="#contributors">Contributors</a>
</p>
<br />
<p align="center">
Expand All @@ -29,29 +31,53 @@

## Description

Api of a company points control application.
This project is the Back-end (Api) of a company point control application. To illustrate in a simple way, this api controls and stores all employee data, entry points, exit, pause, absences from work and all this being managed by employees of the company itself, who have specific and special credentials for this.

Project developed as an activity of my bachelor's course in information systems, in order to serve as a back end for corporate time attendance application, with web and mobile compatibility. The api structure was created based on clean architecture and documented with Swagger (On api homepage).
Project developed as an activity of my bachelor's degree in information systems, with the main objective of having a very descriptive and extensive documentation, for anyone to understand the features and learn from it. The api framework was built on clean architecture and documented with Swagger.

For the development of this project, a flowchart was created as application documentation on <a href="https://whimsical.com/pointcontrol-5dryUV3teiRwy1rPzH3ekK" target="_blank">Whimsical</a>.
To facilitate the development of the project and better describe everything that was created, a flowchart of some of the project's features and relevant information at the time of its development was designed, using Whimsical.

To access the other projects integrated to this one, access:
- <a href="https://github.com/Lissone/point-control-admin-web" target="_blank">Front-end to admin users</a>
- <a href="https://github.com/almeidavini/point-control" target="_blank">Front-end to employees</a>

This project was done in partnership with:
- <a href="https://github.com/MikaMorais" target="_blank">Moises Morais</a>
- <a href="https://github.com/steniodr" target="_blank">Stenio Rapchan</a>
- <a href="https://github.com/almeidavini" target="_blank">Vinicius Almeida</a>

## Demonstrations

Front-end to admin users

https://user-images.githubusercontent.com/57052110/194934760-04bbc99d-4cce-464e-a93d-7f47beb80742.mp4

Front-end to employees

https://user-images.githubusercontent.com/57052110/200085812-502e5746-05b4-4497-82eb-796c923ff65b.mp4

## Requirements

- [Npm](https://www.npmjs.com/)
- [Yarn](https://yarnpkg.com/)
- [Nodejs](https://nodejs.org/en/)
- [Redis](https://redis.io/)
- [SqlServer](https://www.microsoft.com/pt-br/sql-server/sql-server-downloads)

## Technologies

- Nodejs
- Typescript
- Express
- Nodemon
- TypeORM
- IoRedis
- Nodemailer
- Swagger (Documentation)
- ESLint (Airbnb config)
- Eslint
- Airbnb-config with another pessoal rules
- Import helpers plugin
- Prettier
- Commitizen

## Usage

Expand All @@ -69,6 +95,10 @@ yarn
npm install
```

### Initial settings before running project

Because we use external services, it is necessary to make some simple configurations before running the project.

### Database configuration

You must create the database before running an api (dbPointControl).
Expand All @@ -94,7 +124,7 @@ const connection = createConnection({

Need create first global admin user:

Default password: 123
Default password: 123456

```sql
INSERT INTO [dbo].[user]
Expand All @@ -103,7 +133,7 @@ VALUES (
'08e5ad8d-5fa3-41a2-a732-b997336b4cf5',
'Global Admin',
'admin@admin.com',
'$2y$05$JdbLU5VqejoIstt/jtJva.PkydhrKCc5uRBdQpJY1RjooSE/hSprK',
'$2a$05$MG6XoOEDPjtXVesTW8P2S.UkNzii1ai7VEAvBnToDHZq03sSij2vi',
'global.admin',
1,
NULL,
Expand All @@ -112,19 +142,32 @@ VALUES (
)
```

### Email configuration

If you are using your gmail account to use the messaging system with Nodemailer, you should give access to <a href="https://myaccount.google.com/lesssecureapps?pli=1&rapt=AEjHL4PzIfR0P6cezk9W9qg5xrvKjdjnlQ-oSFiXuT4yVX_S5YpKKcf5I5vJdWtzw7oaWydt9nVFxvMUspZzNR38DCKgOHSEOw" target="_blank">your account</a> to less secure apps, even though they are secure.

Need to add environment variables:

```bash
# .\.env

# DEFAULT
PORT=5000
SECRET_KEY=super_secret # JWT secret key

# REDIS
REDIS_HOST=localhost
REDIS_PORT=6379

# DATABASE
DB_USERNAME=sa
DB_PASSWORD=123456
DB_NAME=dbPointControl
DB_HOST=localhost

# NODEMAILER
NODEMAILER_USER= # Email used for sending messages
NODEMAILER_PASS= # Your email password
```

Run api:
Expand All @@ -135,13 +178,42 @@ yarn dev
npm run dev
```

## Contributors

Thanks goes to these wonderful people, who were part of the project from start to finish:

<table>
<tr>
<td align="center">
<a href="https://github.com/MikaMorais" target="_blank">
<img src="https://github.com/MikaMorais.png" width="100px;" alt="Moises Morais photo"/><br>
<sub>
<b>Moises Morais</b>
</sub>
</a>
</td>
<td align="center">
<a href="https://github.com/steniodr" target="_blank">
<img src="https://github.com/steniodr.png" width="100px;" alt="Stenio Rapchan photo"/><br>
<sub>
<b>Stenio Rapchan</b>
</sub>
</a>
</td>
<td align="center">
<a href="https://github.com/almeidavini" target="_blank">
<img src="https://github.com/almeidavini.png" width="100px;" alt="Vinicius Almeida photo"/><br>
<sub>
<b>Vinicius Almeida</b>
</sub>
</a>
</td>
</tr>
</table>

## License

Distributed under the MIT License. See `LICENSE` for more information.

<h4 align="center">
Made with ❤️ by <a href="https://github.com/Lissone" target="_blank">Lissone</a>
</h4>

<hr />

Loading

0 comments on commit 3a402f8

Please sign in to comment.