Skip to content

Commit

Permalink
Merge branch 'master' of github.com:makeomatic/ms-files
Browse files Browse the repository at this point in the history
  • Loading branch information
AVVS committed Mar 16, 2016
2 parents fe265f8 + f755dd7 commit c76c165
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"chai": "^3.4.1",
"codecov.io": "^0.1.6",
"cz-conventional-changelog": "^1.1.5",
"eslint": "~2.2.0",
"eslint": "~2.4.0",
"eslint-config-airbnb": "^6.0.1",
"eslint-plugin-mocha": "^2.0.0",
"faker": "^3.0.1",
Expand Down
24 changes: 24 additions & 0 deletions schemas/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,30 @@
}
}
},
"cappasity-archive": {
"type": "object",
"required": ["type", "contentType", "contentLength", "md5Hash"],
"additionalProperties": false,
"properties": {
"type": {
"type": "string",
"constant": "c-archive"
},
"contentType": {
"type": "string",
"constant": "application/cappasity-archive"
},
"contentLength": {
"type": "integer",
"minimum": 1,
"maximum": 2000000000
},
"md5Hash": {
"type": "string",
"pattern": "^[0-9A-Fa-f]{32}$"
}
}
},
"meta": {
"type": "object",
"required": ["name"],
Expand Down
3 changes: 3 additions & 0 deletions schemas/upload.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
},
{
"$ref": "common#/definitions/cappasity-image"
},
{
"$ref": "common#/definitions/cappasity-archive"
}
]
}
Expand Down
1 change: 1 addition & 0 deletions src/actions/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const TYPE_MAP = {
'c-bin': '.bin.gz',
'c-texture': '.jpeg',
'c-preview': '.jpeg',
'c-archive': '.zip',
};

function typeToExtension(type) {
Expand Down
1 change: 1 addition & 0 deletions src/custom/cappasity-postprocess.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const TYPE_MAP = {
'c-preview': 'preview',
'c-bin': 'model',
'c-texture': 'texture',
'c-archive': 'archive',
};

module.exports = function extractMetadata(data) {
Expand Down
1 change: 1 addition & 0 deletions src/custom/cappasity-upload-pre.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = function extractMetadata(files, username) {

assert.equal(fileTypes['c-bin'], 1, 'must contain exactly one binary upload');
assert.equal(fileTypes['c-preview'], 1, 'must contain preview');
assert.equal(fileTypes['c-archive'], 1, 'must contain prepared archive');
assert.ok(fileTypes['c-texture'] >= 1, 'must contain at least one texture');
})
.then(() => amqp.publishAndWait(getMetadata, { username, audience }))
Expand Down

0 comments on commit c76c165

Please sign in to comment.