added azure related code
[it/otf.git] / otf-frontend / server / src / feathers / models / file.model.js
1 /*  Copyright (c) 2019 AT&T Intellectual Property.                             #\r
2 #                                                                              #\r
3 #   Licensed under the Apache License, Version 2.0 (the "License");            #\r
4 #   you may not use this file except in compliance with the License.           #\r
5 #   You may obtain a copy of the License at                                    #\r
6 #                                                                              #\r
7 #       http://www.apache.org/licenses/LICENSE-2.0                             #\r
8 #                                                                              #\r
9 #   Unless required by applicable law or agreed to in writing, software        #\r
10 #   distributed under the License is distributed on an "AS IS" BASIS,          #\r
11 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #\r
12 #   See the License for the specific language governing permissions and        #\r
13 #   limitations under the License.                                             #\r
14 ##############################################################################*/\r
15 \r
16 \r
17 module.exports = function (app) {\r
18         const mongooseClient = app.get('mongooseClient');\r
19         const { Schema } = mongooseClient;\r
20         const files = new Schema({//Esquema base de los usuarios.\r
21         length: {\r
22             type: Number\r
23         },\r
24         chunkSize: {\r
25             type: Number\r
26         },\r
27         uploadDate: {\r
28             type: Date\r
29         },\r
30         md5: {\r
31             type: String\r
32         },\r
33         filename: {\r
34             type: String\r
35         },\r
36         contentType: {\r
37             type: String\r
38         },\r
39         metadata: {\r
40             type: Object\r
41         },\r
42         path:{\r
43             type:String,\r
44             readonly:true\r
45         }\r
46     },{collection:`fs.files`, shardKey: { filename: 1 }});\r
47         \r
48         return mongooseClient.model('files', files);\r
49 \r
50 };\r