Merge pull request from SamR1/export-endpoints-update-and-policy-fix

endpoints update and privacy policy display fix
This commit is contained in:
Sam 2023-03-05 12:29:31 +01:00 committed by GitHub
commit 778075f376
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 82 additions and 33 deletions

@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><!--[if IE]><link rel="icon" href="/favicon.ico"><![endif]--><link rel="stylesheet" href="/static/css/fork-awesome.min.css"/><link rel="stylesheet" href="/static/css/leaflet.css"/><title>FitTrackee</title><script defer="defer" src="/static/js/chunk-vendors.169de3d0.js"></script><script defer="defer" src="/static/js/app.cd4bf5f0.js"></script><link href="/static/css/app.966592aa.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="/img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/img/icons/favicon-16x16.png"><link rel="manifest" href="/manifest.json"><meta name="theme-color" content="#4DBA87"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="fittrackee_client"><link rel="apple-touch-icon" href="/img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="/img/icons/safari-pinned-tab.svg" color="#4DBA87"><meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but FitTrackee doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><!--[if IE]><link rel="icon" href="/favicon.ico"><![endif]--><link rel="stylesheet" href="/static/css/fork-awesome.min.css"/><link rel="stylesheet" href="/static/css/leaflet.css"/><title>FitTrackee</title><script defer="defer" src="/static/js/chunk-vendors.169de3d0.js"></script><script defer="defer" src="/static/js/app.d6a305ed.js"></script><link href="/static/css/app.e504ceb2.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="/img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/img/icons/favicon-16x16.png"><link rel="manifest" href="/manifest.json"><meta name="theme-color" content="#4DBA87"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="fittrackee_client"><link rel="apple-touch-icon" href="/img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="/img/icons/safari-pinned-tab.svg" color="#4DBA87"><meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but FitTrackee doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,2 +1,2 @@
"use strict";(self["webpackChunkfittrackee_client"]=self["webpackChunkfittrackee_client"]||[]).push([[193],{7885:function(e,s,t){t.r(s),t.d(s,{default:function(){return A}});var a=t(6252),r=t(2262),l=t(3577),o=(t(7658),t(9150)),n=t(436);const c={class:"chart-menu"},i={class:"chart-arrow"},u={class:"time-frames custom-checkboxes-group"},d={class:"time-frames-checkboxes custom-checkboxes"},p=["id","name","checked","onInput"],m={class:"chart-arrow"};var v=(0,a.aZ)({__name:"StatsMenu",emits:["arrowClick","timeFrameUpdate"],setup(e,{emit:s}){const t=(0,r.iH)("month"),o=["week","month","year"];function n(e){t.value=e,s("timeFrameUpdate",e)}return(e,r)=>((0,a.wg)(),(0,a.iD)("div",c,[(0,a._)("div",i,[(0,a._)("i",{class:"fa fa-chevron-left","aria-hidden":"true",onClick:r[0]||(r[0]=e=>s("arrowClick",!0))})]),(0,a._)("div",u,[(0,a._)("div",d,[((0,a.wg)(),(0,a.iD)(a.HY,null,(0,a.Ko)(o,(s=>(0,a._)("div",{class:"time-frame custom-checkbox",key:s},[(0,a._)("label",null,[(0,a._)("input",{type:"radio",id:s,name:s,checked:t.value===s,onInput:e=>n(s)},null,40,p),(0,a._)("span",null,(0,l.zw)(e.$t(`statistics.TIME_FRAMES.${s}`)),1)])]))),64))])]),(0,a._)("div",m,[(0,a._)("i",{class:"fa fa-chevron-right","aria-hidden":"true",onClick:r[1]||(r[1]=e=>s("arrowClick",!1))})])]))}}),k=t(3744);const _=(0,k.Z)(v,[["__scopeId","data-v-22d55de2"]]);var S=_,w=t(631);const f={class:"sports-menu"},h=["id","name","checked","onInput"],U={class:"sport-label"};var b=(0,a.aZ)({__name:"StatsSportsMenu",props:{userSports:null,selectedSportIds:{default:()=>[]}},emits:["selectedSportIdsUpdate"],setup(e,{emit:s}){const t=e,{t:n}=(0,o.QT)(),c=(0,a.f3)("sportColors"),{selectedSportIds:i}=(0,r.BK)(t),u=(0,a.Fl)((()=>(0,w.xH)(t.userSports,n)));function d(e){s("selectedSportIdsUpdate",e)}return(e,s)=>{const t=(0,a.up)("SportImage");return(0,a.wg)(),(0,a.iD)("div",f,[((0,a.wg)(!0),(0,a.iD)(a.HY,null,(0,a.Ko)((0,r.SU)(u),(e=>((0,a.wg)(),(0,a.iD)("label",{type:"checkbox",key:e.id,style:(0,l.j5)({color:e.color?e.color:(0,r.SU)(c)[e.label]})},[(0,a._)("input",{type:"checkbox",id:e.id,name:e.label,checked:(0,r.SU)(i).includes(e.id),onInput:s=>d(e.id)},null,40,h),(0,a.Wm)(t,{"sport-label":e.label,color:e.color},null,8,["sport-label","color"]),(0,a._)("span",U,(0,l.zw)(e.translatedLabel),1)],4)))),128))])}}});const I=b;var g=I,T=t(9318);const y={key:0,id:"user-statistics"};var C=(0,a.aZ)({__name:"index",props:{sports:null,user:null},setup(e){const s=e,{t:t}=(0,o.QT)(),{sports:l,user:c}=(0,r.BK)(s),i=(0,r.iH)("month"),u=(0,r.iH)(v(i.value)),d=(0,a.Fl)((()=>(0,w.xH)(s.sports,t))),p=(0,r.iH)(_(s.sports));function m(e){i.value=e,u.value=v(i.value)}function v(e){return(0,T.aZ)(new Date,e,s.user.weekm)}function k(e){u.value=(0,T.FN)(u.value,e,s.user.weekm)}function _(e){return e.map((e=>e.id))}function f(e){p.value.includes(e)?p.value=p.value.filter((s=>s!==e)):p.value.push(e)}return(0,a.YP)((()=>s.sports),(e=>{p.value=_(e)})),(e,s)=>(0,r.SU)(d)?((0,a.wg)(),(0,a.iD)("div",y,[(0,a.Wm)(S,{onTimeFrameUpdate:m,onArrowClick:k}),(0,a.Wm)(n.Z,{sports:(0,r.SU)(l),user:(0,r.SU)(c),chartParams:u.value,"displayed-sport-ids":p.value,fullStats:!0},null,8,["sports","user","chartParams","displayed-sport-ids"]),(0,a.Wm)(g,{"selected-sport-ids":p.value,"user-sports":(0,r.SU)(l),onSelectedSportIdsUpdate:f},null,8,["selected-sport-ids","user-sports"])])):(0,a.kq)("",!0)}});const F=(0,k.Z)(C,[["__scopeId","data-v-30799d13"]]);var Z=F,x=t(5630),D=t(5801),H=t(9917);const E={id:"statistics",class:"view"},R={key:0,class:"container"};var W=(0,a.aZ)({__name:"StatisticsView",setup(e){const s=(0,H.o)(),t=(0,a.Fl)((()=>s.getters[D.YN.GETTERS.AUTH_USER_PROFILE])),o=(0,a.Fl)((()=>s.getters[D.O8.GETTERS.SPORTS].filter((e=>t.value.sports_list.includes(e.id)))));return(e,s)=>{const n=(0,a.up)("Card");return(0,a.wg)(),(0,a.iD)("div",E,[(0,r.SU)(t).username?((0,a.wg)(),(0,a.iD)("div",R,[(0,a.Wm)(n,null,{title:(0,a.w5)((()=>[(0,a.Uk)((0,l.zw)(e.$t("statistics.STATISTICS")),1)])),content:(0,a.w5)((()=>[(0,a.Wm)(Z,{class:(0,l.C_)({"stats-disabled":0===(0,r.SU)(t).nb_workouts}),user:(0,r.SU)(t),sports:(0,r.SU)(o)},null,8,["class","user","sports"])])),_:1}),0===(0,r.SU)(t).nb_workouts?((0,a.wg)(),(0,a.j4)(x.Z,{key:0})):(0,a.kq)("",!0)])):(0,a.kq)("",!0)])}}});const P=(0,k.Z)(W,[["__scopeId","data-v-2e341d4e"]]);var A=P}}]);
//# sourceMappingURL=statistics.ec583fa8.js.map
//# sourceMappingURL=statistics.af5663d2.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -2845,7 +2845,7 @@ class TestPostUserDataExportRequest(ApiTestCaseMixin):
)
response = client.post(
'/api/auth/profile/export/request',
'/api/auth/account/export/request',
content_type='application/json',
headers=dict(Authorization=f'Bearer {auth_token}'),
)
@ -2871,7 +2871,7 @@ class TestPostUserDataExportRequest(ApiTestCaseMixin):
)
response = client.post(
'/api/auth/profile/export/request',
'/api/auth/account/export/request',
content_type='application/json',
headers=dict(Authorization=f'Bearer {auth_token}'),
)
@ -2893,7 +2893,7 @@ class TestPostUserDataExportRequest(ApiTestCaseMixin):
)
response = client.post(
'/api/auth/profile/export/request',
'/api/auth/account/export/request',
content_type='application/json',
headers=dict(Authorization=f'Bearer {auth_token}'),
)
@ -2919,7 +2919,7 @@ class TestPostUserDataExportRequest(ApiTestCaseMixin):
)
response = client.post(
'/api/auth/profile/export/request',
'/api/auth/account/export/request',
content_type='application/json',
headers=dict(Authorization=f'Bearer {auth_token}'),
)
@ -2944,7 +2944,7 @@ class TestPostUserDataExportRequest(ApiTestCaseMixin):
)
client.post(
'/api/auth/profile/export/request',
'/api/auth/account/export/request',
content_type='application/json',
headers=dict(Authorization=f'Bearer {auth_token}'),
)
@ -2974,7 +2974,7 @@ class TestPostUserDataExportRequest(ApiTestCaseMixin):
)
client.post(
'/api/auth/profile/export/request',
'/api/auth/account/export/request',
content_type='application/json',
headers=dict(Authorization=f'Bearer {auth_token}'),
)
@ -3000,7 +3000,7 @@ class TestPostUserDataExportRequest(ApiTestCaseMixin):
)
client.post(
'/api/auth/profile/export/request',
'/api/auth/account/export/request',
content_type='application/json',
headers=dict(Authorization=f'Bearer {auth_token}'),
)
@ -3025,7 +3025,7 @@ class TestGetUserDataExportRequest(ApiTestCaseMixin):
)
response = client.get(
'/api/auth/profile/export',
'/api/auth/account/export',
content_type='application/json',
headers=dict(Authorization=f'Bearer {auth_token}'),
)
@ -3053,7 +3053,7 @@ class TestGetUserDataExportRequest(ApiTestCaseMixin):
)
response = client.get(
'/api/auth/profile/export',
'/api/auth/account/export',
content_type='application/json',
headers=dict(Authorization=f'Bearer {auth_token}'),
)
@ -3075,7 +3075,7 @@ class TestDownloadExportDataArchive(ApiTestCaseMixin):
)
response = client.get(
f'/api/auth/profile/export/{self.random_string()}',
f'/api/auth/account/export/{self.random_string()}',
headers=dict(Authorization=f'Bearer {auth_token}'),
)
@ -3095,7 +3095,7 @@ class TestDownloadExportDataArchive(ApiTestCaseMixin):
)
response = client.get(
f'/api/auth/profile/export/{archive_file_name}',
f'/api/auth/account/export/{archive_file_name}',
headers=dict(Authorization=f'Bearer {auth_token}'),
)
@ -3114,7 +3114,7 @@ class TestDownloadExportDataArchive(ApiTestCaseMixin):
)
response = client.get(
f'/api/auth/profile/export/{self.random_string()}',
f'/api/auth/account/export/{self.random_string()}',
headers=dict(Authorization=f'Bearer {auth_token}'),
)
@ -3136,7 +3136,7 @@ class TestDownloadExportDataArchive(ApiTestCaseMixin):
mock.return_value = 'file'
client.get(
f'/api/auth/profile/export/{archive_file_name}',
f'/api/auth/account/export/{archive_file_name}',
headers=dict(Authorization=f'Bearer {auth_token}'),
)

