From 9f487a4d68a0920ee2a3f405fa1c9d571cc7c8bb Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 8 Feb 2020 14:49:37 +0100 Subject: [PATCH] API & Client - remove id in user data --- docs/_sources/api/auth.rst.txt | 2 +- docs/api/auth.html | 2 -- docs/api/users.html | 13 ++++---- docs/http-routingtable.html | 4 +-- docs/objects.inv | Bin 842 -> 840 bytes docs/searchindex.js | 2 +- docsrc/source/api/auth.rst | 2 +- .../fittrackee_api/tests/test_users_api.py | 4 +-- .../fittrackee_api/tests/test_users_model.py | 1 - fittrackee_api/fittrackee_api/users/auth.py | 28 +++++++++--------- fittrackee_api/fittrackee_api/users/models.py | 1 - fittrackee_api/fittrackee_api/users/users.py | 15 ++++------ .../src/components/Admin/Users/index.jsx | 17 +++++++++-- .../src/components/NavBar/index.jsx | 5 ++-- .../src/components/User/ProfileDetail.jsx | 2 +- .../src/components/User/UserProfile.jsx | 2 +- 16 files changed, 50 insertions(+), 50 deletions(-) diff --git a/docs/_sources/api/auth.rst.txt b/docs/_sources/api/auth.rst.txt index c5c7dc6e..7d1e2037 100644 --- a/docs/_sources/api/auth.rst.txt +++ b/docs/_sources/api/auth.rst.txt @@ -6,7 +6,7 @@ Authentication auth.register_user, auth.login_user, auth.logout_user, - auth.get_user_status, + auth.get_authenticated_user_profile, auth.edit_user, auth.edit_picture, auth.del_picture diff --git a/docs/api/auth.html b/docs/api/auth.html index 652fb16b..6b6d0f60 100644 --- a/docs/api/auth.html +++ b/docs/api/auth.html @@ -316,7 +316,6 @@ "created_at": "Sun, 14 Jul 2019 14:09:58 GMT", "email": "sam@example.com", "first_name": null, - "id": 2, "language": "en", "last_name": null, "location": null, @@ -379,7 +378,6 @@ "created_at": "Sun, 14 Jul 2019 14:09:58 GMT", "email": "sam@example.com", "first_name": null, - "id": 2, "language": "en", "last_name": null, "location": null, diff --git a/docs/api/users.html b/docs/api/users.html index 9630c322..81984f2d 100644 --- a/docs/api/users.html +++ b/docs/api/users.html @@ -148,7 +148,6 @@ "created_at": "Sun, 14 Jul 2019 14:09:58 GMT", "email": "admin@example.com", "first_name": null, - "id": 1, "language": "en", "last_name": null, "location": null, @@ -172,7 +171,6 @@ "created_at": "Sat, 20 Jul 2019 11:27:03 GMT", "email": "sam@example.com", "first_name": null, - "id": 2, "language": "fr", "last_name": null, "location": null, @@ -221,7 +219,7 @@ GET /api/users/(user_name)

Get single user details

Example request:

-
GET /api/users/1 HTTP/1.1
+
GET /api/users/admin HTTP/1.1
 Content-Type: application/json
 
@@ -238,7 +236,6 @@ "created_at": "Sun, 14 Jul 2019 14:09:58 GMT", "email": "admin@example.com", "first_name": null, - "id": 1, "language": "en", "last_name": null, "location": null, @@ -291,11 +288,11 @@
-
-GET /api/users/(user_id)/picture
+
+GET /api/users/(user_name)/picture

get user picture

Example request:

-
GET /api/users/1/picture HTTP/1.1
+
GET /api/users/admin/picture HTTP/1.1
 Content-Type: application/json
 
@@ -307,7 +304,7 @@
Parameters
    -
  • user_id (integer) – user id

  • +
  • user_name (integer) – user name

