Skip to content

Commit 9571adf

Browse files
committed
Added get matches route
1 parent 9282926 commit 9571adf

File tree

3 files changed

+64
-18
lines changed

3 files changed

+64
-18
lines changed

PyMatcha.postman_collection.json

Lines changed: 50 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4095,6 +4095,38 @@
40954095
}
40964096
},
40974097
"response": []
4098+
},
4099+
{
4100+
"name": "Get user matches",
4101+
"event": [
4102+
{
4103+
"listen": "test",
4104+
"script": {
4105+
"id": "98be5051-980e-46c1-96bd-0c5219fd0cfa",
4106+
"exec": [
4107+
"var response = JSON.parse(responseBody);",
4108+
"",
4109+
"tests[\"Matches length != 0\"] = response.matches.length != 0",
4110+
""
4111+
],
4112+
"type": "text/javascript"
4113+
}
4114+
}
4115+
],
4116+
"request": {
4117+
"method": "GET",
4118+
"header": [],
4119+
"url": {
4120+
"raw": "{{host}}/matches",
4121+
"host": [
4122+
"{{host}}"
4123+
],
4124+
"path": [
4125+
"matches"
4126+
]
4127+
}
4128+
},
4129+
"response": []
40984130
}
40994131
],
41004132
"protocolProfileBehavior": {}
@@ -4257,109 +4289,109 @@
42574289
],
42584290
"variable": [
42594291
{
4260-
"id": "28a23486-a04f-4122-83dd-7876ef955760",
4292+
"id": "0f90f46f-1dea-4663-9b0a-96782a775bc6",
42614293
"key": "host",
42624294
"value": "http://127.0.0.1:5000",
42634295
"type": "string"
42644296
},
42654297
{
4266-
"id": "5f84e9ec-b6ef-4677-9c5b-55d4fdfce50b",
4298+
"id": "f69c5291-22cd-43de-8505-7e8c4bdfaa77",
42674299
"key": "user_id",
42684300
"value": "",
42694301
"type": "string"
42704302
},
42714303
{
4272-
"id": "2050da02-1090-484a-a476-7094e90d6d1a",
4304+
"id": "ae238981-115c-490b-9ae9-f149dc8ff0ca",
42734305
"key": "user_email",
42744306
"value": "foo@example.org",
42754307
"type": "string"
42764308
},
42774309
{
4278-
"id": "860f9ba6-0925-4cb1-95c9-a97242b5fd9b",
4310+
"id": "9f499eb6-f2ff-4104-b411-1ed740c08a71",
42794311
"key": "user_username",
42804312
"value": "foo",
42814313
"type": "string"
42824314
},
42834315
{
4284-
"id": "c77043d9-6185-4fc1-b683-174505689ad3",
4316+
"id": "ddd538ac-a6ec-4fd0-828c-9c3aa8f605cc",
42854317
"key": "user_password",
42864318
"value": "admin",
42874319
"type": "string"
42884320
},
42894321
{
4290-
"id": "d81b203b-9f7f-43ff-b6d4-712b935d893f",
4322+
"id": "9b833c1c-0e30-4994-b438-93e747e4a86a",
42914323
"key": "user_firstname",
42924324
"value": "Foo",
42934325
"type": "string"
42944326
},
42954327
{
4296-
"id": "ea2ca3b3-5f0e-4bba-9aac-ead08085e0bb",
4328+
"id": "82b74708-71be-4819-b785-c1fd859fc49a",
42974329
"key": "user_lastname",
42984330
"value": "Bar",
42994331
"type": "string"
43004332
},
43014333
{
4302-
"id": "ff0c8637-acc0-41d1-bc2f-e7e82d4ae088",
4334+
"id": "b5f5abf3-a625-4d6b-a287-25d5f24c1752",
43034335
"key": "debug_token",
43044336
"value": "xX69jules69Xx",
43054337
"type": "string"
43064338
},
43074339
{
4308-
"id": "94f1a459-158b-46e3-a78d-78e84507c291",
4340+
"id": "bd7410a6-e043-4fcb-a4c7-6caca10fd8cd",
43094341
"key": "user_access_token",
43104342
"value": "",
43114343
"type": "string"
43124344
},
43134345
{
4314-
"id": "283378eb-bf66-41f9-8ac0-54a2e4578e7f",
4346+
"id": "45754bea-5c43-47a1-94de-4c6d74bafcbe",
43154347
"key": "user_refresh_token",
43164348
"value": "",
43174349
"type": "string"
43184350
},
43194351
{
4320-
"id": "4202671c-ac1f-45df-9861-00b5f1d0faec",
4352+
"id": "b727953d-1cb9-47f6-93eb-5c98e5c3dc0f",
43214353
"key": "expired_token",
43224354
"value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1OTAyNDIyNjQsIm5iZiI6MTU5MDI0MjI2NCwianRpIjoiNTM0ZGI5NzQtOWE4Ni00MGViLWE1NDEtMDg3N2ZmNzQ3NDVhIiwiZXhwIjoxNTkwMjQyMzI0LCJpZGVudGl0eSI6eyJpZCI6NTEyLCJlbWFpbCI6ImZvb0BleGFtcGxlLm9yZyIsInVzZXJuYW1lIjoiYmFyIiwiaXNfb25saW5lIjp0cnVlLCJkYXRlX2xhc3RzZWVuIjoiU2F0LCAyMyBNYXkgMjAyMCAxMzo1Nzo0NCBHTVQifSwiZnJlc2giOnRydWUsInR5cGUiOiJhY2Nlc3MifQ.NTp2P0WNkXDwzuzrcNIQdeAfizQ57HQgkzBLSvY1yHU",
43234355
"type": "string"
43244356
},
43254357
{
4326-
"id": "d93bf868-d915-4b0f-9a40-13542742acb8",
4358+
"id": "8d73e461-be05-4fda-9759-eefd4723ae74",
43274359
"key": "user_orientation",
43284360
"value": "heterosexual",
43294361
"type": "string"
43304362
},
43314363
{
4332-
"id": "e8511aa0-b6a1-4946-bc68-1a637277989e",
4364+
"id": "abbbfd7b-452c-48ab-a34b-c5ba746f77ed",
43334365
"key": "user_bio",
43344366
"value": "Lorem Ipsum is the single greatest threat. We are not - we are not keeping up with other websites. Lorem Ipsum best not make any more threats to your website. It will be met with fire and fury like the world has never seen. Does everybody know that pig named Lorem Ipsum? An ‘extremely credible source’ has called my office and told me that Barack Obama’s placeholder text is a fraud.",
43354367
"type": "string"
43364368
},
43374369
{
4338-
"id": "711df570-f4d8-4253-9bb3-90f6428a2923",
4370+
"id": "981e543d-c66d-4e08-95aa-8f1f56446b0d",
43394371
"key": "user_gender",
43404372
"value": "male",
43414373
"type": "string"
43424374
},
43434375
{
4344-
"id": "2c1e8e72-e272-472c-a316-a4e2d32feb52",
4376+
"id": "8159bc19-4baa-457a-8557-ebfd55fde080",
43454377
"key": "user_birthdate",
43464378
"value": "06/04/1998",
43474379
"type": "string"
43484380
},
43494381
{
4350-
"id": "55317914-201d-40d6-923a-e250a0733436",
4382+
"id": "c3843867-8386-4507-ac5c-51957c1d698d",
43514383
"key": "user_lat",
43524384
"value": "44.8404",
43534385
"type": "string"
43544386
},
43554387
{
4356-
"id": "82fe60ef-d805-4317-ba54-a511524ba7ac",
4388+
"id": "e948632b-4a2a-4bd9-b142-daf0ccdc7c52",
43574389
"key": "user_lng",
43584390
"value": "-0.5805",
43594391
"type": "string"
43604392
},
43614393
{
4362-
"id": "e5163790-a8e8-482e-aafa-567565e5b0a8",
4394+
"id": "c9049a3d-e2e2-4907-ab32-4e94cc4d1698",
43634395
"key": "user_ip",
43644396
"value": "77.205.46.181",
43654397
"type": "string"

backend/PyMatcha/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ def check_if_token_is_revoked(decrypted_token):
196196
from PyMatcha.routes.api.profile.complete import profile_complete_bp
197197
from PyMatcha.routes.api.profile.report import profile_report_bp
198198
from PyMatcha.routes.api.like import like_bp
199+
from PyMatcha.routes.api.match import match_bp
199200

200201
logging.debug("Registering Flask blueprints")
201202
application.register_blueprint(ping_pong_bp)
@@ -209,6 +210,7 @@ def check_if_token_is_revoked(decrypted_token):
209210
application.register_blueprint(profile_complete_bp)
210211
application.register_blueprint(profile_report_bp)
211212
application.register_blueprint(like_bp)
213+
application.register_blueprint(match_bp)
212214

213215
if application.debug:
214216
logging.debug("Registering debug route")
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from flask import Blueprint
2+
from flask_jwt_extended import current_user
3+
from flask_jwt_extended import jwt_required
4+
from PyMatcha.utils.success import SuccessOutput
5+
6+
match_bp = Blueprint("matches", __name__)
7+
8+
9+
@match_bp.route("/matches", methods=["GET"])
10+
@jwt_required
11+
def get_user_matches():
12+
return SuccessOutput("matches", [m.to_dict() for m in current_user.get_matches()])

0 commit comments

Comments
 (0)