@@ -2,8 +2,6 @@ import { FastifyPluginAsync } from "fastify";
2
2
import {
3
3
createIntergationHandler ,
4
4
pauseOrResumeIntergationHandler ,
5
- whatsappIntergationHandler ,
6
- whatsappIntergationHandlerPost ,
7
5
} from "./handlers/post.handler" ;
8
6
import {
9
7
createIntergationSchema ,
@@ -13,6 +11,11 @@ import {
13
11
regenerateAPIKeySchema ,
14
12
} from "./schema" ;
15
13
14
+ import {
15
+ whatsappIntergationHandler ,
16
+ whatsappIntergationHandlerPost ,
17
+ } from "./handlers/whatsapp.handler" ;
18
+
16
19
import {
17
20
generateAPIKeyHandler ,
18
21
getAPIIntegrationHandler ,
@@ -22,42 +25,66 @@ import { getChannelsByProvider } from "./handlers/get.handler";
22
25
23
26
const root : FastifyPluginAsync = async ( fastify , _ ) : Promise < void > => {
24
27
// create integration for channel
25
- fastify . post ( "/:id" , {
26
- schema : createIntergationSchema ,
27
- onRequest : [ fastify . authenticate ] ,
28
- } , createIntergationHandler ) ;
28
+ fastify . post (
29
+ "/:id" ,
30
+ {
31
+ schema : createIntergationSchema ,
32
+ onRequest : [ fastify . authenticate ] ,
33
+ } ,
34
+ createIntergationHandler
35
+ ) ;
29
36
// pause or resume integration
30
- fastify . post ( "/:id/toggle" , {
31
- schema : pauseOrResumeIntergationSchema ,
32
- onRequest : [ fastify . authenticate ] ,
33
- } , pauseOrResumeIntergationHandler ) ;
37
+ fastify . post (
38
+ "/:id/toggle" ,
39
+ {
40
+ schema : pauseOrResumeIntergationSchema ,
41
+ onRequest : [ fastify . authenticate ] ,
42
+ } ,
43
+ pauseOrResumeIntergationHandler
44
+ ) ;
34
45
35
46
// return all bot channels
36
- fastify . get ( "/:id" , {
37
- onRequest : [ fastify . authenticate ] ,
38
- } , getChannelsByProvider ) ;
47
+ fastify . get (
48
+ "/:id" ,
49
+ {
50
+ onRequest : [ fastify . authenticate ] ,
51
+ } ,
52
+ getChannelsByProvider
53
+ ) ;
39
54
40
55
// whatsapp integration
41
56
fastify . get ( "/:id/whatsapp" , { } , whatsappIntergationHandler ) ;
42
57
fastify . post ( "/:id/whatsapp" , { } , whatsappIntergationHandlerPost ) ;
43
58
44
59
// api key integration
45
- fastify . get ( "/:id/api" , {
46
- schema : getAPIIntegrationSchema ,
47
- onRequest : [ fastify . authenticate ] ,
48
- } , getAPIIntegrationHandler ) ;
60
+ fastify . get (
61
+ "/:id/api" ,
62
+ {
63
+ schema : getAPIIntegrationSchema ,
64
+ onRequest : [ fastify . authenticate ] ,
65
+ } ,
66
+ getAPIIntegrationHandler
67
+ ) ;
49
68
50
69
// generate api key
51
- fastify . post ( "/:id/api" , {
52
- schema : generateAPIKeySchema ,
53
- onRequest : [ fastify . authenticate ] ,
54
- } , generateAPIKeyHandler ) ;
70
+ fastify . post (
71
+ "/:id/api" ,
72
+ {
73
+ schema : generateAPIKeySchema ,
74
+ onRequest : [ fastify . authenticate ] ,
75
+ } ,
76
+ generateAPIKeyHandler
77
+ ) ;
55
78
56
79
// regenerate api key
57
- fastify . put ( "/:id/api" , {
58
- schema : regenerateAPIKeySchema ,
59
- onRequest : [ fastify . authenticate ] ,
60
- } , regenerateAPIKeyHandler ) ;
80
+ fastify . put (
81
+ "/:id/api" ,
82
+ {
83
+ schema : regenerateAPIKeySchema ,
84
+ onRequest : [ fastify . authenticate ] ,
85
+ } ,
86
+ regenerateAPIKeyHandler
87
+ ) ;
61
88
} ;
62
89
63
90
export default root ;
0 commit comments