Skip to content

Commit cee6960

Browse files
committed
Squashed commit of the following:
commit f8bcd6e Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Mon Sep 11 18:34:43 2023 +0200 Update auth.service.ts commit 91c206c Merge: ef69bd6 6d0ef48 Author: RICHARD-Quentin <56677909+RICHARD-Quentin@users.noreply.github.com> Date: Mon Sep 11 18:12:43 2023 +0200 Merge branch 'app-developement' of https://github.com/Libertech-FR/teaket into app-developement commit 6d0ef48 Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Mon Sep 11 18:06:22 2023 +0200 FIX makefile action name commit ef69bd6 Merge: 3eaa4d1 d475193 Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Mon Sep 11 17:52:59 2023 +0200 Merge pull request #12 from Libertech-FR/authentication Authentication commit d475193 Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Mon Sep 11 17:51:40 2023 +0200 WIP auth expire commit 4136afc Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Mon Sep 11 17:47:23 2023 +0200 WIP auth commit 3eaa4d1 Author: RICHARD-Quentin <56677909+RICHARD-Quentin@users.noreply.github.com> Date: Mon Sep 11 17:50:39 2023 +0200 refactor searchFields commit 1f6f55b Author: RICHARD-Quentin <56677909+RICHARD-Quentin@users.noreply.github.com> Date: Mon Sep 11 17:49:55 2023 +0200 fix metadata schema name + optionnal commit 146fec5 Author: RICHARD-Quentin <56677909+RICHARD-Quentin@users.noreply.github.com> Date: Mon Sep 11 17:48:57 2023 +0200 populate script commit bb1080a Merge: e7b69d8 7b8103e Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Mon Sep 11 11:37:19 2023 +0200 Merge pull request #11 from Libertech-FR/authentication Authentication commit 7b8103e Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Mon Sep 11 11:36:08 2023 +0200 Delete .env commit a4787db Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Mon Sep 11 11:26:05 2023 +0200 WIP auth commit 38d3637 Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Thu Sep 7 17:55:01 2023 +0200 FIX useless console log commit 41dda1b Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Thu Sep 7 17:34:34 2023 +0200 WIP auth system commit 6d3327a Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Thu Sep 7 17:33:56 2023 +0200 FIX use api fetch commit e7b69d8 Author: RICHARD-Quentin <56677909+RICHARD-Quentin@users.noreply.github.com> Date: Mon Sep 11 11:24:10 2023 +0200 remove updateQuery commit db000a7 Author: RICHARD-Quentin <56677909+RICHARD-Quentin@users.noreply.github.com> Date: Fri Sep 8 18:12:40 2023 +0200 Pagination + filters commit e792c1f Author: RICHARD-Quentin <56677909+RICHARD-Quentin@users.noreply.github.com> Date: Thu Sep 7 19:38:57 2023 +0200 add metadata dto change custom fields dto commit 1227c58 Author: RICHARD-Quentin <56677909+RICHARD-Quentin@users.noreply.github.com> Date: Thu Sep 7 19:38:34 2023 +0200 Add filters commit 42f4739 Merge: 59b27ef 9056314 Author: RICHARD-Quentin <56677909+RICHARD-Quentin@users.noreply.github.com> Date: Thu Sep 7 09:11:13 2023 +0200 Merge branch 'app-developement' of https://github.com/Libertech-FR/teaket into app-developement commit 59b27ef Author: RICHARD-Quentin <56677909+RICHARD-Quentin@users.noreply.github.com> Date: Wed Sep 6 17:54:54 2023 +0200 create ticket add vueuse commit bdedc9e Author: RICHARD-Quentin <56677909+RICHARD-Quentin@users.noreply.github.com> Date: Wed Sep 6 17:54:32 2023 +0200 Layout commit 9056314 Merge: d48f3bd 729794e Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Thu Sep 7 02:46:30 2023 +0200 Merge branch 'main' into app-developement commit d48f3bd Author: RICHARD-Quentin <56677909+RICHARD-Quentin@users.noreply.github.com> Date: Wed Sep 6 17:54:54 2023 +0200 create ticket add vueuse commit ae9f263 Author: RICHARD-Quentin <56677909+RICHARD-Quentin@users.noreply.github.com> Date: Wed Sep 6 17:54:32 2023 +0200 Layout
1 parent c8cf271 commit cee6960

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+3667
-1531
lines changed

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,15 @@ dbs: ## Start databases
2121
-p 27017:27017 \
2222
--network dev \
2323
mongo:5.0 --wiredTigerCacheSizeGB 1.5 --quiet || true
24+
25+
stop-dbs: ## Stop databases
26+
@docker stop $(APPNAME)-redis || true
27+
@docker stop $(APPNAME)-mongodb || true
28+
29+
buildseeds: ## Build populate image
30+
docker build -t seeding -f ./populate/Dockerfile ./populate
31+
32+
populate-db: ## Populate database
33+
docker run --rm -it --network dev -v $(CURDIR)/populate:/app seeding
34+
35+

