Skip to content

Commit 0cbd933

Browse files
committed
Removed unused endpoint 'api/profile'. See: Mosquito-Alert/Mosquito-Alert-Mobile-App#214
1 parent 83ae8f3 commit 0cbd933

File tree

4 files changed

+1
-234
lines changed

4 files changed

+1
-234
lines changed

tigaserver_app/serializers.py

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -629,62 +629,6 @@ class Meta:
629629
fields = '__all__'
630630

631631

632-
class DetailedReportSerializer(serializers.ModelSerializer):
633-
634-
photos = DetailedPhotoSerializer(many=True)
635-
user = UserListingField
636-
version_UUID = serializers.ReadOnlyField()
637-
version_number = serializers.ReadOnlyField()
638-
report_id = serializers.ReadOnlyField()
639-
phone_upload_time = serializers.ReadOnlyField()
640-
creation_time = serializers.ReadOnlyField()
641-
version_time = serializers.ReadOnlyField()
642-
type = serializers.ReadOnlyField()
643-
location_choice = serializers.ReadOnlyField()
644-
current_location_lon = serializers.ReadOnlyField()
645-
current_location_lat = serializers.ReadOnlyField()
646-
selected_location_lon = serializers.ReadOnlyField()
647-
selected_location_lat = serializers.ReadOnlyField()
648-
note = serializers.ReadOnlyField()
649-
package_name = serializers.ReadOnlyField()
650-
package_version = serializers.ReadOnlyField()
651-
device_manufacturer = serializers.ReadOnlyField()
652-
device_model = serializers.ReadOnlyField()
653-
os = serializers.ReadOnlyField()
654-
os_version = serializers.ReadOnlyField()
655-
os_language = serializers.ReadOnlyField()
656-
app_language = serializers.ReadOnlyField()
657-
responses = ReportResponseSerializer(many=True)
658-
point = serializers.SerializerMethodField(method_name='get_point')
659-
660-
class Meta:
661-
model = Report
662-
fields = '__all__'
663-
664-
def get_point(self,obj):
665-
if obj.point is not None:
666-
return { "lat": obj.point.y, "long": obj.point.x}
667-
else:
668-
return None
669-
670-
671-
672-
class DetailedTigaUserSerializer(serializers.ModelSerializer):
673-
user_reports = DetailedReportSerializer(many=True)
674-
675-
class Meta:
676-
model = TigaUser
677-
fields = ('user_UUID','registration_time','device_token','score','user_reports')
678-
679-
680-
class DetailedTigaProfileSerializer(serializers.ModelSerializer):
681-
profile_devices = DetailedTigaUserSerializer(many=True)
682-
683-
class Meta:
684-
model = TigaProfile
685-
fields = ('id', 'firebase_token', 'score', 'profile_devices')
686-
687-
688632
class EuropeCountrySimpleSerializer(serializers.ModelSerializer):
689633
class Meta:
690634
model = EuropeCountry

tigaserver_app/static/tigaserver_app/schema-v1.yaml

Lines changed: 0 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -771,154 +771,6 @@ paths:
771771
type: array
772772
items: {}
773773
description: ''
774-
/api/profile/:
775-
get:
776-
operationId: listprofile_details
777-
summary: 'Returns all the reports associated with a user profile'
778-
description: 'Returns all the reports associated with a user profile. The endpoint accepts either a firebase
779-
token or a uuid as parameters. If the uuid is supplied, and the user has several devices linked by a profile, the
780-
endpoint returns all the reports of all the devices. The firebase auth token can be supplied alternatively, with the
781-
same results since all devices share the same auth token.'
782-
tags:
783-
- apps
784-
parameters:
785-
- name: fbt
786-
required: true
787-
in: query
788-
description: 'Firebase auth token which identifies a user across several devices with different uuids'
789-
schema:
790-
type: string
791-
- name: usr_uuid
792-
required: true
793-
in: query
794-
description: 'Uuid for the device the user is currently logged in'
795-
schema:
796-
type: string
797-
responses:
798-
'200':
799-
content:
800-
application/json:
801-
schema:
802-
type: array
803-
items:
804-
properties:
805-
version_UUID:
806-
type: string
807-
version_number:
808-
type: integer
809-
report_id:
810-
type: string
811-
phone_upload_time:
812-
type: string
813-
format: date-time
814-
creation_time:
815-
type: string
816-
format: date-time
817-
version_time:
818-
type: string
819-
format: date-time
820-
type:
821-
type: string
822-
location_choice:
823-
type: string
824-
current_location_lon:
825-
type: number
826-
current_location_lat:
827-
type: number
828-
selected_location_lon:
829-
type: number
830-
selected_location_lat:
831-
type: number
832-
note:
833-
type: string
834-
package_name:
835-
type: string
836-
package_version:
837-
type: integer
838-
device_manufacturer:
839-
type: string
840-
device_model:
841-
type: string
842-
os:
843-
type: string
844-
os_version:
845-
type: string
846-
os_language:
847-
type: string
848-
app_language:
849-
type: string
850-
responses:
851-
type: array
852-
items:
853-
properties:
854-
question:
855-
type: string
856-
description: Question that the user responded to.
857-
maxLength: 1000
858-
answer:
859-
type: string
860-
description: Answer that user selected.
861-
maxLength: 1000
862-
question_id:
863-
type: integer
864-
maximum: 2147483647
865-
minimum: -2147483648
866-
nullable: true
867-
description: Numeric identifier of the question.
868-
answer_id:
869-
type: integer
870-
maximum: 2147483647
871-
minimum: -2147483648
872-
nullable: true
873-
description: Numeric identifier of the answer.
874-
answer_value:
875-
type: string
876-
nullable: true
877-
description: 'The value right now can contain 2 things:
878-
an integer representing the number or bites, or either
879-
a WKT representation of a point for a location answer.
880-
In all other cases, it will be blank'
881-
maxLength: 1000
882-
required:
883-
- question
884-
- answer
885-
server_upload_time:
886-
type: string
887-
format: date-time
888-
readOnly: true
889-
description: Date and time on server when report uploaded. (Automatically
890-
generated by server.)
891-
hide:
892-
type: boolean
893-
description: Hide this report from public views?
894-
cached_visible:
895-
type: integer
896-
maximum: 2147483647
897-
minimum: -2147483648
898-
nullable: true
899-
description: Precalculated value of show_on_map_function
900-
point:
901-
type: string
902-
nullable: true
903-
user:
904-
type: string
905-
description: user_UUID for the user sending this report. Must
906-
be exactly 36 characters (32 hex digits plus 4 hyphens) and
907-
user must have already registered this ID.
908-
mission:
909-
type: integer
910-
nullable: true
911-
description: If this report was a response to a mission, the
912-
unique id field of that mission.
913-
country:
914-
type: string
915-
nullable: true
916-
session:
917-
type: integer
918-
nullable: true
919-
description: 'Session ID for session in which this report was
920-
created '
921-
description: ''
922774
/api/stats/workload_data/user/:
923775
get:
924776
operationId: listworkload_stats_per_users

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/$', views.profile_detail),
6665
url('clear_blocked/(?P<username>[\w.@+-]+)/$', views.clear_blocked),
6766
url('clear_blocked_r/(?P<username>[\w.@+-]+)/(?P<report>[\w-]+)/$', views.clear_blocked),
6867
url('clear_blocked_all/$', views.clear_blocked_all),

