Skip to content

Commit aaa946b

Browse files
committed
upadates
1 parent 4728ba9 commit aaa946b

4 files changed

Lines changed: 52 additions & 0 deletions

File tree

core/api/user/views.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,21 @@ def view_cards(current_user):
123123
many=True
124124
)
125125

126+
127+
@user.post('/app_token')
128+
@login_required
129+
def add_app_token(current_user):
130+
payload = request.get_json(force=True)
131+
if 'app_token' not in payload:
132+
return error_response(
133+
400,
134+
'Missing required field "app_token"'
135+
)
136+
with db.session() as sess:
137+
current_user.mobile_app_registration_token = payload['app_token']
138+
sess.commit()
139+
return gen_response(200, 'Added token successfully!')
140+
126141
# @user.get('/<uid>')
127142
# def check_uid(uid):
128143
# """ checks if uid exists """
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"""empty message
2+
3+
Revision ID: 42f4aaaab1a1
4+
Revises: b8ec34f70d9c
5+
Create Date: 2025-12-17 12:44:08.160967
6+
7+
"""
8+
from alembic import op
9+
import sqlalchemy as sa
10+
from sqlalchemy.dialects import postgresql
11+
12+
# revision identifiers, used by Alembic.
13+
revision = '42f4aaaab1a1'
14+
down_revision = 'b8ec34f70d9c'
15+
branch_labels = None
16+
depends_on = None
17+
18+
19+
def upgrade():
20+
# ### commands auto generated by Alembic - please adjust! ###
21+
with op.batch_alter_table('user', schema=None) as batch_op:
22+
batch_op.add_column(
23+
sa.Column('mobile_app_registration_token', sa.String(), nullable=True)
24+
)
25+
26+
27+
def downgrade():
28+
# ### commands auto generated by Alembic - please adjust! ###
29+
30+
with op.batch_alter_table('user', schema=None) as batch_op:
31+
batch_op.drop_column('mobile_app_registration_token')

models/user_models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ class User(TimestampMixin, db.Model):
116116
address = db.Column(db.String(500))
117117
sign_up_date = db.Column(db.Date, default=datetime.utcnow())
118118
profile_picture = db.Column(db.String())
119+
mobile_app_registration_token = db.Column(db.String())
119120
artisan_profile = db.relationship(
120121
'Artisan',
121122
backref='user_profile',

tasks/events.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
redis_pass = os.getenv('REDIS_PASS')
1717
redis_port = os.getenv('REDIS_PORT', 6378)
1818

19+
IMPORTANT_NOTIFICATIONS = [
20+
'approve_booking_details',
21+
'job_completed',
22+
]
23+
1924

2025
def exp_backoff_task(retries, retry_backoff):
2126
def deco(fn):

0 commit comments

Comments
 (0)