From 814183b24b3c6ce6781d90cd1b9d7df84bbf14b2 Mon Sep 17 00:00:00 2001 From: nabilasherif Date: Tue, 30 Jul 2024 14:22:11 +0300 Subject: [PATCH 01/10] intial template --- Makefile | 2 +- client/package.json | 6 +- client/pnpm-lock.yaml | 6 +- client/src/components.d.ts | 2 - client/src/main.ts | 4 +- client/src/pages/AddMembers.vue | 96 +++++++++++++ client/src/router/index.ts | 3 +- client/src/typed-router.d.ts | 1 + package.json | 5 + pnpm-lock.yaml | 232 ++++++++++++++++++++++++++++++++ 10 files changed, 346 insertions(+), 11 deletions(-) create mode 100644 client/src/pages/AddMembers.vue create mode 100644 package.json create mode 100644 pnpm-lock.yaml diff --git a/Makefile b/Makefile index 1e1f3d3..7fe89fe 100644 --- a/Makefile +++ b/Makefile @@ -48,7 +48,7 @@ install: runserver: $(server) && $(CMD) python3 manage.py runserver runclient: - $(client) && yarn && yarn dev + $(client) && pnpm install && pnpm dev test: $(server) && $(CMD) python3 manage.py test lint: diff --git a/client/package.json b/client/package.json index 4f9b854..7c20ff4 100644 --- a/client/package.json +++ b/client/package.json @@ -11,8 +11,7 @@ "@mdi/font": "7.4.47", "core-js": "^3.37.1", "roboto-fontface": "*", - "vue": "^3.4.31", - "vuetify": "^3.6.11" + "vue": "^3.4.31" }, "devDependencies": { "@babel/types": "^7.24.7", @@ -38,6 +37,7 @@ "vite-plugin-vue-layouts": "^0.11.0", "vite-plugin-vuetify": "^2.0.3", "vue-router": "^4.4.0", - "vue-tsc": "^2.0.26" + "vue-tsc": "^2.0.26", + "vuetify": "^3.6.13" } } diff --git a/client/pnpm-lock.yaml b/client/pnpm-lock.yaml index 934564f..abcb9fc 100644 --- a/client/pnpm-lock.yaml +++ b/client/pnpm-lock.yaml @@ -20,9 +20,6 @@ importers: vue: specifier: ^3.4.31 version: 3.4.33(typescript@5.5.3) - vuetify: - specifier: ^3.6.11 - version: 3.6.13(typescript@5.5.3)(vite-plugin-vuetify@2.0.3)(vue@3.4.33(typescript@5.5.3)) devDependencies: '@babel/types': specifier: ^7.24.7 @@ -96,6 +93,9 @@ importers: vue-tsc: specifier: ^2.0.26 version: 2.0.28(typescript@5.5.3) + vuetify: + specifier: ^3.6.13 + version: 3.6.13(typescript@5.5.3)(vite-plugin-vuetify@2.0.3)(vue@3.4.33(typescript@5.5.3)) packages: diff --git a/client/src/components.d.ts b/client/src/components.d.ts index 1898766..c4d9549 100644 --- a/client/src/components.d.ts +++ b/client/src/components.d.ts @@ -7,8 +7,6 @@ export {} /* prettier-ignore */ declare module 'vue' { export interface GlobalComponents { - AppFooter: typeof import('./components/AppFooter.vue')['default'] - HelloWorld: typeof import('./components/HelloWorld.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] Test: typeof import('./components/test.vue')['default'] diff --git a/client/src/main.ts b/client/src/main.ts index c8fc172..2a1d278 100644 --- a/client/src/main.ts +++ b/client/src/main.ts @@ -12,9 +12,11 @@ import App from './App.vue' // Composables import { createApp } from 'vue' +import router from './router' +import vuetify from './plugins/vuetify' const app = createApp(App) registerPlugins(app) -app.mount('#app') +app.use(router).use(vuetify).mount('#app') diff --git a/client/src/pages/AddMembers.vue b/client/src/pages/AddMembers.vue new file mode 100644 index 0000000..ed80bb3 --- /dev/null +++ b/client/src/pages/AddMembers.vue @@ -0,0 +1,96 @@ + + + \ No newline at end of file diff --git a/client/src/router/index.ts b/client/src/router/index.ts index 2f9d03c..ba004d9 100644 --- a/client/src/router/index.ts +++ b/client/src/router/index.ts @@ -7,10 +7,11 @@ // Composables import { createRouter, createWebHistory } from 'vue-router/auto' + const router = createRouter({ history: createWebHistory(import.meta.env.BASE_URL), routes: [ - { path: '/', component: () => import('@/pages/DashboardView.vue') } + { path: '/', component: () => import('@/pages/AddMembers.vue') } ], }) diff --git a/client/src/typed-router.d.ts b/client/src/typed-router.d.ts index 3b75a53..6afbb14 100644 --- a/client/src/typed-router.d.ts +++ b/client/src/typed-router.d.ts @@ -18,6 +18,7 @@ declare module 'vue-router/auto-routes' { * Route name map generated by unplugin-vue-router */ export interface RouteNamedMap { + '/AddMembers': RouteRecordInfo<'/AddMembers', '/AddMembers', Record, Record>, '/DashboardView': RouteRecordInfo<'/DashboardView', '/DashboardView', Record, Record>, } } diff --git a/package.json b/package.json new file mode 100644 index 0000000..455b53f --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "vuetify": "3.7.0-beta.1" + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000..d184b01 --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,232 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + dependencies: + vuetify: + specifier: 3.7.0-beta.1 + version: 3.7.0-beta.1(vue@3.4.34) + +packages: + + '@babel/helper-string-parser@7.24.8': + resolution: {integrity: sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==} + engines: {node: '>=6.9.0'} + + '@babel/helper-validator-identifier@7.24.7': + resolution: {integrity: sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==} + engines: {node: '>=6.9.0'} + + '@babel/parser@7.25.0': + resolution: {integrity: sha512-CzdIU9jdP0dg7HdyB+bHvDJGagUv+qtzZt5rYCWwW6tITNqV9odjp6Qu41gkG0ca5UfdDUWrKkiAnHHdGRnOrA==} + engines: {node: '>=6.0.0'} + hasBin: true + + '@babel/types@7.25.2': + resolution: {integrity: sha512-YTnYtra7W9e6/oAZEHj0bJehPRUlLH9/fbpT5LfB0NhQXyALCRkRs3zH9v07IYhkgpqX6Z78FnuccZr/l4Fs4Q==} + engines: {node: '>=6.9.0'} + + '@jridgewell/sourcemap-codec@1.5.0': + resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==} + + '@vue/compiler-core@3.4.34': + resolution: {integrity: sha512-Z0izUf32+wAnQewjHu+pQf1yw00EGOmevl1kE+ljjjMe7oEfpQ+BI3/JNK7yMB4IrUsqLDmPecUrpj3mCP+yJQ==} + + '@vue/compiler-dom@3.4.34': + resolution: {integrity: sha512-3PUOTS1h5cskdOJMExCu2TInXuM0j60DRPpSCJDqOCupCfUZCJoyQmKtRmA8EgDNZ5kcEE7vketamRZfrEuVDw==} + + '@vue/compiler-sfc@3.4.34': + resolution: {integrity: sha512-x6lm0UrM03jjDXTPZgD9Ad8bIVD1ifWNit2EaWQIZB5CULr46+FbLQ5RpK7AXtDHGjx9rmvC7QRCTjsiGkAwRw==} + + '@vue/compiler-ssr@3.4.34': + resolution: {integrity: sha512-8TDBcLaTrFm5rnF+Qm4BlliaopJgqJ28Nsrc80qazynm5aJO+Emu7y0RWw34L8dNnTRdcVBpWzJxhGYzsoVu4g==} + + '@vue/reactivity@3.4.34': + resolution: {integrity: sha512-ua+Lo+wBRlBEX9TtgPOShE2JwIO7p6BTZ7t1KZVPoaBRfqbC7N3c8Mpzicx173fXxx5VXeU6ykiHo7WgLzJQDA==} + + '@vue/runtime-core@3.4.34': + resolution: {integrity: sha512-PXhkiRPwcPGJ1BnyBZFI96GfInCVskd0HPNIAZn7i3YOmLbtbTZpB7/kDTwC1W7IqdGPkTVC63IS7J2nZs4Ebg==} + + '@vue/runtime-dom@3.4.34': + resolution: {integrity: sha512-dXqIe+RqFAK2Euak4UsvbIupalrhc67OuQKpD7HJ3W2fv8jlqvI7szfBCsAEcE8o/wyNpkloxB6J8viuF/E3gw==} + + '@vue/server-renderer@3.4.34': + resolution: {integrity: sha512-GeyEUfMVRZMD/mZcNONEqg7MiU10QQ1DB3O/Qr6+8uXpbwdlmVgQ5Qs1/ZUAFX1X2UUtqMoGrDRbxdWfOJFT7Q==} + peerDependencies: + vue: 3.4.34 + + '@vue/shared@3.4.34': + resolution: {integrity: sha512-x5LmiRLpRsd9KTjAB8MPKf0CDPMcuItjP0gbNqFCIgL1I8iYp4zglhj9w9FPCdIbHG2M91RVeIbArFfFTz9I3A==} + + csstype@3.1.3: + resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} + + entities@4.5.0: + resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} + engines: {node: '>=0.12'} + + estree-walker@2.0.2: + resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} + + magic-string@0.30.11: + resolution: {integrity: sha512-+Wri9p0QHMy+545hKww7YAu5NyzF8iomPL/RQazugQ9+Ez4Ic3mERMd8ZTX5rfK944j+560ZJi8iAwgak1Ac7A==} + + nanoid@3.3.7: + resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + + picocolors@1.0.1: + resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==} + + postcss@8.4.40: + resolution: {integrity: sha512-YF2kKIUzAofPMpfH6hOi2cGnv/HrUlfucspc7pDyvv7kGdqXrfj8SCl/t8owkEgKEuu8ZcRjSOxFxVLqwChZ2Q==} + engines: {node: ^10 || ^12 || >=14} + + source-map-js@1.2.0: + resolution: {integrity: sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==} + engines: {node: '>=0.10.0'} + + to-fast-properties@2.0.0: + resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} + engines: {node: '>=4'} + + vue@3.4.34: + resolution: {integrity: sha512-VZze05HWlA3ItreQ/ka7Sx7PoD0/3St8FEiSlSTVgb6l4hL+RjtP2/8g5WQBzZgyf8WG2f+g1bXzC7zggLhAJA==} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + + vuetify@3.7.0-beta.1: + resolution: {integrity: sha512-F6a+pSG7dLrU28sGlR8r4WMuBsLMprOsDpaywGopNrGk351Hs4AAhx/y88ROGUEf28yAPShSM86bPnD30xNyDw==} + engines: {node: ^12.20 || >=14.13} + peerDependencies: + typescript: '>=4.7' + vite-plugin-vuetify: '>=1.0.0' + vue: ^3.3.0 + vue-i18n: ^9.0.0 + webpack-plugin-vuetify: '>=2.0.0' + peerDependenciesMeta: + typescript: + optional: true + vite-plugin-vuetify: + optional: true + vue-i18n: + optional: true + webpack-plugin-vuetify: + optional: true + +snapshots: + + '@babel/helper-string-parser@7.24.8': {} + + '@babel/helper-validator-identifier@7.24.7': {} + + '@babel/parser@7.25.0': + dependencies: + '@babel/types': 7.25.2 + + '@babel/types@7.25.2': + dependencies: + '@babel/helper-string-parser': 7.24.8 + '@babel/helper-validator-identifier': 7.24.7 + to-fast-properties: 2.0.0 + + '@jridgewell/sourcemap-codec@1.5.0': {} + + '@vue/compiler-core@3.4.34': + dependencies: + '@babel/parser': 7.25.0 + '@vue/shared': 3.4.34 + entities: 4.5.0 + estree-walker: 2.0.2 + source-map-js: 1.2.0 + + '@vue/compiler-dom@3.4.34': + dependencies: + '@vue/compiler-core': 3.4.34 + '@vue/shared': 3.4.34 + + '@vue/compiler-sfc@3.4.34': + dependencies: + '@babel/parser': 7.25.0 + '@vue/compiler-core': 3.4.34 + '@vue/compiler-dom': 3.4.34 + '@vue/compiler-ssr': 3.4.34 + '@vue/shared': 3.4.34 + estree-walker: 2.0.2 + magic-string: 0.30.11 + postcss: 8.4.40 + source-map-js: 1.2.0 + + '@vue/compiler-ssr@3.4.34': + dependencies: + '@vue/compiler-dom': 3.4.34 + '@vue/shared': 3.4.34 + + '@vue/reactivity@3.4.34': + dependencies: + '@vue/shared': 3.4.34 + + '@vue/runtime-core@3.4.34': + dependencies: + '@vue/reactivity': 3.4.34 + '@vue/shared': 3.4.34 + + '@vue/runtime-dom@3.4.34': + dependencies: + '@vue/reactivity': 3.4.34 + '@vue/runtime-core': 3.4.34 + '@vue/shared': 3.4.34 + csstype: 3.1.3 + + '@vue/server-renderer@3.4.34(vue@3.4.34)': + dependencies: + '@vue/compiler-ssr': 3.4.34 + '@vue/shared': 3.4.34 + vue: 3.4.34 + + '@vue/shared@3.4.34': {} + + csstype@3.1.3: {} + + entities@4.5.0: {} + + estree-walker@2.0.2: {} + + magic-string@0.30.11: + dependencies: + '@jridgewell/sourcemap-codec': 1.5.0 + + nanoid@3.3.7: {} + + picocolors@1.0.1: {} + + postcss@8.4.40: + dependencies: + nanoid: 3.3.7 + picocolors: 1.0.1 + source-map-js: 1.2.0 + + source-map-js@1.2.0: {} + + to-fast-properties@2.0.0: {} + + vue@3.4.34: + dependencies: + '@vue/compiler-dom': 3.4.34 + '@vue/compiler-sfc': 3.4.34 + '@vue/runtime-dom': 3.4.34 + '@vue/server-renderer': 3.4.34(vue@3.4.34) + '@vue/shared': 3.4.34 + + vuetify@3.7.0-beta.1(vue@3.4.34): + dependencies: + vue: 3.4.34 From 29799650bb6ad89b29b24f2503d5b9ac824a8681 Mon Sep 17 00:00:00 2001 From: nabilasherif Date: Thu, 8 Aug 2024 16:53:49 +0300 Subject: [PATCH 02/10] "add members" style modifications --- client/src/api/axios.ts | 13 +++- client/src/pages/AddMembers.vue | 103 ++++++++++++++------------------ client/src/plugins/vuetify.ts | 2 +- 3 files changed, 58 insertions(+), 60 deletions(-) diff --git a/client/src/api/axios.ts b/client/src/api/axios.ts index dea7a34..8c1c0fc 100644 --- a/client/src/api/axios.ts +++ b/client/src/api/axios.ts @@ -14,4 +14,15 @@ const BaseClient: AxiosInstance = axios.create({ timeout: 1000, }); -export { AuthClient, BaseClient }; +async function Search(searchInput:any) { + await AuthClient.get(`/members/search/${searchInput}`) + .then(response=>{ + console.log('Search results:', response.data); + return response.data; + }) + .catch(error=>{ + console.error('Error searching for members:', error); + }) +} + +export default{ AuthClient, BaseClient, Search }; diff --git a/client/src/pages/AddMembers.vue b/client/src/pages/AddMembers.vue index ed80bb3..f9bc754 100644 --- a/client/src/pages/AddMembers.vue +++ b/client/src/pages/AddMembers.vue @@ -1,70 +1,48 @@ \ No newline at end of file + } + + const SearchMember = async () => { + try { + members.value = await axios.Search(searchText.value) + } catch (error) { + console.error(error) + notifier.notify({ + title: 'Fail', + description: 'no member found', + showProgressBar: true, + timeout: 7_000, + type: 'error', + }) + } + } + + async function getMembers () { + try { + members = await axios.getProjectMembers(project_id) + } catch (error) { + console.error(error) + } + } + + onMounted(() => { + getMembers() + }) + + return { + props, + SearchMember, + searchText, + inviteNewMember, + addMemberDialog, + addMember, + loadingAdd, + } + }, + + } + diff --git a/server/test_tracker/views/member.py b/server/test_tracker/views/member.py index 8567a26..1f37acb 100644 --- a/server/test_tracker/views/member.py +++ b/server/test_tracker/views/member.py @@ -39,7 +39,7 @@ class GetMemberApiView(GenericAPIView): """ serializer_class = MemberSerializers - permission_classes = (IsHost,) + # permission_classes = (IsHost,) def get(self, request: Request) -> Response: """Use this method to get all of member based on request user""" @@ -94,7 +94,7 @@ class MemberDetailAPIView(GenericAPIView): """ serializer_class = MemberSerializers - permission_classes = (UserIsAuthenticated,) + # permission_classes = (UserIsAuthenticated,) def get(self, request: Request, member_id: str) -> Response: """Return a single member based on the request user, member_email""" @@ -139,7 +139,7 @@ class FULLACCESSPermissionAPIView(GenericAPIView): """ serializer_class = MemberSerializers - permission_classes = (UserIsAuthenticated,) + # permission_classes = (UserIsAuthenticated,) def get(self, request: Request) -> Response: member = get_full_access_permission_based_on_user(request.user) @@ -155,7 +155,7 @@ class ADMINACCESSPermissionAPIView(GenericAPIView): """ serializer_class = MemberSerializers - permission_classes = (UserIsAuthenticated,) + # permission_classes = (UserIsAuthenticated,) def get(self, request: Request) -> Response: member = get_admin_access_permission_based_on_user(request.user) @@ -186,7 +186,7 @@ class ProjectMembersAPIView(GenericAPIView): """This class to return all project members""" serializer_class = ProjectTeamSerializer - permission_classes = (HasProjectAccess,) + # permission_classes = (HasProjectAccess,) def get(self, request: Request, project_id: str) -> Response: """Use this endpoint to get all project members""" From 1b47dd6a2b32de0d80f7564eb3ec459c8361af18 Mon Sep 17 00:00:00 2001 From: nabilasherif Date: Sun, 25 Aug 2024 14:45:23 +0300 Subject: [PATCH 09/10] validations, addmember BE, select BE connection --- client/src/api/axios.ts | 34 ++++++++++++++---- client/src/pages/AddMembers.vue | 57 +++++++++++++++++++++--------- client/src/types/types.ts | 6 ++++ client/src/utilities/validators.ts | 28 +++++++++++++++ 4 files changed, 102 insertions(+), 23 deletions(-) diff --git a/client/src/api/axios.ts b/client/src/api/axios.ts index d50d8ed..cc573e7 100644 --- a/client/src/api/axios.ts +++ b/client/src/api/axios.ts @@ -1,7 +1,7 @@ import axios, { AxiosInstance } from 'axios' const AuthClient: AxiosInstance = axios.create({ - baseURL: import.meta.env.VITE_APP_ENDPOINT, + baseURL: window.location.origin, timeout: 1000, headers: { 'Content-Type': 'application/json', @@ -10,14 +10,34 @@ const AuthClient: AxiosInstance = axios.create({ }) const BaseClient: AxiosInstance = axios.create({ - baseURL: import.meta.env.VITE_APP_ENDPOINT, + baseURL: window.location.origin, timeout: 1000, }) -async function Search (searchInput:any) { - return await AuthClient.get(`/members/search/${searchInput}`) +async function search (searchInput:any) { + try { + return await AuthClient.get(`/members/search/${searchInput}`) + } catch (error) { + console.error(error) + throw error + } } -async function getProjectMembers (projectId:any) { - return await AuthClient.get(`/members/project/${projectId}/members/`) + +async function addMember (inviteNewMember:any) { + try { + await AuthClient.post(`/dashboard/members/`, inviteNewMember) + } catch (error) { + console.error(error) + throw error + } +} +async function getMembers () { + try { + return await AuthClient.get(`/api/members/all/`) + } catch (error) { + console.error(error) + throw error + } } -export default { AuthClient, BaseClient, Search } + +export default { AuthClient, BaseClient, search, getMembers, addMember } diff --git a/client/src/pages/AddMembers.vue b/client/src/pages/AddMembers.vue index 8d08a4e..07c2f6c 100644 --- a/client/src/pages/AddMembers.vue +++ b/client/src/pages/AddMembers.vue @@ -2,19 +2,19 @@
-

ALL MEMBERS

+

All members

- INVITE MEMBERS + Invite member
- +
@@ -25,6 +25,7 @@ density="compact" placeholder="First Name" prepend-inner-icon="mdi-account-outline" + :rules="nameRules" variant="outlined" />

Permission

Close - ADD+ + ADD+
@@ -95,6 +100,8 @@ diff --git a/client/src/types/types.ts b/client/src/types/types.ts index e69de29..804dc12 100644 --- a/client/src/types/types.ts +++ b/client/src/types/types.ts @@ -0,0 +1,6 @@ +export interface InviteNewMember { + first_name: string; + last_name: string; + email: string; + permission: string; + } diff --git a/client/src/utilities/validators.ts b/client/src/utilities/validators.ts index e69de29..37d54b1 100644 --- a/client/src/utilities/validators.ts +++ b/client/src/utilities/validators.ts @@ -0,0 +1,28 @@ +export const emailRules = [ + (value: string) => { + if (value) return true + return 'You must enter an email.' + }, + (value: string) => { + if (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) return true + return 'Email must be a valid email address.' + }, +] +export const nameRules = [ + (value: string) => { + if (value) return true + return 'You must enter a name.' + }, + (value: string) => { + if (value?.length > 1) return true + return 'Name must be at least 1 character.' + }, + (value: string) => { + if (value?.length < 49) return true + return 'Name must be at most 50 characters.' + }, + (value: string) => { + if (/[^0-9]/.test(value)) return true + return 'Name can not contain digits.' + }, +] From 7b46a93750b74649af97251d889f322b4ff94ce1 Mon Sep 17 00:00:00 2001 From: nabilasherif Date: Thu, 29 Aug 2024 14:30:03 +0300 Subject: [PATCH 10/10] rm comments from be, merged with dev2, defined datatypes --- client/src/api/axios.ts | 30 +------- client/src/api/members.ts | 6 +- client/src/pages/AddMembers.vue | 115 ++++++++++++++-------------- client/src/router/index.ts | 3 +- client/src/types/types.ts | 2 +- server/test_tracker/views/member.py | 10 +-- 6 files changed, 70 insertions(+), 96 deletions(-) diff --git a/client/src/api/axios.ts b/client/src/api/axios.ts index 4fe6487..7aebc6f 100644 --- a/client/src/api/axios.ts +++ b/client/src/api/axios.ts @@ -2,36 +2,8 @@ import axiosClient from 'axios' const accessToken = localStorage.getItem('TESTTRACKER_ACCESS_TOKEN') export const axios = axiosClient.create({ - baseURL: 'https://server.gent02.dev.grid.tf/api', + baseURL: 'https://server.gent02.dev.grid.tf', headers: { Authorization: `Bearer ${accessToken}`, }, }) - -async function search (searchInput:any) { - try { - return await axios.get(`/members/search/${searchInput}`) - } catch (error) { - console.error(error) - throw error - } -} - -async function addMember (inviteNewMember:any) { - try { - await axios.post(`/dashboard/members/`, inviteNewMember) - } catch (error) { - console.error(error) - throw error - } -} -async function getMembers () { - try { - return await axios.get(`/api/members/all/`) - } catch (error) { - console.error(error) - throw error - } -} - -export default { search, getMembers, addMember } diff --git a/client/src/api/members.ts b/client/src/api/members.ts index 7e31889..4fa16df 100644 --- a/client/src/api/members.ts +++ b/client/src/api/members.ts @@ -1,6 +1,7 @@ import { axios } from './axios' +import { inviteNewMember } from '../types/types' -async function search (searchInput:any) { +async function search (searchInput:string) { try { return await axios.get(`/members/search/${searchInput}`) } catch (error) { @@ -9,7 +10,7 @@ async function search (searchInput:any) { } } -async function addMember (inviteNewMember:any) { +async function addMember (inviteNewMember:inviteNewMember) { try { await axios.post(`/dashboard/members/`, inviteNewMember) } catch (error) { @@ -19,6 +20,7 @@ async function addMember (inviteNewMember:any) { } async function getMembers () { try { + localStorage.setItem('TESTTRACKER_ACCESS_TOKEN', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNzI0OTM2NTM5LCJpYXQiOjE3MjQ5MjcyMzksImp0aSI6IjgwMDY5OTAzZDNjMzRjMzVhMzdjMWZmMjc3ZWMxMWQ0IiwidXNlcl9pZCI6MSwiZW1haWwiOiJuYWJpbGFAZ21haWwuY29tIn0.NWT-fAt4vCyefqDeCRRLqnG2q2sDBQJq7jrRRSmgcK4') return await axios.get(`/api/members/all/`) } catch (error) { console.error(error) diff --git a/client/src/pages/AddMembers.vue b/client/src/pages/AddMembers.vue index 07c2f6c..1f30ce9 100644 --- a/client/src/pages/AddMembers.vue +++ b/client/src/pages/AddMembers.vue @@ -21,7 +21,7 @@ -

There are {{ count }} members registered

+

There are {{ MembersCount }} members registered


@@ -85,7 +85,7 @@ sm="6" > - + {{ member.full_name }} View Details @@ -97,30 +97,26 @@
-