1
- import { UserServices } from '../services' ;
2
1
import { constants } from 'http2' ;
3
- import { Domain } from '../domain' ;
4
-
5
- const {
6
- Models : { Responses } ,
7
- } = Domain ;
2
+ import { UserServices } from '../services' ;
8
3
9
4
/**
10
5
* Callback function for performing a CRUD.
@@ -17,38 +12,36 @@ const {
17
12
* @function delete - Delete the information of a user using his ID.
18
13
*/
19
14
export const UsersController = {
20
- getById : ( req , res , next ) => {
21
- try {
22
- const message = UserServices . getById ( ) ;
23
- res . status ( constants . HTTP_STATUS_OK ) . json ( message ) ;
24
- } catch ( err ) {
25
- next ( err ) ;
26
- }
27
- } ,
28
- create : async ( req , res , next ) => {
29
- {
30
- try {
31
- const message = UserServices . create ( ) ;
32
- res . status ( constants . HTTP_STATUS_OK ) . json ( message ) ;
33
- } catch ( err ) {
34
- next ( err ) ;
35
- }
36
- }
37
- } ,
38
- update : async ( req , res , next ) => {
39
- try {
40
- const message = UserServices . update ( ) ;
41
- res . status ( constants . HTTP_STATUS_OK ) . json ( message ) ;
42
- } catch ( err ) {
43
- next ( err ) ;
44
- }
45
- } ,
46
- delete : async ( req , res , next ) => {
47
- try {
48
- const message = UserServices . delete ( ) ;
49
- res . status ( constants . HTTP_STATUS_OK ) . json ( message ) ;
50
- } catch ( err ) {
51
- next ( err ) ;
52
- }
53
- } ,
54
- }
15
+ getById : ( req , res , next ) => {
16
+ try {
17
+ const message = UserServices . getById ( ) ;
18
+ res . status ( constants . HTTP_STATUS_OK ) . json ( message ) ;
19
+ } catch ( err ) {
20
+ next ( err ) ;
21
+ }
22
+ } ,
23
+ create : async ( req , res , next ) => {
24
+ try {
25
+ const message = UserServices . create ( ) ;
26
+ res . status ( constants . HTTP_STATUS_OK ) . json ( message ) ;
27
+ } catch ( err ) {
28
+ next ( err ) ;
29
+ }
30
+ } ,
31
+ update : async ( req , res , next ) => {
32
+ try {
33
+ const message = UserServices . update ( ) ;
34
+ res . status ( constants . HTTP_STATUS_OK ) . json ( message ) ;
35
+ } catch ( err ) {
36
+ next ( err ) ;
37
+ }
38
+ } ,
39
+ delete : async ( req , res , next ) => {
40
+ try {
41
+ const message = UserServices . deleteByID ( ) ;
42
+ res . status ( constants . HTTP_STATUS_OK ) . json ( message ) ;
43
+ } catch ( err ) {
44
+ next ( err ) ;
45
+ }
46
+ } ,
47
+ } ;
0 commit comments