@ -1688,7 +1688,7 @@ def accept_privacy_policy(auth_user: User) -> Union[Dict, HttpResponse]:
return handle_error_and_return_response(e, db=db)
@auth_blueprint.route('/auth/profile/export/request', methods=['POST'])
@auth_blueprint.route('/auth/account/export/request', methods=['POST'])
@require_auth()
def request_user_data_export(auth_user: User) -> Union[Dict, HttpResponse]:
"""
@ -1698,7 +1698,7 @@ def request_user_data_export(auth_user: User) -> Union[Dict, HttpResponse]:
.. sourcecode:: http
POST /auth/profile/export/request HTTP/1.1
POST /auth/account/export/request HTTP/1.1
Content-Type: application/json
**Example response**:
@ -1761,7 +1761,7 @@ def request_user_data_export(auth_user: User) -> Union[Dict, HttpResponse]:
return handle_error_and_return_response(e, db=db)
@auth_blueprint.route('/auth/profile/export', methods=['GET'])
@auth_blueprint.route('/auth/account/export', methods=['GET'])
@require_auth()
def get_user_data_export(auth_user: User) -> Union[Dict, HttpResponse]:
"""
@ -1777,7 +1777,7 @@ def get_user_data_export(auth_user: User) -> Union[Dict, HttpResponse]:
.. sourcecode:: http
GET /auth/profile/export HTTP/1.1
GET /auth/account/export HTTP/1.1
Content-Type: application/json
**Example response**:
@ -1829,7 +1829,7 @@ def get_user_data_export(auth_user: User) -> Union[Dict, HttpResponse]:
@auth_blueprint.route(
'/auth/profile/export/<string:file_name>', methods=['GET']
'/auth/account/export/<string:file_name>', methods=['GET']
)
@require_auth()
def download_data_export(
@ -1842,7 +1842,7 @@ def download_data_export(
.. sourcecode:: http
GET /auth/profile/export/download/archive_rgjsR3fHr5Yp.zip HTTP/1.1
GET /auth/account/export/download/archive_rgjsR3fHr5Yp.zip HTTP/1.1
Content-Type: application/json
**Example response**:

@ -212,7 +212,7 @@
async function downloadArchive(filename: string) {
generatingLink.value = true
await authApi
.get(`/auth/profile/export/${filename}`, {
.get(`/auth/account/export/${filename}`, {
responseType: 'blob',
})
.then((response) => {

@ -129,6 +129,10 @@ export const actions: ActionTree<IAuthUserState, IRootState> &
AUTH_USER_STORE.MUTATIONS.UPDATE_AUTH_USER_PROFILE,
res.data.data
)
if (!res.data.data.accepted_privacy_policy) {
// refresh privacy policy
context.dispatch(ROOT_STORE.ACTIONS.GET_APPLICATION_PRIVACY_POLICY)
}
if (res.data.data.language) {
context.dispatch(
ROOT_STORE.ACTIONS.UPDATE_APPLICATION_LANGUAGE,
@ -452,7 +456,7 @@ export const actions: ActionTree<IAuthUserState, IRootState> &
): void {
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
authApi
.post('auth/profile/export/request')
.post('auth/account/export/request')
.then((res) => {
if (res.data.status === 'success') {
context.commit(
@ -470,7 +474,7 @@ export const actions: ActionTree<IAuthUserState, IRootState> &
): void {
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
authApi
.get('auth/profile/export')
.get('auth/account/export')
.then((res) => {
if (res.data.status === 'success') {
context.commit(

@ -51,6 +51,24 @@ export const actions: ActionTree<IRootState, IRootState> & IRootActions = {
})
.catch((error) => handleError(context, error))
},
[ROOT_STORE.ACTIONS.GET_APPLICATION_PRIVACY_POLICY](
context: ActionContext<IRootState, IRootState>
): void {
context.commit(ROOT_STORE.MUTATIONS.EMPTY_ERROR_MESSAGES)
authApi
.get('config')
.then((res) => {
if (res.data.status === 'success') {
context.commit(
ROOT_STORE.MUTATIONS.UPDATE_APPLICATION_PRIVACY_POLICY,
res.data.data
)
} else {
handleError(context, null)
}
})
.catch((error) => handleError(context, error))
},
[ROOT_STORE.ACTIONS.UPDATE_APPLICATION_CONFIG](
context: ActionContext<IRootState, IRootState>,
payload: TAppConfigForm

@ -1,5 +1,6 @@
export enum RootActions {
GET_APPLICATION_CONFIG = 'GET_APPLICATION_CONFIG',
GET_APPLICATION_PRIVACY_POLICY = 'GET_APPLICATION_PRIVACY_POLICY',
GET_APPLICATION_STATS = 'GET_APPLICATION_STATS',
UPDATE_APPLICATION_CONFIG = 'UPDATE_APPLICATION_CONFIG',
UPDATE_APPLICATION_LANGUAGE = 'UPDATE_APPLICATION_LANGUAGE',
@ -19,6 +20,7 @@ export enum RootMutations {
SET_ERROR_MESSAGES = 'SET_ERROR_MESSAGES',
UPDATE_APPLICATION_CONFIG = 'UPDATE_APPLICATION_CONFIG',
UPDATE_APPLICATION_LOADING = 'UPDATE_APPLICATION_LOADING',
UPDATE_APPLICATION_PRIVACY_POLICY = 'UPDATE_APPLICATION_PRIVACY_POLICY',
UPDATE_APPLICATION_STATS = 'UPDATE_APPLICATION_STATS',
UPDATE_LANG = 'UPDATE_LANG',
}

@ -27,6 +27,13 @@ export const mutations: MutationTree<IRootState> & TRootMutations = {
) {
state.appLoading = loading
},
[ROOT_STORE.MUTATIONS.UPDATE_APPLICATION_PRIVACY_POLICY](
state: IRootState,
appConfig: TAppConfig
) {
state.application.config.privacy_policy = appConfig.privacy_policy
state.application.config.privacy_policy_date = appConfig.privacy_policy_date
},
[ROOT_STORE.MUTATIONS.UPDATE_APPLICATION_STATS](
state: IRootState,
statistics: IAppStatistics

@ -30,6 +30,9 @@ export interface IRootActions {
[ROOT_STORE.ACTIONS.GET_APPLICATION_STATS](
context: ActionContext<IRootState, IRootState>
): void
[ROOT_STORE.ACTIONS.GET_APPLICATION_PRIVACY_POLICY](
context: ActionContext<IRootState, IRootState>
): void
[ROOT_STORE.ACTIONS.UPDATE_APPLICATION_CONFIG](
context: ActionContext<IRootState, IRootState>,
payload: TAppConfigForm
@ -70,6 +73,10 @@ export type TRootMutations<S = IRootState> = {
state: S,
loading: boolean
): void
[ROOT_STORE.MUTATIONS.UPDATE_APPLICATION_PRIVACY_POLICY](
state: S,
config: TAppConfig
): void
[ROOT_STORE.MUTATIONS.UPDATE_APPLICATION_STATS](
state: S,
statistics: IAppStatistics

@ -136,6 +136,7 @@
.privacy-policy-message {
display: flex;
justify-content: center;
margin: 0 $default-margin*.5;
}
@media screen and (max-width: $medium-limit) {

@ -8,5 +8,15 @@
</template>
<script lang="ts" setup>
import { onBeforeMount } from 'vue'
import PrivacyPolicy from '@/components/PrivacyPolicy.vue'
import { ROOT_STORE } from '@/store/constants'
import { useStore } from '@/use/useStore'
const store = useStore()
onBeforeMount(() => {
store.dispatch(ROOT_STORE.ACTIONS.GET_APPLICATION_PRIVACY_POLICY)
})
</script>