Skip to content

Commit 83ae8f3

Browse files
committed
Removed unused endpoint /profile/new. See Mosquito-Alert/Mosquito-Alert-Mobile-App#214
1 parent f605694 commit 83ae8f3

File tree

3 files changed

+0
-100
lines changed

3 files changed

+0
-100
lines changed

tigaserver_app/static/tigaserver_app/schema-v1.yaml

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2154,62 +2154,6 @@ paths:
21542154
application/json:
21552155
schema: {}
21562156
description: ''
2157-
/api/profile/new/:
2158-
post:
2159-
operationId: Createprofile_new
2160-
summary: 'API endpoint for creating a new user profile.'
2161-
description: 'Associates a profile, identified by a firebase auth token, with a device identified by a user uuid'
2162-
tags:
2163-
- apps
2164-
parameters:
2165-
- name: fbt
2166-
required: true
2167-
in: query
2168-
description: The firebase auth token.
2169-
schema:
2170-
type: string
2171-
- name: usr
2172-
required: true
2173-
in: query
2174-
description: The user uuid.
2175-
schema:
2176-
type: string
2177-
format: uuid
2178-
responses:
2179-
'200':
2180-
content:
2181-
application/json:
2182-
schema:
2183-
type: object
2184-
properties:
2185-
id:
2186-
description: The id of the recently created profile
2187-
type: integer
2188-
firebase_token:
2189-
description: The firebase token associated with the current device
2190-
type: string
2191-
score:
2192-
description: The user score (old value, deprecated)
2193-
type: integer
2194-
profile_devices:
2195-
description: List of all devices (uuids) associated with this profile
2196-
type: array
2197-
items:
2198-
properties:
2199-
user_UUID:
2200-
description: The user_uuid of the device
2201-
type: string
2202-
format: uuid
2203-
registration_time:
2204-
description: Timezone aware Datetime of when the device was registered
2205-
type: string
2206-
format: datetime
2207-
device_token:
2208-
description: Firebase token for the device, used in FCM messaging
2209-
type: string
2210-
score:
2211-
description: The user score (old value, deprecated)
2212-
type: integer
22132157
/api/session_update/{id}/:
22142158
put:
22152159
operationId: UpdateSession

tigaserver_app/urls.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@
6262
url('missions/$', views.get_new_missions),
6363
url('cfs_reports/$', views.force_refresh_cfs_reports),
6464
url('cfa_reports/$', views.force_refresh_cfa_reports),
65-
url('profile/new/$', views.profile_new),
6665
url('profile/$', views.profile_detail),
6766
url('clear_blocked/(?P<username>[\w.@+-]+)/$', views.clear_blocked),
6867
url('clear_blocked_r/(?P<username>[\w.@+-]+)/(?P<report>[\w-]+)/$', views.clear_blocked),

tigaserver_app/views.py

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1879,49 +1879,6 @@ def nearby_reports(request):
18791879
keep_looping = False
18801880
'''
18811881

1882-
1883-
@api_view(['POST'])
1884-
def profile_new(request):
1885-
if request.method == 'POST':
1886-
firebase_token = request.query_params.get('fbt', -1)
1887-
user_id = request.query_params.get('usr', -1)
1888-
if firebase_token == -1:
1889-
raise ParseError(detail='firebase token is mandatory')
1890-
if user_id == -1:
1891-
raise ParseError(detail='user is mandatory')
1892-
tigauser = get_object_or_404(TigaUser,pk=user_id)
1893-
if tigauser.profile is None:
1894-
#profile exists?
1895-
try:
1896-
p = TigaProfile.objects.get(firebase_token=firebase_token)
1897-
except TigaProfile.DoesNotExist:
1898-
p = TigaProfile(firebase_token=firebase_token,score=tigauser.score)
1899-
p.save()
1900-
tigauser.profile = p
1901-
tigauser.save()
1902-
serializer = TigaProfileSerializer(p)
1903-
return Response(serializer.data, status=status.HTTP_200_OK)
1904-
else:
1905-
#profile exists?
1906-
try:
1907-
p = TigaProfile.objects.get(firebase_token=firebase_token)
1908-
except TigaProfile.DoesNotExist:
1909-
p = TigaProfile(firebase_token=firebase_token, score=tigauser.score)
1910-
p.save()
1911-
profile = p
1912-
devices = profile.profile_devices
1913-
# Get all devices for profile - if it existed there will already be devices registered
1914-
for device in devices.all():
1915-
if device.score > profile.score:
1916-
profile.score = device.score
1917-
if device.user_UUID == user_id:
1918-
raise ParseError(detail='this device is already associated with this profile')
1919-
profile.profile_devices.add(tigauser)
1920-
profile.save()
1921-
serializer = TigaProfileSerializer(profile)
1922-
return Response(serializer.data, status=status.HTTP_200_OK)
1923-
1924-
19251882
def send_unblock_email(name, email):
19261883
lock_period = settings.ENTOLAB_LOCK_PERIOD
19271884
send_to = copy.copy(settings.ADDITIONAL_EMAIL_RECIPIENTS)

0 commit comments

Comments
 (0)