An open API service indexing awesome lists of open source software.

https://github.com/ikayevaibar/starnavi

test project for Ukrainian company Starnavi
https://github.com/ikayevaibar/starnavi

backend django django-rest-framework python

Last synced: over 1 year ago
JSON representation

test project for Ukrainian company Starnavi

Awesome Lists containing this project

README

          

# starnavi

#### A brief guideline to run it (on Windows):

1.Activate virtual environment
```
.\venv\Scripts\activate
```

2.Install the required libs for the project
```
pip install -r requirements.txt
```
3.Create super user

```
python manage.py createsuperuser
```
and try to run it :D

```
python manage.py runserver
```

## Basic models:

### ● User(from django auth, but added 1 parameter)
### ● Post

## Basic Features:

### ● user signup
```
POST request to /api/users/ or /auth/users/ with data in body [username, password]
```
### ● user login
```
POST request to /api/token/ with data in body [username, password] and you get a refresh and access tokens
```
### ● post creation
```
POST request to /api/posts/ with data

[
text -> text field 5000 max char
published -> boolean
is_reply -> boolean
author -> id of user
parent_post -> id of post or u can don't write this parameter if new post is not part of brench
]
```

### ● post like
```
POST request to /api/likes/ with data
[
user -> id of user
post -> id of post
]
```

### ● post unlike
```
DELETE method to /api/likes/
```

### ● analytics about how many likes was made. API should return analytics aggregated by day.
```
GET request to /api/analytics/?date_from=&date_to=
```

### ● user activity an endpoint which will show when user was login last time and when he
mades a last request to the service.

```
GET request to /api/users//activity/
```

#### additionaly i added:

```
GET request to /api/posts//likes/ gives u all likes to current post with post_id
```

## all requests except post request to create user need jwt token in header that looks like:

```
Authorization: JWT eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjU1OTEyOTkzLCJqdGkiOiJiZGQ5ZWQ4ZTE0ZTE0YTllYmExMTAzMTMwYjljNjFkZiIsInVzZXJfaWQiOjF9.ChuD-xKTrE8mahv7HrpFxVahWVwZWIFnA0phekISuug
```

## all possible endpoints are possible at
```
/swagger/
```

# Thank you for your attention :D