Skip to content

Commit 84f8281

Browse files
authored
Merge pull request #46 from Dialogue-Bot/DIAL-36-manager-intent
feat: crud intent
2 parents 338c1a5 + fa4eb75 commit 84f8281

Some content is hidden

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

59 files changed

+1689
-248
lines changed

client/package-lock.json

Lines changed: 14 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
"million": "^3.0.6",
7878
"next-themes": "^0.2.1",
7979
"react": "^18.2.0",
80+
"react-contenteditable": "^3.3.7",
8081
"react-day-picker": "^8.10.0",
8182
"react-dom": "^18.2.0",
8283
"react-hook-form": "^7.50.1",

client/src/apis/flow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class FlowApi {
2222
return http_client.delete(`${ENDPOINTS.FLOW.INDEX}/${id}`)
2323
}
2424

25-
publish(id: string) {
25+
publish(id: string): Promise<TBaseResponse<TFLow>> {
2626
return http_client.post(`${ENDPOINTS.FLOW.PUBLISH}/${id}`)
2727
}
2828

client/src/apis/intent.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { ENDPOINTS } from '@/constants'
2+
import http_client from '@/lib/http-client'
3+
import { TIntent, TIntentInput } from '@/types/intent'
4+
import { TBaseQuery, TBaseResponse, TResPagination } from '@/types/share'
5+
6+
class IntentApi {
7+
create(data: TIntentInput): Promise<TBaseResponse<TIntent>> {
8+
return http_client.post(ENDPOINTS.INTENT.INDEX, data)
9+
}
10+
11+
update(id: string, data: TIntentInput): Promise<TBaseResponse<TIntent>> {
12+
return http_client.put(`${ENDPOINTS.INTENT.INDEX}/${id}`, data)
13+
}
14+
15+
delete(id: string): Promise<TBaseResponse<null>> {
16+
return http_client.delete(`${ENDPOINTS.INTENT.INDEX}/${id}`)
17+
}
18+
19+
get(id: string): Promise<TBaseResponse<TIntent>> {
20+
return http_client.get(`${ENDPOINTS.INTENT.INDEX}/${id}`)
21+
}
22+
23+
getAll(q?: TBaseQuery): Promise<TResPagination<TIntent>> {
24+
return http_client.get(ENDPOINTS.INTENT.INDEX, { params: q })
25+
}
26+
}
27+
28+
export const intentApi = new IntentApi()

client/src/app.tsx

Lines changed: 2 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,6 @@
1-
import {
2-
Channels,
3-
ChatBotDetail,
4-
Chatbots,
5-
ForgotPassword,
6-
Login,
7-
Mail,
8-
Profiles,
9-
Register,
10-
SetPassword,
11-
} from '@/pages'
12-
import { Outlet, createBrowserRouter, redirect } from 'react-router-dom'
1+
import { Outlet } from 'react-router-dom'
132

14-
import {
15-
AppLayout,
16-
AuthLayout,
17-
PublishLayout,
18-
SettingLayout,
19-
} from '@/components/layouts'
203
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
21-
import { Suspense } from 'react'
22-
import PageLoading from './components/page-loading'
23-
import { ROUTES } from './constants'
24-
import {
25-
appLoader,
26-
articleLoader,
27-
articlesLoader,
28-
authLoader,
29-
channelsLoader,
30-
flowDetailLoader,
31-
flowsLoader,
32-
settingLoader,
33-
} from './lib/loader'
34-
import Help from './pages/help'
35-
import HelpDetail from './pages/help-detail'
364

375
const App = () => {
386
return (
@@ -43,120 +11,4 @@ const App = () => {
4311
)
4412
}
4513

46-
export const router = createBrowserRouter([
47-
{
48-
Component: App,
49-
children: [
50-
{
51-
loader: authLoader,
52-
element: (
53-
<Suspense fallback={<PageLoading />}>
54-
<AuthLayout />
55-
</Suspense>
56-
),
57-
children: [
58-
{
59-
path: ROUTES.AUTH.LOGIN,
60-
Component: Login,
61-
index: true,
62-
},
63-
{
64-
path: ROUTES.AUTH.REGISTER,
65-
Component: Register,
66-
},
67-
{
68-
path: ROUTES.AUTH.FORGOT_PASS,
69-
Component: ForgotPassword,
70-
},
71-
{
72-
path: ROUTES.AUTH.RESET_PASS,
73-
Component: SetPassword,
74-
},
75-
],
76-
},
77-
{
78-
element: (
79-
<Suspense fallback={<PageLoading />}>
80-
<AppLayout />
81-
</Suspense>
82-
),
83-
loader: appLoader,
84-
children: [
85-
{
86-
path: ROUTES.PRIVATE.DASHBOARD,
87-
index: true,
88-
loader: async () => {
89-
return redirect(ROUTES.PRIVATE.CHAT_BOT.INDEX)
90-
},
91-
},
92-
{
93-
path: ROUTES.PRIVATE.CHAT_BOT.INDEX,
94-
Component: Chatbots,
95-
loader: flowsLoader,
96-
},
97-
98-
{
99-
path: ROUTES.PRIVATE.CHANNEL.INDEX,
100-
Component: Channels,
101-
loader: channelsLoader,
102-
},
103-
{
104-
path: ROUTES.PRIVATE.SETTING.INDEX,
105-
Component: SettingLayout,
106-
loader: settingLoader,
107-
children: [
108-
{
109-
path: ROUTES.PRIVATE.SETTING.MAIL,
110-
Component: Mail,
111-
},
112-
{
113-
path: ROUTES.PRIVATE.SETTING.PROFILES,
114-
Component: Profiles,
115-
},
116-
{
117-
index: true,
118-
loader: async () => {
119-
return redirect(ROUTES.PRIVATE.SETTING.PROFILES)
120-
},
121-
},
122-
],
123-
},
124-
],
125-
},
126-
{
127-
Component: PublishLayout,
128-
children: [
129-
{
130-
path: ROUTES.PUBLIC.LANDING_PAGE,
131-
element: <div>Hi</div>,
132-
},
133-
{
134-
path: ROUTES.PUBLIC.HELP,
135-
loader: articlesLoader,
136-
element: <Help />,
137-
},
138-
{
139-
loader: articleLoader,
140-
path: `${ROUTES.PUBLIC.HELP}/:slug`,
141-
element: <HelpDetail />,
142-
},
143-
],
144-
},
145-
{
146-
loader: appLoader,
147-
element: (
148-
<Suspense fallback={<PageLoading />}>
149-
<AppLayout showHeader={false} />
150-
</Suspense>
151-
),
152-
children: [
153-
{
154-
path: `${ROUTES.PRIVATE.CHAT_BOT.INDEX}/:id`,
155-
Component: ChatBotDetail,
156-
loader: flowDetailLoader,
157-
},
158-
],
159-
},
160-
],
161-
},
162-
])
14+
export default App

0 commit comments

Comments
 (0)