diff --git a/app/api/routes/content.py b/app/api/routes/content.py index 9c6c5da..0de6041 100644 --- a/app/api/routes/content.py +++ b/app/api/routes/content.py @@ -61,13 +61,13 @@ async def s_api_v1_content_view(request, content_address: str): (content['encrypted_content'].owner_address == user_wallet_address) or bool(request.ctx.db_session.query(UserContent).filter_by(owner_address=user_wallet_address, status='active', content_id=content['encrypted_content'].id).first()) \ - or bool(request.ctx.db_session.query(UserContent).filter( + or bool(request.ctx.db_session.query(StarsInvoice).filter( and_( StarsInvoice.user_id == request.ctx.user.id, StarsInvoice.content_hash == content['encrypted_content'].hash, StarsInvoice.paid == True ) - )) + ).first()) ) if not have_access: stars_cost = 1 # TODO: как считать стоимость в звездах? diff --git a/app/core/models/_telegram/templates/player.py b/app/core/models/_telegram/templates/player.py index ab66b59..e8a469e 100644 --- a/app/core/models/_telegram/templates/player.py +++ b/app/core/models/_telegram/templates/player.py @@ -170,13 +170,13 @@ class PlayerTemplates: have_access = ( (content.owner_address == user_wallet_address) or bool(self.db_session.query(UserContent).filter_by(owner_address=user_wallet_address, status='active', content_id=content.id).first()) - or bool(self.db_session.query(UserContent).filter( + or bool(self.db_session.query(StarsInvoice).filter( and_( StarsInvoice.user_id == self.user.id, StarsInvoice.content_hash == content.hash, StarsInvoice.paid == True ) - )) + ).first()) ) if have_access: full_content = self.db_session.query(StoredContent).filter_by(