tigaserver_app/views.py

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import calendar
1717
import json
1818
from operator import attrgetter
19-
from tigaserver_app.serializers import NotificationSerializer, NotificationContentSerializer, UserSerializer, ReportSerializer, MissionSerializer, PhotoSerializer, FixSerializer, ConfigurationSerializer, MapDataSerializer, SiteMapSerializer, CoverageMapSerializer, CoverageMonthMapSerializer, TagSerializer, NearbyReportSerializer, ReportIdSerializer, UserAddressSerializer, TigaProfileSerializer, DetailedTigaProfileSerializer, SessionSerializer, DetailedReportSerializer, OWCampaignsSerializer, OrganizationPinsSerializer, AcknowledgedNotificationSerializer, UserSubscriptionSerializer, CoarseReportSerializer
19+
from tigaserver_app.serializers import NotificationSerializer, NotificationContentSerializer, UserSerializer, ReportSerializer, MissionSerializer, PhotoSerializer, FixSerializer, ConfigurationSerializer, MapDataSerializer, SiteMapSerializer, CoverageMapSerializer, CoverageMonthMapSerializer, TagSerializer, NearbyReportSerializer, ReportIdSerializer, UserAddressSerializer, TigaProfileSerializer, SessionSerializer, OWCampaignsSerializer, OrganizationPinsSerializer, AcknowledgedNotificationSerializer, UserSubscriptionSerializer, CoarseReportSerializer
2020
from tigaserver_app.models import Notification, NotificationContent, TigaUser, Mission, Report, Photo, Fix, Configuration, CoverageArea, CoverageAreaMonth, TigaProfile, Session, ExpertReportAnnotation, OWCampaigns, OrganizationPin, SentNotification, AcknowledgedNotification, NotificationTopic, UserSubscription, EuropeCountry, Categories, ReportResponse
2121
from tigacrafting.models import FavoritedReports
2222
from tigacrafting.report_queues import assign_crisis_report
@@ -1949,34 +1949,6 @@ def clear_blocked(request, username, report=None):
19491949
return Response(status=status.HTTP_200_OK)
19501950

19511951

1952-
@api_view(['GET'])
1953-
def profile_detail(request):
1954-
if request.method == 'GET':
1955-
firebase_token = request.query_params.get('fbt', -1)
1956-
uuid = request.query_params.get('usr_uuid', -1)
1957-
if firebase_token == -1:
1958-
if uuid == -1:
1959-
raise ParseError(detail='either firebase token or usr_uuid are mandatory')
1960-
else:
1961-
user = get_object_or_404(TigaUser,user_UUID=uuid)
1962-
reports = Report.objects.filter(user=user).exclude(type='bite').exclude(type='mission')
1963-
serializer = DetailedReportSerializer(reports, many=True)
1964-
return Response(serializer.data, status=status.HTTP_200_OK)
1965-
else:
1966-
profile = get_object_or_404(TigaProfile.objects,firebase_token=firebase_token)
1967-
serializer = DetailedTigaProfileSerializer(profile)
1968-
1969-
#This is probably very wrong. We filter a copy of the serialized data to exclude missions
1970-
copied_data = copy.deepcopy(serializer.data)
1971-
for device in copied_data['profile_devices']:
1972-
for idx, report in reversed(list(enumerate(device['user_reports']))):
1973-
if report['type'] == 'mission':
1974-
del device['user_reports'][idx]
1975-
r = Report.objects.get(pk=report['version_UUID'])
1976-
1977-
return Response(copied_data, status=status.HTTP_200_OK)
1978-
1979-
19801952
@api_view(['GET'])
19811953
def reports_id_filtered(request):
19821954
if request.method == 'GET':

0 commit comments

Comments
 (0)