Status Codes
diff --git a/docs/http-routingtable.html b/docs/http-routingtable.html index df318575..ea792a56 100644 --- a/docs/http-routingtable.html +++ b/docs/http-routingtable.html @@ -217,12 +217,12 @@ - GET /api/users/(user_id)/picture + GET /api/users/(user_name) - GET /api/users/(user_name) + GET /api/users/(user_name)/picture diff --git a/docs/objects.inv b/docs/objects.inv index a2cab175e3707bd29f8a4182be1fd8f9561f25d1..91a9a6994ac04311005a4b1c64f51dfa66bb3960 100644 GIT binary patch delta 725 zcmV;`0xJE=2FM1Ge}BP_+aM5z?|urTUa|*j^_ttN(n@=%wCZlp5wRyWstpz%SDUvl z7_c!oS*M#`A~XE|$1sL*a@O&j70CZ^i*N`~w%8>9j6w&n94sul!VksI8t@IhYGv8^avXiLIX_kN#*3~1wm|G6}JgJx6JXw=^BZ*t z=y-vHg0*%vL4OvF%5c2tB52EIRv}8BcmrGaKiBx7B4bcHwt74H$$cGTo> zm_mvZui`D)=%5&KDWbhO$BIAfyDNmC^)4A57fA*~4=TP0qt1C06jGJRXV!%yqZd1G z-${ju)kY(ylP-*|m6+$XdwhlCTEyi17#o%}1P8Uej(L>jvpa8bg0>>Pt` z(U)hUXMYCs5uIKB0!O~^wv(TBkOen9k_Q)vypGS=bchn|bh5~+Nu<|xuyT7!BKiE< z$S?Dl>Hkck0{uw~l~d4FXB-ke&Q8G03te!1%!;4fD62rsMQqp+8YA{mD}FYQSyJmj z@x<{>vEny?mg&tlP4Z5|xW~?std-?T9^IMx2~O+zAOENfqXKRp?Gt7)r=VomK^w^tPNzSmq#HLz(&coMe9i HA~78w(#~_% delta 727 zcmV;|0x12+2FeDIe}6r1+b|G@cm4_jU7Udxx@HRs1jtYzXwuoBrL#m-5(Vm1B>%po z_+g5a9l3EALp;9k!{doOx!{8+c!}bVKmj9d5QqC3kba}fnXe6Y?H4`6n4Vyfg^^+n zGRW~9#Y}ySDR!dAdpCaHi|WpTD`)}X4BAenaAr_!f!e&>Re#0!%t8alvN=~VGk2TC zin8Gf_Z3HelMS+ncir;E2z3WNT9F&vtng7@%(1N~UT90g_3(C^gbZlog8#WRdWCCh z(($3#>7Rd1KwDYx=lEXkLyfQO8q9e;bi$@+Wi9%grl&HFjxj4w0CK`?qXBT*qVpSd z3>ZX-lY+H&6@MU$MrAnObQZK_Gpi6KkD`UG`|L;;n+E0VD;HoIb+f?A9SYC9@8 z9Hx~0QPk;{Y;;l_h3u2PIme1W?z=05sP!%xgXpsirV&(n5oVq9C@7_>vd^pwCq^%J z-f@r$GpmgzPA6R$T`MuqYxnp9$F+#y{1_XTGzLetynl>F?#ZU2b5}gP?`K_>xY4G0 zo0w&LKMVfLYoO@h6HCnY#R|M_xATnHx#y#_<$PIT>?(F)M~e=!fy06|?Ikg}=N;T# z%d{p&l0SIO^dXFi?+}^AcMbZWpY&%;l=J;1*^N$}`E{q?>WVMpV@KDbDg!TN8)ucawHlq=^Dx0Ol#$2iG z{4=kCppw&}g|U$mb<;0+)rnre2Yr~Niu1fEbf+o~W#p_*s{%`UT~1{za}X|}%>3z` JkiQKK8+V$~Zzcc$ diff --git a/docs/searchindex.js b/docs/searchindex.js index 938d9fb2..6d28629d 100644 --- a/docs/searchindex.js +++ b/docs/searchindex.js @@ -1 +1 @@ -Search.setIndex({docnames:["api/activities","api/auth","api/configuration","api/index","api/records","api/sports","api/stats","api/users","changelog","features","index","installation","troubleshooting/administrator","troubleshooting/index","troubleshooting/user"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,sphinx:56},filenames:["api/activities.rst","api/auth.rst","api/configuration.rst","api/index.rst","api/records.rst","api/sports.rst","api/stats.rst","api/users.rst","changelog.md","features.rst","index.rst","installation.rst","troubleshooting/administrator.rst","troubleshooting/index.rst","troubleshooting/user.rst"],objects:{"":{"/api/activities":[0,1,1,"post--api-activities"],"/api/activities/(int:activity_id)":[0,3,1,"patch--api-activities-(int-activity_id)"],"/api/activities/(int:activity_id)/chart_data":[0,0,1,"get--api-activities-(int-activity_id)-chart_data"],"/api/activities/(int:activity_id)/chart_data/segment/(int:segment_id)":[0,0,1,"get--api-activities-(int-activity_id)-chart_data-segment-(int-segment_id)"],"/api/activities/(int:activity_id)/gpx":[0,0,1,"get--api-activities-(int-activity_id)-gpx"],"/api/activities/(int:activity_id)/gpx/segment/(int:segment_id)":[0,0,1,"get--api-activities-(int-activity_id)-gpx-segment-(int-segment_id)"],"/api/activities/map/(map_id)":[0,0,1,"get--api-activities-map-(map_id)"],"/api/activities/no_gpx":[0,1,1,"post--api-activities-no_gpx"],"/api/auth/login":[1,1,1,"post--api-auth-login"],"/api/auth/logout":[1,0,1,"get--api-auth-logout"],"/api/auth/picture":[1,1,1,"post--api-auth-picture"],"/api/auth/profile":[1,0,1,"get--api-auth-profile"],"/api/auth/profile/edit":[1,1,1,"post--api-auth-profile-edit"],"/api/auth/register":[1,1,1,"post--api-auth-register"],"/api/config":[2,3,1,"patch--api-config"],"/api/ping":[7,0,1,"get--api-ping"],"/api/records":[4,0,1,"get--api-records"],"/api/sports":[5,0,1,"get--api-sports"],"/api/sports/(int:sport_id)":[5,3,1,"patch--api-sports-(int-sport_id)"],"/api/stats/(int:user_id)/by_sport":[6,0,1,"get--api-stats-(int-user_id)-by_sport"],"/api/stats/(int:user_id)/by_time":[6,0,1,"get--api-stats-(int-user_id)-by_time"],"/api/stats/all":[6,0,1,"get--api-stats-all"],"/api/users":[7,0,1,"get--api-users"],"/api/users/(user_id)/picture":[7,0,1,"get--api-users-(user_id)-picture"],"/api/users/(user_name)":[7,0,1,"get--api-users-(user_name)"]}},objnames:{"0":["http","get","HTTP get"],"1":["http","post","HTTP post"],"2":["http","delete","HTTP delete"],"3":["http","patch","HTTP patch"]},objtypes:{"0":"http:get","1":"http:post","2":"http:delete","3":"http:patch"},terms:{"0mb":[0,1],"10mb":11,"1mb":11,"2e1ee2c":8,"34614d5":8,"4c3fc34":8,"boolean":2,"default":[0,6,11],"export":10,"float":0,"int":[0,5,6],"null":[0,1,7],"return":[0,4],"static":11,"true":[1,2,5,7,11],"try":[0,1],For:11,NOT:[0,1,5],Not:[0,1,5,6,7],That:1,The:[8,9,11],Use:8,accord:10,account:[8,9],acit:0,activ:[3,5,6,8,10],activity_d:[0,4],activity_id:[0,4],adapt:11,add:[8,9,10],admin:[1,2,5,7,8,9,11],administr:[0,1,8,9,10,13],again:[0,1,2,4,5,6,7],all:[4,5,6,7,11],allow:[0,1,2,10,11],alpinequest:10,alreadi:1,also:10,android:10,anymor:8,api:[0,1,2,4,5,6,7,8,9,10,11,12],app:[10,11],applic:[0,1,2,4,5,6,7,10,11],arch:11,archiv:[2,11],archlinux:11,ascent:0,auth:[0,1,2,4,5,6,7],auth_token:1,auth_user_id:[0,2,4,5,6,7],authent:[0,2,3,4,5,6,7,10],author:[0,1,2,4,5,6,7],avail:[4,9,10],ave_spe:0,ave_speed_from:0,ave_speed_to:0,averag:[0,4,8,9],b862a77:8,background:8,backup:11,bad:[0,1,2,5],bearer:[0,1,2,4,5,6,7],befor:11,beta:11,bike:[0,5,8,9],bio:[1,7],biographi:1,birth:1,birth_dat:[1,7],bound:0,build:11,by_sport:6,by_tim:6,calcul:8,calendar:[8,9],can:[8,9,10,11],cannot:8,chang:[9,10,11],charact:[1,13],chart:[0,8,9,11],chart_data:0,check:[7,12],choos:8,client:[8,11,12],clone:11,code:[0,1,2,4,5,6,7],color:8,column:13,com:[1,7,11],config:[2,11,12],configur:[3,10],confirm:1,contact:[0,1],contain:8,content:[0,1,2,4,5,6,7],coordin:11,copi:11,correctli:[8,12],creat:[0,1,8,9],created_at:[1,7],creation:[8,9],creation_d:0,credenti:1,current:8,custom:[11,12],cycl:[5,8,9],dai:8,dark:11,darkski:[8,9,11],dashboard:[8,10],data:[0,1,2,4,5,6,7,8,10,11,13],databas:11,date:[0,1,6,8,9],debian:11,defaut:11,defin:11,definit:8,delet:[0,1,8,9],depend:8,desc:0,descent:0,describ:11,descript:11,detail:[7,8,10],develop:10,differ:8,directori:11,disabl:[1,8,9],displai:[0,8,9,10,11],distanc:[0,4,8,9],distance_from:0,distance_to:0,document:[8,10,11],doe:[0,1,6,7,8],don:1,down:8,download:11,drop:8,durat:[0,4,8,9],duration_from:0,duration_to:0,dure:[0,1],edit:[1,8,9],elev:[0,8,9,11],email:[1,7,11],empti:8,enabl:2,encount:11,end:[0,6],endpoint:[3,7,13],english:9,enter:[8,9],entiti:[0,1],environ:10,environn:12,error:[0,1,2,5,8],europ:[1,7],even:[8,9],exampl:[0,1,2,4,5,6,7,10,11,12],exce:[0,1],exist:[0,1,6,7,10,12],exodu:10,expir:[0,1,2,4,5,6,7],extens:[0,1],fa33f4d996844a5c73ecd1ae24456ab8:0,fals:[0,1,2,5,7],farest:[4,8,9],featur:10,fetch:11,file:[0,1,2,8,9,10,11,12],filter:[8,9],first:[1,10],first_nam:[1,7],fittracke:[9,11],fittrackee_api:11,fix:10,flask:11,flaticon:11,follow:[4,11],forbidden:[0,1,2,5,6],forecast:11,form:[0,1],format:[0,1,6],former:11,forrunn:10,found:[0,1,5,6,7],frame:6,freepik:11,french:[9,10],fri:0,from:[0,2,4,5,6,7,10,11],gener:11,get:[0,1,2,4,5,6,7],gif:1,git:11,github:11,gmt:[0,1,4,7],gpl:10,gpx:[0,8,9,10,11],gpx_limit_import:2,gpxpy:11,has_act:5,have:[0,2,5,6,8],header:[0,1,2,4,5,6,7],health:7,hike:[5,8,9],his:[8,9],http:[0,1,2,4,5,6,7,11,12],i18n:8,icon:11,imag:[0,1,7,11],img:5,improv:10,incorrect:8,info:1,inform:[8,10],initi:[11,12],instal:10,instanc:[2,11],integ:[0,2,4,5,6,7],integr:2,interceptor:8,intern:[0,1,2,5],invalid:[0,1,2,4,5,6,7],is_act:5,is_registration_en:2,issu:[10,11],jan:0,javascript:11,jpeg:7,jpg:1,json:[0,1,2,4,5,6,7,13],jul:[0,1,4,7],keep:10,kei:[8,9,11],label:5,languag:[1,7],larg:[0,1],last:[1,11],last_nam:[1,7],latitud:0,leaflet:[0,11],least:0,limit:8,line:13,linux:11,list:[8,10],load:8,local:[8,10],localhost:[11,12],locat:[1,7],log:[0,1,2,4,5,6,7,10,11],login:[1,11],logout:[1,8],longest:[4,8,9],longitud:0,made:[11,12],mai:11,make:11,makefil:[11,12],manag:8,mandatori:[0,11],map:[0,8,9,10,11],map_id:0,match:1,max:[0,2,11],max_alt:0,max_single_file_s:2,max_spe:0,max_speed_from:0,max_speed_to:0,max_us:2,max_zip_file_s:2,maxim:0,maximum:[4,8,9],mean:12,messag:[0,1,7],min_alt:0,minim:0,minor:10,mobil:10,modification_d:0,mon:0,mondai:[1,6,9],montain:[8,9],month:[6,8,9],more:[8,10],morn:0,mountain:5,mous:8,move:[0,8],mpwoadmin:11,multipart:[0,1],must:[1,2,5,8,9,11],name:[1,7],nb_activ:[1,6,7],nb_sport:[1,7],necessari:11,need:11,network:12,next_act:0,no_gpx:0,non:5,note:[0,8,9,11],now:[8,9,11],number:[0,2,11],oauth:[0,1,2,4,5,6,7],object:[0,1,2,5],one:0,onli:[0,8,9],open:[10,11],option:11,order:0,other:11,out:1,outdoor:10,over:8,own:10,owner:[8,9],packag:[8,11],page:0,pagin:0,paramet:[0,1,2,4,5,6,7],pari:[1,7],pars:[11,13],part:[0,1],password:[1,11],password_conf:1,past:11,patch:[0,2,5],paus:[0,8],payload:[0,1,2,5],per:0,per_pag:0,permiss:[0,2,5,6],pg_dump:11,pictur:[0,1,7,11],ping:7,pipenv:8,pleas:[0,1,2,4,5,6,7],png:[0,1,5],poetri:[8,11],point:8,pong:7,possibl:10,post:[0,1],postgresql:11,prefer:1,prerequisit:10,previous_act:0,privai:10,product:[10,11],profil:1,project:11,proprietari:10,provid:[0,1,2,4,5,6,7,8,9],pull:11,python:[8,11],queri:[0,6],react:11,react_app_allow_registr:11,react_app_api_url:12,react_app_gpx_limit_import:11,react_app_max_single_file_s:11,react_app_max_zip_file_s:11,react_app_thunderforest_api_kei:11,readi:[10,11],rebuild:12,rechart:[0,11],record:[0,3,8,9,10],record_typ:[0,4],redux:11,regist:[1,2,11],registr:[1,2,8,9],relat:11,releas:[10,11],replac:8,repo:11,report:10,repositori:11,request:[0,1,2,4,5,6,7,12],requir:1,respons:[0,1,2,4,5,6,7],restart:11,rout:8,run:[5,8,9,11],runner:10,sam:[1,7],same:8,samr1:11,sat:7,save:9,search:8,second:0,see:[8,9,10,11,12],segment:[0,8,9],segment_id:0,select:[0,1],serv:11,server:[0,1,2,5,10,11],set:[9,11],sever:10,show:8,side:8,signatur:[0,1,2,4,5,6,7],simplifi:8,sinc:11,singl:[2,7],size:[0,1,2,8,11],sky:11,some:[0,8,11],sorri:1,sort:0,speed:[0,4,8,9,11],spinner:8,sport:[0,3,6,8,9,10,11],sport_id:[0,4,5,6],sports_list:[1,7],standard:[8,9],start:[0,1,6,9,11],stat:[6,8],staticmap:11,statist:[3,10],statu:[0,1,2,4,5,6,7],step:11,still:10,stop:11,store:10,street:10,string:[0,1,5,6],success:[0,1,2,4,5,6,7],successfulli:1,sun:[0,1,4,7],sundai:[0,6,9],support:[8,9],system:11,tab:12,tar:11,test:11,than:8,them:10,thi:[0,8,10,11],thunderforest:11,time:[0,1,6,8,9],timezon:[1,7,8],titl:0,todo:[11,14],token:[0,1,2,4,5,6,7],too:[0,1],tooltip:8,total:8,total_dist:[1,6,7],total_dur:[1,6,7],track:10,tracker:10,transport:[5,8,9],troubleshoot:10,type:[0,1,2,4,5,6,7],unauthor:[0,1,2,4,5,6,7],undefin:12,under:10,unexpect:13,updat:[0,1,2,5,8,11],upgrad:10,upload:[8,9,11],url:8,user:[0,1,2,3,4,5,6,8,10,11,13],user_id:[0,4,6,7],user_nam:7,usernam:[1,7],usernanm:1,using:[0,10],valid:[0,1,2,4,5,6,7],valu:[0,4,11],variabl:[10,12],version:[10,11],view:8,virtualenv:11,walk:[5,8,9],weather:[8,9,11],weather_api:11,weather_end:0,weather_start:0,web:[0,1,2,4,5,6,7,10],week:[1,6,8,9],weekend:8,weekm:[1,6],were:8,wget:11,when:8,which:9,wiki:8,with_gpx:0,without:[0,6,8,9,10],workout:10,written:11,www:11,xzf:11,yaourt:11,yarn:11,year:6,yet:[10,11],you:[0,2,5,6,10],your:10,zip:[0,2,11],zone:1},titles:["Activities","Authentication","Configuration","API documentation","Records","Sports","Statistics","Users","Change log","Features","FitTrackee","Installation","Administrator","Troubleshooting","User"],titleterms:{"new":8,activ:[0,9],administr:12,api:3,authent:1,avail:8,bug:8,chang:8,charact:12,close:8,column:12,configur:2,content:10,dashboard:9,data:12,detail:9,dev:11,document:3,environ:11,featur:[8,9],first:8,fittracke:[8,10],fix:8,french:8,improv:8,instal:11,issu:8,json:12,line:12,list:9,log:8,minor:8,misc:8,pars:12,prerequisit:11,prod:11,record:4,releas:8,sport:5,statist:[6,8,9],tabl:10,translat:9,troubleshoot:13,unexpect:12,upgrad:11,user:[7,9,14],variabl:11,version:8,workout:9}}) \ No newline at end of file +Search.setIndex({docnames:["api/activities","api/auth","api/configuration","api/index","api/records","api/sports","api/stats","api/users","changelog","features","index","installation","troubleshooting/administrator","troubleshooting/index","troubleshooting/user"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,sphinx:56},filenames:["api/activities.rst","api/auth.rst","api/configuration.rst","api/index.rst","api/records.rst","api/sports.rst","api/stats.rst","api/users.rst","changelog.md","features.rst","index.rst","installation.rst","troubleshooting/administrator.rst","troubleshooting/index.rst","troubleshooting/user.rst"],objects:{"":{"/api/activities":[0,1,1,"post--api-activities"],"/api/activities/(int:activity_id)":[0,3,1,"patch--api-activities-(int-activity_id)"],"/api/activities/(int:activity_id)/chart_data":[0,0,1,"get--api-activities-(int-activity_id)-chart_data"],"/api/activities/(int:activity_id)/chart_data/segment/(int:segment_id)":[0,0,1,"get--api-activities-(int-activity_id)-chart_data-segment-(int-segment_id)"],"/api/activities/(int:activity_id)/gpx":[0,0,1,"get--api-activities-(int-activity_id)-gpx"],"/api/activities/(int:activity_id)/gpx/segment/(int:segment_id)":[0,0,1,"get--api-activities-(int-activity_id)-gpx-segment-(int-segment_id)"],"/api/activities/map/(map_id)":[0,0,1,"get--api-activities-map-(map_id)"],"/api/activities/no_gpx":[0,1,1,"post--api-activities-no_gpx"],"/api/auth/login":[1,1,1,"post--api-auth-login"],"/api/auth/logout":[1,0,1,"get--api-auth-logout"],"/api/auth/picture":[1,1,1,"post--api-auth-picture"],"/api/auth/profile":[1,0,1,"get--api-auth-profile"],"/api/auth/profile/edit":[1,1,1,"post--api-auth-profile-edit"],"/api/auth/register":[1,1,1,"post--api-auth-register"],"/api/config":[2,3,1,"patch--api-config"],"/api/ping":[7,0,1,"get--api-ping"],"/api/records":[4,0,1,"get--api-records"],"/api/sports":[5,0,1,"get--api-sports"],"/api/sports/(int:sport_id)":[5,3,1,"patch--api-sports-(int-sport_id)"],"/api/stats/(int:user_id)/by_sport":[6,0,1,"get--api-stats-(int-user_id)-by_sport"],"/api/stats/(int:user_id)/by_time":[6,0,1,"get--api-stats-(int-user_id)-by_time"],"/api/stats/all":[6,0,1,"get--api-stats-all"],"/api/users":[7,0,1,"get--api-users"],"/api/users/(user_name)":[7,0,1,"get--api-users-(user_name)"],"/api/users/(user_name)/picture":[7,0,1,"get--api-users-(user_name)-picture"]}},objnames:{"0":["http","get","HTTP get"],"1":["http","post","HTTP post"],"2":["http","delete","HTTP delete"],"3":["http","patch","HTTP patch"]},objtypes:{"0":"http:get","1":"http:post","2":"http:delete","3":"http:patch"},terms:{"0mb":[0,1],"10mb":11,"1mb":11,"2e1ee2c":8,"34614d5":8,"4c3fc34":8,"boolean":2,"default":[0,6,11],"export":10,"float":0,"int":[0,5,6],"null":[0,1,7],"return":[0,4],"static":11,"true":[1,2,5,7,11],"try":[0,1],For:11,NOT:[0,1,5],Not:[0,1,5,6,7],That:1,The:[8,9,11],Use:8,accord:10,account:[8,9],acit:0,activ:[3,5,6,8,10],activity_d:[0,4],activity_id:[0,4],adapt:11,add:[8,9,10],admin:[1,2,5,7,8,9,11],administr:[0,1,8,9,10,13],again:[0,1,2,4,5,6,7],all:[4,5,6,7,11],allow:[0,1,2,10,11],alpinequest:10,alreadi:1,also:10,android:10,anymor:8,api:[0,1,2,4,5,6,7,8,9,10,11,12],app:[10,11],applic:[0,1,2,4,5,6,7,10,11],arch:11,archiv:[2,11],archlinux:11,ascent:0,auth:[0,1,2,4,5,6,7],auth_token:1,auth_user_id:[0,2,4,5,6,7],authent:[0,2,3,4,5,6,7,10],author:[0,1,2,4,5,6,7],avail:[4,9,10],ave_spe:0,ave_speed_from:0,ave_speed_to:0,averag:[0,4,8,9],b862a77:8,background:8,backup:11,bad:[0,1,2,5],bearer:[0,1,2,4,5,6,7],befor:11,beta:11,bike:[0,5,8,9],bio:[1,7],biographi:1,birth:1,birth_dat:[1,7],bound:0,build:11,by_sport:6,by_tim:6,calcul:8,calendar:[8,9],can:[8,9,10,11],cannot:8,chang:[9,10,11],charact:[1,13],chart:[0,8,9,11],chart_data:0,check:[7,12],choos:8,client:[8,11,12],clone:11,code:[0,1,2,4,5,6,7],color:8,column:13,com:[1,7,11],config:[2,11,12],configur:[3,10],confirm:1,contact:[0,1],contain:8,content:[0,1,2,4,5,6,7],coordin:11,copi:11,correctli:[8,12],creat:[0,1,8,9],created_at:[1,7],creation:[8,9],creation_d:0,credenti:1,current:8,custom:[11,12],cycl:[5,8,9],dai:8,dark:11,darkski:[8,9,11],dashboard:[8,10],data:[0,1,2,4,5,6,7,8,10,11,13],databas:11,date:[0,1,6,8,9],debian:11,defaut:11,defin:11,definit:8,delet:[0,1,8,9],depend:8,desc:0,descent:0,describ:11,descript:11,detail:[7,8,10],develop:10,differ:8,directori:11,disabl:[1,8,9],displai:[0,8,9,10,11],distanc:[0,4,8,9],distance_from:0,distance_to:0,document:[8,10,11],doe:[0,1,6,7,8],don:1,down:8,download:11,drop:8,durat:[0,4,8,9],duration_from:0,duration_to:0,dure:[0,1],edit:[1,8,9],elev:[0,8,9,11],email:[1,7,11],empti:8,enabl:2,encount:11,end:[0,6],endpoint:[3,7,13],english:9,enter:[8,9],entiti:[0,1],environ:10,environn:12,error:[0,1,2,5,8],europ:[1,7],even:[8,9],exampl:[0,1,2,4,5,6,7,10,11,12],exce:[0,1],exist:[0,1,6,7,10,12],exodu:10,expir:[0,1,2,4,5,6,7],extens:[0,1],fa33f4d996844a5c73ecd1ae24456ab8:0,fals:[0,1,2,5,7],farest:[4,8,9],featur:10,fetch:11,file:[0,1,2,8,9,10,11,12],filter:[8,9],first:[1,10],first_nam:[1,7],fittracke:[9,11],fittrackee_api:11,fix:10,flask:11,flaticon:11,follow:[4,11],forbidden:[0,1,2,5,6],forecast:11,form:[0,1],format:[0,1,6],former:11,forrunn:10,found:[0,1,5,6,7],frame:6,freepik:11,french:[9,10],fri:0,from:[0,2,4,5,6,7,10,11],gener:11,get:[0,1,2,4,5,6,7],gif:1,git:11,github:11,gmt:[0,1,4,7],gpl:10,gpx:[0,8,9,10,11],gpx_limit_import:2,gpxpy:11,has_act:5,have:[0,2,5,6,8],header:[0,1,2,4,5,6,7],health:7,hike:[5,8,9],his:[8,9],http:[0,1,2,4,5,6,7,11,12],i18n:8,icon:11,imag:[0,1,7,11],img:5,improv:10,incorrect:8,info:1,inform:[8,10],initi:[11,12],instal:10,instanc:[2,11],integ:[0,2,4,5,6,7],integr:2,interceptor:8,intern:[0,1,2,5],invalid:[0,1,2,4,5,6,7],is_act:5,is_registration_en:2,issu:[10,11],jan:0,javascript:11,jpeg:7,jpg:1,json:[0,1,2,4,5,6,7,13],jul:[0,1,4,7],keep:10,kei:[8,9,11],label:5,languag:[1,7],larg:[0,1],last:[1,11],last_nam:[1,7],latitud:0,leaflet:[0,11],least:0,limit:8,line:13,linux:11,list:[8,10],load:8,local:[8,10],localhost:[11,12],locat:[1,7],log:[0,1,2,4,5,6,7,10,11],login:[1,11],logout:[1,8],longest:[4,8,9],longitud:0,made:[11,12],mai:11,make:11,makefil:[11,12],manag:8,mandatori:[0,11],map:[0,8,9,10,11],map_id:0,match:1,max:[0,2,11],max_alt:0,max_single_file_s:2,max_spe:0,max_speed_from:0,max_speed_to:0,max_us:2,max_zip_file_s:2,maxim:0,maximum:[4,8,9],mean:12,messag:[0,1,7],min_alt:0,minim:0,minor:10,mobil:10,modification_d:0,mon:0,mondai:[1,6,9],montain:[8,9],month:[6,8,9],more:[8,10],morn:0,mountain:5,mous:8,move:[0,8],mpwoadmin:11,multipart:[0,1],must:[1,2,5,8,9,11],name:[1,7],nb_activ:[1,6,7],nb_sport:[1,7],necessari:11,need:11,network:12,next_act:0,no_gpx:0,non:5,note:[0,8,9,11],now:[8,9,11],number:[0,2,11],oauth:[0,1,2,4,5,6,7],object:[0,1,2,5],one:0,onli:[0,8,9],open:[10,11],option:11,order:0,other:11,out:1,outdoor:10,over:8,own:10,owner:[8,9],packag:[8,11],page:0,pagin:0,paramet:[0,1,2,4,5,6,7],pari:[1,7],pars:[11,13],part:[0,1],password:[1,11],password_conf:1,past:11,patch:[0,2,5],paus:[0,8],payload:[0,1,2,5],per:0,per_pag:0,permiss:[0,2,5,6],pg_dump:11,pictur:[0,1,7,11],ping:7,pipenv:8,pleas:[0,1,2,4,5,6,7],png:[0,1,5],poetri:[8,11],point:8,pong:7,possibl:10,post:[0,1],postgresql:11,prefer:1,prerequisit:10,previous_act:0,privai:10,product:[10,11],profil:1,project:11,proprietari:10,provid:[0,1,2,4,5,6,7,8,9],pull:11,python:[8,11],queri:[0,6],react:11,react_app_allow_registr:11,react_app_api_url:12,react_app_gpx_limit_import:11,react_app_max_single_file_s:11,react_app_max_zip_file_s:11,react_app_thunderforest_api_kei:11,readi:[10,11],rebuild:12,rechart:[0,11],record:[0,3,8,9,10],record_typ:[0,4],redux:11,regist:[1,2,11],registr:[1,2,8,9],relat:11,releas:[10,11],replac:8,repo:11,report:10,repositori:11,request:[0,1,2,4,5,6,7,12],requir:1,respons:[0,1,2,4,5,6,7],restart:11,rout:8,run:[5,8,9,11],runner:10,sam:[1,7],same:8,samr1:11,sat:7,save:9,search:8,second:0,see:[8,9,10,11,12],segment:[0,8,9],segment_id:0,select:[0,1],serv:11,server:[0,1,2,5,10,11],set:[9,11],sever:10,show:8,side:8,signatur:[0,1,2,4,5,6,7],simplifi:8,sinc:11,singl:[2,7],size:[0,1,2,8,11],sky:11,some:[0,8,11],sorri:1,sort:0,speed:[0,4,8,9,11],spinner:8,sport:[0,3,6,8,9,10,11],sport_id:[0,4,5,6],sports_list:[1,7],standard:[8,9],start:[0,1,6,9,11],stat:[6,8],staticmap:11,statist:[3,10],statu:[0,1,2,4,5,6,7],step:11,still:10,stop:11,store:10,street:10,string:[0,1,5,6],success:[0,1,2,4,5,6,7],successfulli:1,sun:[0,1,4,7],sundai:[0,6,9],support:[8,9],system:11,tab:12,tar:11,test:11,than:8,them:10,thi:[0,8,10,11],thunderforest:11,time:[0,1,6,8,9],timezon:[1,7,8],titl:0,todo:[11,14],token:[0,1,2,4,5,6,7],too:[0,1],tooltip:8,total:8,total_dist:[1,6,7],total_dur:[1,6,7],track:10,tracker:10,transport:[5,8,9],troubleshoot:10,type:[0,1,2,4,5,6,7],unauthor:[0,1,2,4,5,6,7],undefin:12,under:10,unexpect:13,updat:[0,1,2,5,8,11],upgrad:10,upload:[8,9,11],url:8,user:[0,1,2,3,4,5,6,8,10,11,13],user_id:[0,4,6],user_nam:7,usernam:[1,7],usernanm:1,using:[0,10],valid:[0,1,2,4,5,6,7],valu:[0,4,11],variabl:[10,12],version:[10,11],view:8,virtualenv:11,walk:[5,8,9],weather:[8,9,11],weather_api:11,weather_end:0,weather_start:0,web:[0,1,2,4,5,6,7,10],week:[1,6,8,9],weekend:8,weekm:[1,6],were:8,wget:11,when:8,which:9,wiki:8,with_gpx:0,without:[0,6,8,9,10],workout:10,written:11,www:11,xzf:11,yaourt:11,yarn:11,year:6,yet:[10,11],you:[0,2,5,6,10],your:10,zip:[0,2,11],zone:1},titles:["Activities","Authentication","Configuration","API documentation","Records","Sports","Statistics","Users","Change log","Features","FitTrackee","Installation","Administrator","Troubleshooting","User"],titleterms:{"new":8,activ:[0,9],administr:12,api:3,authent:1,avail:8,bug:8,chang:8,charact:12,close:8,column:12,configur:2,content:10,dashboard:9,data:12,detail:9,dev:11,document:3,environ:11,featur:[8,9],first:8,fittracke:[8,10],fix:8,french:8,improv:8,instal:11,issu:8,json:12,line:12,list:9,log:8,minor:8,misc:8,pars:12,prerequisit:11,prod:11,record:4,releas:8,sport:5,statist:[6,8,9],tabl:10,translat:9,troubleshoot:13,unexpect:12,upgrad:11,user:[7,9,14],variabl:11,version:8,workout:9}}) \ No newline at end of file diff --git a/docsrc/source/api/auth.rst b/docsrc/source/api/auth.rst index c5c7dc6e..7d1e2037 100644 --- a/docsrc/source/api/auth.rst +++ b/docsrc/source/api/auth.rst @@ -6,7 +6,7 @@ Authentication auth.register_user, auth.login_user, auth.logout_user, - auth.get_user_status, + auth.get_authenticated_user_profile, auth.edit_user, auth.edit_picture, auth.del_picture diff --git a/fittrackee_api/fittrackee_api/tests/test_users_api.py b/fittrackee_api/fittrackee_api/tests/test_users_api.py index b641bb21..a294cacc 100644 --- a/fittrackee_api/fittrackee_api/tests/test_users_api.py +++ b/fittrackee_api/fittrackee_api/tests/test_users_api.py @@ -261,7 +261,7 @@ def test_decode_auth_token(app, user_1): def test_user_no_picture(app, user_1): client = app.test_client() - response = client.get('/api/users/1/picture') + response = client.get(f'/api/users/{user_1.username}/picture') data = json.loads(response.data.decode()) assert response.status_code == 404 @@ -271,7 +271,7 @@ def test_user_no_picture(app, user_1): def test_user_picture_no_user(app, user_1): client = app.test_client() - response = client.get('/api/users/2/picture') + response = client.get('/api/users/not_existing/picture') data = json.loads(response.data.decode()) assert response.status_code == 404 diff --git a/fittrackee_api/fittrackee_api/tests/test_users_model.py b/fittrackee_api/fittrackee_api/tests/test_users_model.py index 312c77dc..5cd37a73 100644 --- a/fittrackee_api/fittrackee_api/tests/test_users_model.py +++ b/fittrackee_api/fittrackee_api/tests/test_users_model.py @@ -2,7 +2,6 @@ def test_user_model(app, user_1): assert '' == str(user_1) serialized_user = user_1.serialize() - assert 1 == serialized_user['id'] assert 'test' == serialized_user['username'] assert 'created_at' in serialized_user assert serialized_user['admin'] is False diff --git a/fittrackee_api/fittrackee_api/users/auth.py b/fittrackee_api/fittrackee_api/users/auth.py index 9dcb80af..06c980bf 100644 --- a/fittrackee_api/fittrackee_api/users/auth.py +++ b/fittrackee_api/fittrackee_api/users/auth.py @@ -237,7 +237,7 @@ def login_user(): @auth_blueprint.route('/auth/logout', methods=['GET']) @authenticate -def logout_user(user_id): +def logout_user(auth_user_id): """ user logout @@ -285,7 +285,7 @@ def logout_user(user_id): if auth_header: auth_token = auth_header.split(" ")[1] resp = User.decode_auth_token(auth_token) - if not isinstance(user_id, str): + if not isinstance(auth_user_id, str): response_object = { 'status': 'success', 'message': 'Successfully logged out.', @@ -304,7 +304,7 @@ def logout_user(user_id): @auth_blueprint.route('/auth/profile', methods=['GET']) @authenticate -def get_user_status(user_id): +def get_authenticated_user_profile(auth_user_id): """ get authenticated user info @@ -330,7 +330,6 @@ def get_user_status(user_id): "created_at": "Sun, 14 Jul 2019 14:09:58 GMT", "email": "sam@example.com", "first_name": null, - "id": 2, "language": "en", "last_name": null, "location": null, @@ -360,14 +359,14 @@ def get_user_status(user_id): - Invalid token. Please log in again. """ - user = User.query.filter_by(id=user_id).first() + user = User.query.filter_by(id=auth_user_id).first() response_object = {'status': 'success', 'data': user.serialize()} return jsonify(response_object), 200 @auth_blueprint.route('/auth/profile/edit', methods=['POST']) @authenticate -def edit_user(user_id): +def edit_user(auth_user_id): """ edit authenticated user @@ -393,7 +392,6 @@ def edit_user(user_id): "created_at": "Sun, 14 Jul 2019 14:09:58 GMT", "email": "sam@example.com", "first_name": null, - "id": 2, "language": "en", "last_name": null, "location": null, @@ -476,7 +474,7 @@ def edit_user(user_id): ).decode() try: - user = User.query.filter_by(id=user_id).first() + user = User.query.filter_by(id=auth_user_id).first() user.first_name = first_name user.last_name = last_name user.bio = bio @@ -513,7 +511,7 @@ def edit_user(user_id): @auth_blueprint.route('/auth/picture', methods=['POST']) @authenticate -def edit_picture(user_id): +def edit_picture(auth_user_id): """ update authenticated user picture @@ -573,15 +571,17 @@ def edit_picture(user_id): file = request.files['file'] filename = secure_filename(file.filename) dirpath = os.path.join( - current_app.config['UPLOAD_FOLDER'], 'pictures', str(user_id) + current_app.config['UPLOAD_FOLDER'], 'pictures', str(auth_user_id) ) if not os.path.exists(dirpath): os.makedirs(dirpath) absolute_picture_path = os.path.join(dirpath, filename) - relative_picture_path = os.path.join('pictures', str(user_id), filename) + relative_picture_path = os.path.join( + 'pictures', str(auth_user_id), filename + ) try: - user = User.query.filter_by(id=user_id).first() + user = User.query.filter_by(id=auth_user_id).first() if user.picture is not None: old_picture_path = get_absolute_file_path(user.picture) if os.path.isfile(get_absolute_file_path(old_picture_path)): @@ -608,7 +608,7 @@ def edit_picture(user_id): @auth_blueprint.route('/auth/picture', methods=['DELETE']) @authenticate -def del_picture(user_id): +def del_picture(auth_user_id): """ delete authenticated user picture @@ -637,7 +637,7 @@ def del_picture(user_id): """ try: - user = User.query.filter_by(id=user_id).first() + user = User.query.filter_by(id=auth_user_id).first() picture_path = get_absolute_file_path(user.picture) if os.path.isfile(picture_path): os.remove(picture_path) diff --git a/fittrackee_api/fittrackee_api/users/models.py b/fittrackee_api/fittrackee_api/users/models.py index f3371974..5b5b3b56 100644 --- a/fittrackee_api/fittrackee_api/users/models.py +++ b/fittrackee_api/fittrackee_api/users/models.py @@ -110,7 +110,6 @@ class User(db.Model): .first() ) return { - 'id': self.id, 'username': self.username, 'email': self.email, 'created_at': self.created_at, diff --git a/fittrackee_api/fittrackee_api/users/users.py b/fittrackee_api/fittrackee_api/users/users.py index 94e7c513..89552ba8 100644 --- a/fittrackee_api/fittrackee_api/users/users.py +++ b/fittrackee_api/fittrackee_api/users/users.py @@ -37,7 +37,6 @@ def get_users(auth_user_id): "created_at": "Sun, 14 Jul 2019 14:09:58 GMT", "email": "admin@example.com", "first_name": null, - "id": 1, "language": "en", "last_name": null, "location": null, @@ -61,7 +60,6 @@ def get_users(auth_user_id): "created_at": "Sat, 20 Jul 2019 11:27:03 GMT", "email": "sam@example.com", "first_name": null, - "id": 2, "language": "fr", "last_name": null, "location": null, @@ -108,7 +106,7 @@ def get_single_user(auth_user_id, user_name): .. sourcecode:: http - GET /api/users/1 HTTP/1.1 + GET /api/users/admin HTTP/1.1 Content-Type: application/json **Example response**: @@ -127,7 +125,6 @@ def get_single_user(auth_user_id, user_name): "created_at": "Sun, 14 Jul 2019 14:09:58 GMT", "email": "admin@example.com", "first_name": null, - "id": 1, "language": "en", "last_name": null, "location": null, @@ -177,15 +174,15 @@ def get_single_user(auth_user_id, user_name): return jsonify(response_object), 404 -@users_blueprint.route('/users//picture', methods=['GET']) -def get_picture(user_id): +@users_blueprint.route('/users//picture', methods=['GET']) +def get_picture(user_name): """ get user picture **Example request**: .. sourcecode:: http - GET /api/users/1/picture HTTP/1.1 + GET /api/users/admin/picture HTTP/1.1 Content-Type: application/json **Example response**: @@ -195,7 +192,7 @@ def get_picture(user_id): HTTP/1.1 200 OK Content-Type: image/jpeg - :param integer user_id: user id + :param integer user_name: user name :statuscode 200: success :statuscode 404: @@ -205,7 +202,7 @@ def get_picture(user_id): """ response_object = {'status': 'not found', 'message': 'No picture.'} try: - user = User.query.filter_by(id=int(user_id)).first() + user = User.query.filter_by(username=user_name).first() if not user: response_object = { 'status': 'fail', diff --git a/fittrackee_client/src/components/Admin/Users/index.jsx b/fittrackee_client/src/components/Admin/Users/index.jsx index 84d2d401..517f1751 100644 --- a/fittrackee_client/src/components/Admin/Users/index.jsx +++ b/fittrackee_client/src/components/Admin/Users/index.jsx @@ -7,6 +7,7 @@ import { Link } from 'react-router-dom' import Message from '../../Common/Message' import { history } from '../../../index' import { getOrUpdateData } from '../../../actions' +import { apiUrl } from '../../../utils' class AdminUsers extends React.Component { componentDidMount() { @@ -28,7 +29,7 @@ class AdminUsers extends React.Component { - + @@ -38,8 +39,18 @@ class AdminUsers extends React.Component { {users.map(user => ( - - + +
{t('administration:id')}# {t('user:Username')} {t('user:Email')} {t('user:Registration Date')}
{user.id}
+ {user.picture === true && ( + Avatar + )} + {user.username} diff --git a/fittrackee_client/src/components/NavBar/index.jsx b/fittrackee_client/src/components/NavBar/index.jsx index 1a20fc82..dc89aa68 100644 --- a/fittrackee_client/src/components/NavBar/index.jsx +++ b/fittrackee_client/src/components/NavBar/index.jsx @@ -8,7 +8,7 @@ import { apiUrl } from '../../utils' class NavBar extends React.PureComponent { render() { - const { admin, id, isAuthenticated, picture, t, username } = this.props + const { admin, isAuthenticated, picture, t, username } = this.props return (