Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tarasyarema/tinderupc
Because being alone sucks, I guess....
https://github.com/tarasyarema/tinderupc
Last synced: 17 days ago
JSON representation
Because being alone sucks, I guess....
- Host: GitHub
- URL: https://github.com/tarasyarema/tinderupc
- Owner: tarasyarema
- Created: 2019-10-12T17:35:54.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-05-25T01:49:35.000Z (over 2 years ago)
- Last Synced: 2024-07-31T20:50:00.265Z (3 months ago)
- Language: Python
- Homepage:
- Size: 5.07 MB
- Stars: 4
- Watchers: 4
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Melice Corp main API engine
## Run
Execute `startDB.sh`, `build.sh` and `run.sh`.
You will need a `.env` file with the following envars:
```
SECRET=
MONGO_HOST=
MONGO_PORT=
MONGO_INITDB_ROOT_USERNAME=
MONGO_INITDB_ROOT_PASSWORD=
```## API reference (Inital pivot version v69.0.0)
### Register: `POST /register`
#### Request
Can be called via form data or JSON body.
The mandatory format has to be the following:
```json
{
"email": "[email protected]",
"password": "biene"
}
```
After that, you can add all the key, value pairs you want.
They will be stored in the meta object of the user created.#### Returns
A JWT token.
```json
HTTP 200{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6IjVkYTI4OTk0NmNkMWNhM2E5MDg4ZDg1NSJ9.ohkLJrptxT0F4wuQekOQEK-qpxNHnrA-jVTwZ4psx74"
}
```### Login: `POST /login`
#### Request
Can be called via form data or JSON body.
The format has to be the following:
```json
{
"email": "[email protected]",
"password": "biene"
}
```#### Returns
A JWT token.
```json
HTTP 200{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6IjVkYTI4OTk0NmNkMWNhM2E5MDg4ZDg1NSJ9.ohkLJrptxT0F4wuQekOQEK-qpxNHnrA-jVTwZ4psx74"
}
```### Logout: `POST /logout`
#### Request
You should delete the auth header before calling this.#### Returns
```json
HTTP 200{
"message": "logged out"
}
```### Get stack: `GET /`
#### Request
The token as a `Authorization: Bearer {token}` header.#### Returns
Returns JSON
```json
HTTP 200{
"data": [
{
"id": "5da25e5286dc7e9c3be99a0d",
"data": {
"lang": "C",
"desccription": "I like maths!",
"age": 22
}
},
{
"id": "5da25e5286dc7e9c3be99a0d",
"data": {
"lang": "Python",
"dick": 25
}
}
]
}
```### Vote: `POST /vote`
#### Request
The token as a `Authorization: Bearer {token}` header.Can be called via form data or JSON body.
The format has to be the following:
```json
{
"id_a": "5da25e5286dc7e9c3be99a0d",
"id_b": "5da26d9687f808f820d54233",
"win": false
}
```The parameters mean:
1. `id_a`: User A id.
2. `id_b`: User B id.
3. `win`: True if the selected is id_a, False if it's id_b.#### Returns
```json
HTTP 200{
"message": "user relations updated"
}
```### Get ranking: `GET /ranking`
#### Request
The token as a `Authorization: Bearer {token}` header.#### Returns
Returns JSON with an array (actual max 5 elements, may be changed xd).
```json
HTTP 200{
"data": [
{
"id": "5da26d9687f808f820d54233",
"elo": 1546.0200225109015,
"user_data": {
"email": "jajaasd",
"meta": {
"lang": "Python 3.7",
"description": "hola asd k tal"
}
}
},
{
"id": "5da23afa05650a08e4ca6a8f",
"elo": 1534.137483083232,
"user_data": {
"email": "2pac",
"meta": {
"lang": "OCaml",
"description": "jeje"
}
}
},
{
"id": "5da25e5286dc7e9c3be99a0d",
"elo": 1516.983271764316,
"user_data": {
"email": "taras",
"meta": {
"lang": "C",
"desccription": "asdasd asdas"
}
}
},
{
"id": "5da25857e57c8c0839a12bea",
"elo": 1465.0496502835474,
"user_data": {
"email": "asd",
"meta": {
"lang": "R",
"description": "juju"
}
}
},
{
"id": "5da25e8e5dd47b259e2ac2e3",
"elo": 1434.9030321116102,
"user_data": {
"email": "taras",
"meta": {
"lang": "C",
"desccription": "asdasd asdas"
}
}
}
]
}
```### Post media for a user: `POST /media`
#### Request
The token as a `Authorization: Bearer {token}` header.
Binary data with optional `Content-Type` header.
Adds a document to the `media` collection with `user_id` the given user.Now it adds raw binary data to the db, in the **next pivot** (*v1337.0.0*) this will be changed to a url of the image in some cloud platform (Google Cloud probably).
#### Returns
Returns JSON
```json
HTTP 200{
"message": "media content uploaded"
}
```### Get a user profile: `GET /profile`
#### Request
The token as a `Authorization: Bearer {token}` header.#### Returns
Returns JSON
```json
HTTP 200{
"user": {
"id": "5da48689bac312608d6d23fc",
"meta": {
"description": ":3",
"lang": "Python 2.7",
"position": "CEO",
"age": 22,
"orientation": "all",
"whatever": "love you bb"
}
},
"media": [
{
"id": "5da493415a0927043cc640f9",
"data": {
"$binary": "iVB...rkJggg==",
"$type": "00"
},
"type": "image/png"
}
]
}
```