Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/theduardomaciel/dfl-api
An API responsible for the services required by the DFL application for the functioning of its subsystems (dashboard/mobile).
https://github.com/theduardomaciel/dfl-api
axios cors express expressjs javascript nodejs typescript
Last synced: about 1 month ago
JSON representation
An API responsible for the services required by the DFL application for the functioning of its subsystems (dashboard/mobile).
- Host: GitHub
- URL: https://github.com/theduardomaciel/dfl-api
- Owner: theduardomaciel
- License: mit
- Created: 2022-05-21T17:15:29.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-08-17T00:58:22.000Z (over 2 years ago)
- Last Synced: 2023-03-06T07:47:40.019Z (almost 2 years ago)
- Topics: axios, cors, express, expressjs, javascript, nodejs, typescript
- Language: TypeScript
- Homepage: https://github.com/theduardomaciel/dfl-mobile
- Size: 781 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
DFL - API
![cover](.github/cover.png?style=flat)
## đź’» Projeto
API of the DFL (a.k.a GSD - Garbage Spot Detector) application, essential for the operation of the following sub-applications:
* [Website (base/dashboard/blog)](https://github.com/theduardomaciel/dfl-web)
* [Mobile app](https://github.com/theduardomaciel/dfl-mobile)## ✨ Technologies
- [ ] Node.js
- [ ] JavaScript (w/TypeScript)
- [ ] Prisma
- [ ] PostgreSQL
- [ ] Express
- [ ] Axios## Using the default application
To be able to download the default app on your Android mobile device (the only operating system currently available), visit the [DFL website](https://dfl.vercel.app) and navigate to the download area to install the .apk file of the application.
> To report an issue, please add an [issue](https://github.com/theduardomaciel/dfl-mobile/issues) so the bug can be tracked and resolved.
# API Routes
## User & Authentication
| Route | Description | Authentication? | Method | Body |
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- | ------ | --------------------------- |
| /authenticate | Authenticate the user on the mobile app or create a account based on Google Accounts for him.
Returns a access token to request authenticated api paths. | ❌ | POST | { user_info, access_token } |
| /user/[user_id] | Returns the user object. | ADMIN | GET |~~~typescript
user_info: {
email: string,
id: number, //equivale ao ID do Google, e não ao ID que será criado pela API
familyName: string, // equivalente a "lastName"
givenName: string, //equivalente a "firstName"
photo: string
}
~~~~~~typescript
access_token: string
// equivale ao token de acesso do Google para que informações adicionais sejam obtidas (ex.: gênero e data de nascimento)
~~~## Profile
| Route | Description | Authentication? | Method | Body |
| -------------------------------- | -------------------------------------------------------------------------------------------------------------------- | --------------- | ------ | ----------------------------------------- |
| /profile/[profile_id] | Returns the user profile object. | ❌ | GET |
| /profile/[profile_id] | Updates the user profile object.
| âś… | PATCH | { username: string, defaultCity: string } |
| /profile/[profile_id]/experience | Updates the user experience without needing to create a report.
Only updates the equivalent to the player level. | âś… | PATCH |## Reports
| Route | Description | Authentication? | Method | Body |
| ------------------- | -------------------------------------------------------- | --------------- | ------ | ---------- |
| /report/[report_id] | Returns the report object. | ❌ | GET |
| /report | Creates a report for a user profile with the given data. | âś… | POST | Post Body |
| /report/[report_id] | Updates the report object. | âś… | PATCH | Patch Body |
| |Post Body:
~~~typescript
{
profile_id: number,
tags: string || JSON,
address: string,
coordinates: Array,
images: Array, // devem estar no formato base64
suggestion: string,
hasTrashBins: boolean
}
~~~Patch Body:
~~~typescript
{
profile_id: number,
rating: number, // a nota que está sendo adicionada pelo usuário (mobile app)
tags: string || JSON,
resolved: boolean,
approved: boolean,
}
~~~### Comments
| Route | Description | Authentication? | Method | Body |
| ---------------------------------------- | ------------------------------------------------- | --------------- | ------ | --------------------------------------- |
| /report/[report_id]/comment | Creates a comment in a report | âś… | POST | { profile_id: number, content: string } |
| /report/[report_id]/comment/[comment_id] | Returns a comment of a report with the given ID's | âś… | GET |
| /report/[report_id]/comments | Returns all the comments of a report. | âś… | GET |## đź“„ License
This project is under the MIT license. See the [LICENSE](LICENSE) file for more details.