4
4
5
5
# Technology Model
6
6
technology = ns .model ('Technology' , {
7
- 'id' : fields .String (
8
- readOnly = True ,
9
- required = True ,
10
- title = 'Identifier' ,
11
- description = 'The unique id of the technology'
12
- ),
13
- 'tenant_id' : fields .String (
14
- required = True ,
15
- title = 'Tenant' ,
16
- max_length = 64 ,
17
- description = 'The tenant this technology belongs to'
18
- ),
19
7
'name' : fields .String (
20
8
required = True ,
21
9
title = 'Name' ,
22
10
max_length = 50 ,
23
11
description = 'Name of the technology'
24
12
),
13
+ })
14
+
15
+ technology_response = ns .inherit ('TechnologyResponse' , technology , {
16
+ 'id' : fields .String (
17
+ readOnly = True ,
18
+ required = True ,
19
+ title = 'Identifier' ,
20
+ description = 'The unique identifier' ,
21
+ ),
25
22
'created_at' : fields .Date (
23
+ readOnly = True ,
26
24
title = 'Created' ,
27
25
description = 'Date of creation'
28
26
),
29
27
'created_by' : fields .String (
30
- required = True ,
28
+ readOnly = True ,
31
29
title = 'Creator' ,
32
30
max_length = 64 ,
33
- description = 'Id of user who first added this technology' ,
31
+ description = 'User that created it' ,
32
+ ),
33
+ 'tenant_id' : fields .String (
34
+ readOnly = True ,
35
+ title = 'Tenant' ,
36
+ max_length = 64 ,
37
+ description = 'The tenant this belongs to' ,
34
38
),
35
39
})
36
40
37
-
38
41
@ns .route ('' )
39
42
class Technologies (Resource ):
40
43
@ns .doc ('list_technologies' )
41
- @ns .marshal_list_with (technology , code = 200 )
44
+ @ns .marshal_list_with (technology_response , code = 200 )
42
45
def get (self ):
43
46
"""List all technologies"""
44
47
return [], 200
45
48
46
49
@ns .doc ('create_technology' )
47
50
@ns .expect (technology )
48
- @ns .marshal_with (technology , code = 201 )
51
+ @ns .marshal_with (technology_response , code = 201 )
49
52
def post (self ):
50
53
"""Create a technology"""
51
54
return ns .payload , 201
@@ -56,7 +59,7 @@ def post(self):
56
59
@ns .param ('uid' , 'The technology identifier' )
57
60
class Technology (Resource ):
58
61
@ns .doc ('get_technology' )
59
- @ns .marshal_with (technology )
62
+ @ns .marshal_with (technology_response )
60
63
def get (self , uid ):
61
64
"""Retrieve a technology"""
62
65
return {}
@@ -71,7 +74,7 @@ def post(self, uid):
71
74
72
75
@ns .doc ('put_technology' )
73
76
@ns .expect (technology )
74
- @ns .marshal_with (technology )
77
+ @ns .marshal_with (technology_response )
75
78
def put (self , uid ):
76
79
"""Create or replace a technology"""
77
80
return ns .payload ()
0 commit comments