Skip to content

Commit

Permalink
fix: add save stogage constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
baebae02 committed Nov 9, 2023
1 parent e199e62 commit 424d361
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/utils/share.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ def save_storage(storage_list):
storage = Storage.query.filter_by(id=storage_id).order_by(Storage.created_at).first()
if storage is None:
raise ShareError('존재하지 않는 기도제목입니다.')
if Storage.query.filter_by(user_id=g.user_id).filter_by(pray_id=storage.pray_id).first():
raise ShareError('이미 저장된 기도제목입니다.')
if storage.pray.user.device_token:
send_push_notification('💌', '누군가가 당신의 기도제목을 저장했어요', [storage.pray.user.device_token], {})
result.append(StorageService.create_storage(storage.pray, datetime.datetime.now() + datetime.timedelta(days=15)))
Expand Down

0 comments on commit 424d361

Please sign in to comment.