-
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
python upgrade, CRUDBase replaced with fastcrud
- Loading branch information
Showing
12 changed files
with
26 additions
and
653 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
from ...crud.crud_base import CRUDBase | ||
from fastcrud import FastCRUD | ||
|
||
from ..db.token_blacklist import TokenBlacklist | ||
from ..schemas import TokenBlacklistCreate, TokenBlacklistUpdate | ||
|
||
CRUDTokenBlacklist = CRUDBase[TokenBlacklist, TokenBlacklistCreate, TokenBlacklistUpdate, TokenBlacklistUpdate, None] | ||
CRUDTokenBlacklist = FastCRUD[TokenBlacklist, TokenBlacklistCreate, TokenBlacklistUpdate, TokenBlacklistUpdate, None] | ||
crud_token_blacklist = CRUDTokenBlacklist(TokenBlacklist) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +0,0 @@ | ||
from http import HTTPStatus | ||
|
||
from fastapi import HTTPException, status | ||
|
||
|
||
class CustomException(HTTPException): | ||
def __init__(self, status_code: int = status.HTTP_500_INTERNAL_SERVER_ERROR, detail: str | None = None): | ||
if not detail: | ||
detail = HTTPStatus(status_code).description | ||
super().__init__(status_code=status_code, detail=detail) | ||
|
||
|
||
class BadRequestException(CustomException): | ||
def __init__(self, detail: str | None = None): | ||
super().__init__(status_code=status.HTTP_400_BAD_REQUEST, detail=detail) | ||
|
||
|
||
class NotFoundException(CustomException): | ||
def __init__(self, detail: str | None = None): | ||
super().__init__(status_code=status.HTTP_404_NOT_FOUND, detail=detail) | ||
|
||
|
||
class ForbiddenException(CustomException): | ||
def __init__(self, detail: str | None = None): | ||
super().__init__(status_code=status.HTTP_403_FORBIDDEN, detail=detail) | ||
|
||
|
||
class UnauthorizedException(CustomException): | ||
def __init__(self, detail: str | None = None): | ||
super().__init__(status_code=status.HTTP_401_UNAUTHORIZED, detail=detail) | ||
|
||
|
||
class UnprocessableEntityException(CustomException): | ||
def __init__(self, detail: str | None = None): | ||
super().__init__(status_code=status.HTTP_422_UNPROCESSABLE_ENTITY, detail=detail) | ||
|
||
|
||
class DuplicateValueException(CustomException): | ||
def __init__(self, detail: str | None = None): | ||
super().__init__(status_code=status.HTTP_422_UNPROCESSABLE_ENTITY, detail=detail) | ||
|
||
|
||
class RateLimitException(CustomException): | ||
def __init__(self, detail: str | None = None): | ||
super().__init__(status_code=status.HTTP_429_TOO_MANY_REQUESTS, detail=detail) | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import asyncio | ||
import logging | ||
|
||
import uvloop | ||
from arq.worker import Worker | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.