Skip to content

Commit f9acd5f

Browse files
authored
Merge pull request #2 from Libertech-FR/1-schematics
1 schematics
2 parents 30a75e7 + 3f2e580 commit f9acd5f

File tree

159 files changed

+5676
-438
lines changed

Some content is hidden

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

159 files changed

+5676
-438
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@ npm-debug.log*
66
yarn-debug.log*
77
yarn-error.log*
88
extensions.yml
9+
.vscode/
10+
.env
11+
.env.*
12+
!.env.example

app/app.vue

Lines changed: 0 additions & 6 deletions
This file was deleted.

app/nuxt.config.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import { extensions } from '@libertech-fr/teaket_common'
22
import pugPlugin from 'vite-plugin-pug'
33
import { resolve } from 'node:path'
44

5+
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
7+
58
// https://nuxt.com/docs/api/configuration/nuxt-config
69
export default defineNuxtConfig({
710
ssr: false,
@@ -10,7 +13,7 @@ export default defineNuxtConfig({
1013
srcDir: 'src',
1114
debug: !!process.env.DEBUG,
1215
devServer: {
13-
port: 8000,
16+
port: 7000,
1417
},
1518
devtools: {
1619
enabled: process.env.NODE_ENV === 'development',
@@ -27,14 +30,12 @@ export default defineNuxtConfig({
2730
},
2831
modules: [
2932
'nuxt-api-party',
30-
// '@hebilicious/authjs-nuxt',
31-
// '@nuxtjs/auth-next',
3233
'@sidebase/nuxt-auth',
3334
'nuxt-quasar-ui',
3435
...extensions.appSetup.default(),
3536
],
3637
auth: {
37-
baseURL: 'http://localhost:9000/core/auth',
38+
baseURL: `${TK_APP_API_URL}/core/auth`,
3839
provider: {
3940
type: 'local',
4041
endpoints: {
@@ -49,33 +50,32 @@ export default defineNuxtConfig({
4950
},
5051
session: {
5152
enableRefreshOnWindowFocus: true,
52-
enableRefreshPeriodically: 5000,
53+
enableRefreshPeriodically: 5 * 60 * 1_000,
5354
},
5455
globalAppMiddleware: {
5556
isEnabled: true,
5657
},
5758
},
5859
runtimeConfig: {
5960
authJs: {
60-
secret: process.env.AUTH_SECRET,
61-
},
62-
github: {
63-
clientId: process.env.NUXT_GITHUB_CLIENT_ID,
64-
clientSecret: process.env.NUXT_GITHUB_CLIENT_SECRET,
61+
secret: TK_APP_AUTH_SECRET,
6562
},
6663
public: {
6764
authJs: {
68-
baseUrl: process.env.NUXT_NEXTAUTH_URL, // The URL of your deployed app (used for origin Check in production)
65+
// baseUrl: process.env.NUXT_NEXTAUTH_URL, // The URL of your deployed app (used for origin Check in production)
6966
verifyClientOnEveryRequest: true, // whether to hit the /auth/session endpoint on every client request
7067
},
7168
},
7269
},
70+
appConfig: {
71+
customSlots: {},
72+
},
7373
quasar: {},
7474
apiParty: {
7575
endpoints: {
7676
api: {
77-
url: `${process.env.NUXT_API_URL}`,
78-
schema: `${process.env.NUXT_API_URL}/swagger/json`,
77+
url: TK_APP_API_URL,
78+
schema: `${TK_APP_API_URL}/swagger/json`,
7979
cookies: true,
8080
},
8181
},

app/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
},
1111
"dependencies": {
1212
"@auth/core": "^0.12.0",
13-
"@hebilicious/authjs-nuxt": "^0.3.0-beta.2",
1413
"@libertech-fr/teaket_common": "*",
15-
"@nuxtjs/auth-next": "5.0.0-1667386184.dfbbb54",
1614
"@quasar/extras": "^1.16.6",
1715
"cookie": "^0.5.0",
1816
"quasar": "^2.12.5"

app/src/composables/useApiFetch.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ import { FetchError } from 'ofetch'
1616
// } as any)
1717
// }
1818

19+
//TODO: fix this
20+
21+
// export const useApiFetch = useApiData
22+
1923
export function useApiFetch<P extends AllPaths<Paths>, M extends IgnoreCase<keyof Paths[`/${P}`] & HttpMethod>>(
2024
path: MaybeRefOrGetter<P>,
2125
opts?: Omit<UseOpenApiDataOptions<Paths[`/${P}`], M>, 'method'> & {

app/src/pages/index.vue

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -5,84 +5,8 @@ div
55
tk-hook(name="index.accueil.bottom")
66
q-btn(@click='signIn()') signIn
77
q-btn(@click='signOut()') signOut
8-
q-btn(@click='call()') call
98
</template>
109

1110
<script lang='ts' setup>
12-
definePageMeta({ auth: true })
13-
// import { components } from '#nuxt-api-party/api'
14-
15-
// import { useApiFetch } from '../../../docs/useApiFetch.ts'
16-
17-
import { useApiFetch } from '~/composables/useApiFetch'
18-
1911
const { signIn, signOut, session, status, cookies, getProviders, user, sessionToken } = useAuth()
20-
// type TicketCreateDto = components['schemas']['TicketCreateDto']
21-
22-
const formData = {
23-
subject: 'toto'
24-
}
25-
try {
26-
const { data } = await useApiData('tickets/ticket', {
27-
method: 'post',
28-
query: {
29-
aaaa: 1
30-
},
31-
body: {
32-
subject: 1
33-
},
34-
async onRequestError({ error }) {
35-
console.log(error)
36-
},
37-
})
38-
} catch (e) {
39-
console.log('e', e)
40-
}
41-
42-
const call = async () => {
43-
// const { data } = await useApiData('tickets/ticket', {
44-
// })
45-
try {
46-
const { data } = await useApiFetch2('tickets/ticket', {
47-
method: 'post',
48-
cache: false,
49-
client: true,
50-
// query: {
51-
// limit: 1
52-
// },
53-
// pathParams: {
54-
// id: '1'
55-
// },
56-
body: {
57-
subjecet: "1"
58-
},
59-
}, {
60-
subject: 'aaa'
61-
})
62-
} catch (e) {
63-
console.log('e', e)
64-
}
65-
// console.log('test', data)
66-
// onRequest(context: FetchContext): Promise<void> | void {
67-
// context.options.headers = {
68-
// 'Test': '1'
69-
// }
70-
// console.log('onRequest', context)
71-
// }
72-
// method: 'get',
73-
// // client: true,
74-
// // headers: {
75-
// // 'Test': '1'
76-
// // },
77-
// // body: formData,
78-
// // watch: {
79-
// // onRequest: {
80-
// // handler: () => {
81-
// // console.log('onRequest')
82-
// // },
83-
// // }
84-
// // }
85-
// })
86-
console.log('data', data)
87-
}
8812
</script>

app/src/pages/tickets.vue

Lines changed: 0 additions & 63 deletions
This file was deleted.

docs/app/HOOKS.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Hooks
2+
**Regex** :
3+
`/^(pages|components|layouts):([\w\/-]+):([\w\/-]+)$/`
4+
## Syntax
5+
```ts
6+
const hook = `${prefix}:${file_path}:${hook_name}`
7+
const prefix = pages | components | layouts
8+
const file_path = tickets/_id
9+
const hook_name = sidebar/top_actions
10+
```
11+
## List
12+
13+
| Hook | Description |
14+
| ---- |------------------------|
15+
|pages:tickets/_id:sidebar/top_actions| Ce n'est qu'un exemple |

docs/service/dto/NEW_DTO.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Create new DTO
2+
## For crud operations
3+
```ts
4+
import { ApiProperty, PartialType } from '@nestjs/swagger'
5+
import { AbstractCustomFieldsDto } from '~/_common/abstracts/dto/abstract.custom-fields.dto'
6+
import { IsMongoId } from 'class-validator'
7+
8+
export class [NAME]CreateDto extends AbstractCustomFieldsDto {
9+
[FIELDS_HERE...]
10+
}
11+
12+
export class [NAME]Dto extends [NAME]CreateDto {
13+
@IsMongoId()
14+
@ApiProperty()
15+
public _id: string
16+
}
17+
18+
export class [NAME]UpdateDto extends PartialType([NAME]CreateDto) {
19+
}
20+
```

service/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
TEAKET_MONGOOSE_URI=mongodb://localhost:27017/teaket
1+
TK_SERVICE_MONGOOSE_URI=mongodb://localhost:27017/teaket

0 commit comments

Comments
 (0)