app/nuxt.config.ts

Lines changed: 57 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { extensions } from '@libertech-fr/teaket_common'
22
import pugPlugin from 'vite-plugin-pug'
3-
import { resolve } from 'node:path'
3+
import openapiTS from 'openapi-typescript'
4+
import { writeFileSync } from 'fs'
5+
import { resolve } from 'path'
46

57
const TK_APP_API_URL = process.env.TK_APP_API_URL || 'http://localhost:7100'
6-
const TK_APP_AUTH_SECRET = process.env.TK_APP_AUTH_SECRET
78

89
// https://nuxt.com/docs/api/configuration/nuxt-config
910
export default defineNuxtConfig({
@@ -21,65 +22,63 @@ export default defineNuxtConfig({
2122
enabled: true,
2223
},
2324
},
24-
plugins: [
25-
{ src: '~/plugins/ofetch' },
26-
],
25+
plugins: [{ src: '~/plugins/ofetch' }],
2726
components: {
2827
global: true,
2928
dirs: [{ path: '~/components', prefix: 'tk' }],
3029
},
3130
modules: [
32-
'nuxt-api-party',
33-
'@sidebase/nuxt-auth',
31+
'@nuxt-alt/auth',
32+
'@nuxt-alt/http',
33+
'@pinia/nuxt',
3434
'nuxt-quasar-ui',
35+
'@vueuse/nuxt',
36+
'dayjs-nuxt',
3537
...extensions.appSetup.default(),
3638
],
3739
auth: {
38-
baseURL: `${TK_APP_API_URL}/core/auth`,
39-
provider: {
40-
type: 'local',
41-
endpoints: {
42-
signIn: { path: '/login', method: 'post' },
43-
signOut: { path: '/logout', method: 'post' },
44-
signUp: { path: '/register', method: 'post' },
45-
getSession: { path: '/session', method: 'get' },
46-
},
47-
pages: {
48-
login: '/login',
49-
},
50-
},
51-
session: {
52-
enableRefreshOnWindowFocus: true,
53-
enableRefreshPeriodically: 5 * 60 * 1_000,
54-
},
55-
globalAppMiddleware: {
56-
isEnabled: true,
57-
},
58-
},
59-
runtimeConfig: {
60-
authJs: {
61-
secret: TK_APP_AUTH_SECRET,
62-
},
63-
public: {
64-
authJs: {
65-
// baseUrl: process.env.NUXT_NEXTAUTH_URL, // The URL of your deployed app (used for origin Check in production)
66-
verifyClientOnEveryRequest: true, // whether to hit the /auth/session endpoint on every client request
40+
globalMiddleware: true,
41+
rewriteRedirects: true,
42+
watchLoggedIn: true,
43+
strategies: {
44+
local: {
45+
scheme: 'refresh',
46+
token: {
47+
property: 'access_token',
48+
maxAge: 1 * 5,
49+
// maxAge: 60 * 5,
50+
},
51+
refreshToken: {
52+
property: 'refresh_token',
53+
data: 'refresh_token',
54+
maxAge: 60 * 60 * 4,
55+
},
56+
user: {
57+
property: 'user',
58+
autoFetch: true,
59+
},
60+
clientId: false,
61+
grantType: false,
62+
endpoints: {
63+
login: { url: `${TK_APP_API_URL}/core/auth/local`, method: 'post', headers: { 'Content-Type': 'application/json' } },
64+
refresh: { url: `${TK_APP_API_URL}/core/auth/refresh`, method: 'post', headers: { 'Content-Type': 'application/json' } },
65+
logout: { url: `${TK_APP_API_URL}/core/auth/logout`, method: 'post' },
66+
user: { url: `${TK_APP_API_URL}/core/auth/session`, method: 'get', propertyName: 'user' },
67+
},
68+
redirect: {
69+
logout: '/login',
70+
login: '/',
71+
},
72+
tokenType: 'Bearer',
73+
autoRefresh: true,
6774
},
6875
},
6976
},
7077
appConfig: {
7178
customSlots: {},
7279
},
73-
quasar: {},
74-
apiParty: {
75-
endpoints: {
76-
api: {
77-
url: TK_APP_API_URL,
78-
schema: `${TK_APP_API_URL}/swagger/json`,
79-
cookies: true,
80-
},
81-
},
82-
allowClient: true,
80+
quasar: {
81+
iconSet: 'mdi-v5',
8382
},
8483
vite: {
8584
define: {
@@ -101,4 +100,16 @@ export default defineNuxtConfig({
101100
// typeCheck: 'build,
102101
shim: false,
103102
},
103+
hooks: {
104+
'ready': async () => {
105+
console.log('[OpenapiTS] Generating .nuxt/types/service-api.d.ts...')
106+
try {
107+
const fileData = await openapiTS(`${TK_APP_API_URL}/swagger/json`)
108+
writeFileSync('.nuxt/types/service-api.d.ts', fileData)
109+
console.log('[OpenapiTS] Generated .nuxt/types/service-api.d.ts !')
110+
} catch (error) {
111+
console.debug('[OpenapiTS] Error while generating .nuxt/types/service-api.d.ts', error)
112+
}
113+
}
114+
}
104115
})

app/package.json

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,37 @@
66
"dev": "nuxt dev",
77
"generate": "nuxt generate",
88
"preview": "nuxt preview",
9-
"postinstall": "nuxt prepare"
9+
"postinstall": "nuxt prepare",
10+
"generate:api": "openapi-typescript http://localhost:7100/swagger/json -o ./.nuxt/types/service-api.d.ts",
11+
"upgrade:packages": "npx npm-check-updates -u --reject @types/node"
1012
},
1113
"dependencies": {
12-
"@auth/core": "^0.12.0",
1314
"@libertech-fr/teaket_common": "*",
15+
"@nuxt-alt/auth": "^2.6.1",
16+
"@nuxt-alt/http": "^1.6.8",
17+
"@pinia/nuxt": "^0.4.11",
1418
"@quasar/extras": "^1.16.6",
19+
"@vueuse/router": "^10.4.1",
1520
"cookie": "^0.5.0",
16-
"quasar": "^2.12.5"
21+
"pinia": "^2.1.6",
22+
"quasar": "^2.12.6"
1723
},
1824
"devDependencies": {
1925
"@nuxt/devtools": "latest",
20-
"@sidebase/nuxt-auth": "^0.6.0-beta.5",
2126
"@types/node": "^18.17.3",
22-
"nuxt": "^3.6.5",
23-
"nuxt-api-party": "^0.17.0",
27+
"@vueuse/core": "^10.4.1",
28+
"@vueuse/nuxt": "^10.4.1",
29+
"dayjs-nuxt": "^1.1.2",
30+
"@typescript-eslint/eslint-plugin": "^6.6.0",
31+
"@typescript-eslint/parser": "^6.6.0",
32+
"eslint": "^8.49.0",
33+
"nuxt": "~3.6.5",
2434
"nuxt-quasar-ui": "^2.0.5",
25-
"openapi-typescript": "^6.5.4",
35+
"openapi-typescript": "^6.5.5",
36+
"prettier": "^3.0.3",
2637
"vite-plugin-pug": "^0.3.2"
38+
},
39+
"resolutions": {
40+
"vite": "4.3.9"
2741
}
2842
}

app/src/app.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<template>
2+
<NuxtLayout>
3+
<NuxtPage />
4+
</NuxtLayout>
5+
</template>

app/src/components/appbar/Menu.vue

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<template lang="pug">
2+
q-btn(flat icon="mdi-dots-grid" size="xl")
3+
q-tooltip.text-body2(transition-show="scale" transition-hide="scale") Apps
4+
q-menu(max-width="350px" max-height="350px").q-pa-md
5+
.row
6+
.col-4(v-for="app in apps" :key="app.name")
7+
q-btn(flat stack dense :to="app.to" rounded).full-width
8+
q-icon(:name="app.icon.name" :color="app.icon.color" size="xl")
9+
div.text-center(:class="`text-${app.title.color}`") {{ app.title.name }}
10+
</template>
11+
12+
<script lang="ts" setup>
13+
const apps: {
14+
title: {
15+
name: string
16+
color: string
17+
}
18+
icon: {
19+
name: string
20+
color: string
21+
}
22+
to: string
23+
}[] = [
24+
{
25+
title: {
26+
name: 'Accueil',
27+
color: 'primary'
28+
},
29+
icon: {
30+
name: 'mdi-home',
31+
color: 'secondary'
32+
},
33+
to: '/'
34+
},
35+
{
36+
title: {
37+
name: 'Mes tickets',
38+
color: 'primary'
39+
},
40+
icon: {
41+
name: 'mdi-ticket',
42+
color: 'primary'
43+
},
44+
to: '/tickets'
45+
},
46+
{
47+
title: {
48+
name: 'Tickets',
49+
color: 'primary'
50+
},
51+
icon: {
52+
name: 'mdi-ticket',
53+
color: 'primary'
54+
},
55+
to: '/tickets'
56+
},
57+
{
58+
title: {
59+
name: 'Profil',
60+
color: 'primary'
61+
},
62+
icon: {
63+
name: 'mdi-account',
64+
color: 'primary'
65+
},
66+
to: '/profil'
67+
},
68+
{
69+
title: {
70+
name: 'Paramètres',
71+
color: 'primary'
72+
},
73+
icon: {
74+
name: 'mdi-cog',
75+
color: 'primary'
76+
},
77+
to: '/parametres'
78+
},
79+
{
80+
title: {
81+
name: 'Déconnexion',
82+
color: 'negative'
83+
},
84+
icon: {
85+
name: 'mdi-logout',
86+
color: 'negative'
87+
},
88+
to: '/deconnexion'
89+
}
90+
]
91+
</script>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<template lang='pug'>
2+
div
3+
q-btn(v-for="button in buttons" :key="button.icon" round flat :icon="button.icon" size="lg")
4+
q-tooltip.text-body2(transition-show="scale" transition-hide="scale") {{ button.name }}
5+
q-btn-dropdown(icon="mdi-account-circle-outline" round flat size="lg")
6+
q-list
7+
q-item.q-pa-none(v-for="button in buttons" :key="button.name")
8+
q-btn.full-width.items-baseline.q-pa-sm(
9+
:icon="button.icon"
10+
:label="button.name"
11+
:color="button?.color || 'primary'"
12+
@click="button?.action"
13+
:to='button?.to'
14+
flat
15+
dense
16+
)
17+
</template>
18+
19+
<script lang='ts' setup>
20+
const buttons = [
21+
{
22+
icon: 'mdi-cog',
23+
name: 'Paramètres',
24+
to: '/settings',
25+
},
26+
{
27+
icon: 'mdi-bell',
28+
name: 'Notifications',
29+
to: '#',
30+
},
31+
{
32+
icon: 'mdi-help',
33+
name: 'Aide',
34+
to: '#',
35+
},
36+
{
37+
icon: 'mdi-logout',
38+
name: 'Déconnexion',
39+
color: 'negative',
40+
action: async () => {
41+
await useAuth().logout()
42+
useRouter().go(0)
43+
},
44+
},
45+
]
46+
</script>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<template lang="pug">
2+
q-input(v-model="search" label="Rechercher" standout dark).q-my-xs
3+
template(v-slot:append)
4+
q-icon( v-if="search === ''" name="mdi-magnify")
5+
q-icon( v-else name="mdi-close" @click="search = ''")
6+
</template>
7+
8+
<script lang="ts" setup>
9+
import { ref } from 'vue'
10+
const search = ref('')
11+
</script>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<template lang="pug">
2+
q-toolbar.bg-primary.text-white
3+
q-btn(flat)
4+
q-avatar
5+
img(src="/logo.svg")
6+
q-toolbar-title Teaket
7+
q-separator(vertical dark inset).q-mx-md
8+
tk-AppbarMenu
9+
q-space
10+
tk-AppbarSearchfield
11+
q-separator(vertical dark inset).q-mx-md
12+
tk-AppbarRightButtons
13+
</template>
14+
15+
<script lang="ts" setup>
16+
</script>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<template lang="pug">
2+
q-select(
3+
:options="lifeSteps"
4+
)
5+
</template>
6+
7+
<script lang="ts" setup>
8+
import { ref } from 'vue'
9+
import { useHttpApi } from "~/composables/useHttpApi";
10+
const { data, pending, error, refresh } = useHttpApi('core/categories')
11+
const lifeSteps = [
12+
{ label: 'Ouvert', value: 1 },
13+
{ label: 'Clos', value: 0 },
14+
]
15+
16+
</script>

0 commit comments

Comments
 (0)