relationships: add RelationshipBlocked

Related to #30.

Fixes parent commit
This commit is contained in:
Luna 2018-12-08 18:48:27 -03:00
parent 6f349d4668
commit de3c6d00e6
1 changed files with 6 additions and 2 deletions

View File

@ -23,6 +23,7 @@ from asyncpg import UniqueViolationError
from ..auth import token_check
from ..schemas import validate, RELATIONSHIP, SPECIFIC_FRIEND
from ..enums import RelationshipType
from litecord.errors import BadRequest
bp = Blueprint('relationship', __name__)
@ -149,6 +150,10 @@ class RelationshipFailed(BadRequest):
error_code = 80004
class RelationshipBlocked(BadRequest):
error_code = 80001
@bp.route('/@me/relationships', methods=['POST'])
async def post_relationship():
user_id = await token_check()
@ -162,9 +167,8 @@ async def post_relationship():
res = await make_friend(user_id, uid)
# NOTE: don't know what status code should I send
if res is None:
return '', 500
raise RelationshipBlocked()
return '', 204