Skip to content

Commit

Permalink
added groups api (not full)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andcool-Systems committed Feb 3, 2024
1 parent 93cc621 commit 70cab7e
Show file tree
Hide file tree
Showing 8 changed files with 439 additions and 56 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
/__pycache__
/dataBase.db
/.env
/tg
/tg
/web_nextjs
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ This section will be referred to as `1.1` in the documentation.

**List of errors:**

| errorId | message | Reasons |
| ------- | ----------------------------------------------------- | --------------------------------------------- |
| -1 | No Authorization header provided | The request is missing the `Authorization` header |
| errorId | message | Reasons |
| ------- | ----------------------------------------------------- | --------------------------------------------------- |
| -1 | No Authorization header provided | The request is missing the `Authorization` header |
| -2 | Authorization header must have `Bearer <token>` format | The `Authorization` header has an incorrect format |
| -3 | Access token expired | The token has expired |
| -4 | Invalid access token | The token cannot be decrypted |
| -5 | Token not found | The token is not found |
| -3 | Access token expired | The token has expired |
| -4 | Invalid access token | The token cannot be decrypted |
| -5 | Token not found | The token is not found |

### 1.2 Basic API

Expand All @@ -56,8 +56,8 @@ If the file type cannot be determined, the API returns the file in download mode

#### Possible Errors

| Error Code | Description | Possible Reasons |
| ---------- | ----------------------------- | ------------------------------------------ |
| Error Code | Description | Possible Reasons |
| ---------- | ----------------------------- | -----------------------------------------------|
| 404 | File not found | The file referenced by the code does not exist |

### Upload a file to the server
Expand Down Expand Up @@ -122,7 +122,7 @@ Both requests accept the same request body but have different errors.

```json
{
"username": "Andcool",
"username": "My cool username",
"password": "My cool password"
}
```
Expand Down Expand Up @@ -168,7 +168,7 @@ Successful execution returns a `200` HTTP code along with the `accessToken` fiel
#### Possible Errors

| errorId | HTTP code | message | Reasons |
| ------- | ----------|-----------------------------| ------------------------------------------------ |
| ------- | ----------|-----------------------------| ------------------------------------------------- |
| 5 | 400 | No access token provided | The `accessToken` field is missing in the request |

Errors described in section `1.1` may also occur.
Expand Down
23 changes: 23 additions & 0 deletions imports.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from fastapi import FastAPI, UploadFile, Request, Header
from fastapi.responses import JSONResponse, FileResponse, Response
from typing import Annotated, Union
import uvicorn
from config import *
import aiohttp
import utils
from slowapi.errors import RateLimitExceeded
from slowapi import Limiter, _rate_limit_exceeded_handler
from slowapi.util import get_remote_address
from fastapi.middleware.cors import CORSMiddleware
import time
import aiofiles
from prisma import Prisma
import uuid
import os
from datetime import datetime
from dotenv import load_dotenv
import jwt
import bcrypt
import random

rate_limit_exceeded_handler = _rate_limit_exceeded_handler
Loading

0 comments on commit 70cab7e

Please sign in to comment.